public Dimse(int pcid, String tsUID, Command cmd, Stream ins) { this.m_pcid = pcid; this.cmd = cmd; this.ds = null; this.src = null; this.m_ins = ins; this.tsUID = tsUID; }
public Dimse(int pcid, Command cmd, Dataset ds, DataSourceI src) { this.m_pcid = pcid; this.cmd = cmd; this.ds = ds; this.src = src; this.m_ins = null; this.tsUID = null; this.cmd.PutUS(Tags.DataSetType, ds == null && src == null?Command.NO_DATASET:0); }
public DOSELoad(string _filePath) { if (_filePath != "") { DICOMLoad dl = new DICOMLoad(); this.ds = dl.Load(_filePath); this.success = true; } else { this.success = false; } }
public Dataset Load(FileInfo file) { Stream ins = null; DcmParser parser = null; Dataset ds = null; try { try { ins = new BufferedStream(new FileStream(file.FullName, FileMode.Open, FileAccess.Read)); parser = new DcmParser(ins); FileFormat format = parser.DetectFileFormat(); if (format != null) { ds = new Dataset(); parser.DcmHandler = ds.DcmHandler; parser.ParseDcmFile(format, Tags.PixelData); //MessageBox.Show("Pomyślnie!"); return ds; } else { //MessageBox.Show("failed!"); } } catch (Exception e) { MessageBox.Show(e.StackTrace); } } finally { if (ins != null) { try { ins.Close(); } catch (IOException) { } } } return null; }
/// <summary> /// Send C-GET /// </summary> public Dataset[] CGet(string studyInstanceUID, string seriesInstanceUID, string sopInstanceUID) { if ((studyInstanceUID == null) && (seriesInstanceUID == null) && (sopInstanceUID == null)) return null; int pcid = PCID_START; PCID_START += 2; Dataset[] ret = null; try { string sopClassUID = UIDs.StudyRootQueryRetrieveInformationModelGET; m_assocRQ.AddPresContext(aFact.NewPresContext(pcid, sopClassUID, new String[]{ m_tsUID })); ActiveAssociation active = OpenAssoc(); if (active != null) { Dataset ds = new Dataset(); FileMetaInfo fmi = new FileMetaInfo(); fmi.PutOB(Tags.FileMetaInformationVersion, new byte[] {0, 1}); fmi.PutUI(Tags.MediaStorageSOPClassUID, sopClassUID); fmi.PutUI(Tags.TransferSyntaxUID, m_tsUID); fmi.PutSH(Tags.ImplementationVersionName, "dicomcs-SCU"); ds.SetFileMetaInfo(fmi); if (studyInstanceUID != null) ds.PutUI(Tags.StudyInstanceUID, studyInstanceUID); if (seriesInstanceUID != null) ds.PutUI(Tags.SeriesInstanceUID, seriesInstanceUID); if (sopInstanceUID != null) ds.PutUI(Tags.SOPInstanceUID, sopInstanceUID); PresContext pc = null; Association assoc = active.Association; if ((ds.GetFileMetaInfo() != null) && (ds.GetFileMetaInfo().TransferSyntaxUID != null)) { String tsuid = ds.GetFileMetaInfo().TransferSyntaxUID; if ((pc = assoc.GetAcceptedPresContext(sopClassUID, tsuid)) == null) { log.Error( "SOP class UID not supported" ); return null; } } else if ((pc = assoc.GetAcceptedPresContext(sopClassUID, UIDs.ImplicitVRLittleEndian)) == null && (pc = assoc.GetAcceptedPresContext(sopClassUID, UIDs.ExplicitVRLittleEndian)) == null && (pc = assoc.GetAcceptedPresContext(sopClassUID, UIDs.ExplicitVRBigEndian)) == null) { log.Error( "SOP class UID not supported" ); return null; } Dimse rq = aFact.NewDimse(pcid, oFact.NewCommand().InitCGetRQ(assoc.NextMsgID(), sopClassUID, 0), ds); FutureRSP rsp = active.Invoke(rq); active.Release(true); if (rsp.IsReady()) { ArrayList al = rsp.ListPending(); if (al.Count > 0) { ret = new Dataset[al.Count]; for (int i=0;i < ret.Length;i++) ret[i] = ((Dimse)al[i]).Dataset; } else { ret = new Dataset[1]; ret[0] = rsp.Get().Dataset; } } m_assocRQ.RemovePresContext(pcid); } } catch { } finally { m_assocRQ.RemovePresContext(pcid); } return ret; }
/// <summary> /// Send C-FIND for series /// </summary> public Dataset[] CFindSeries(string studyInstanceUID, string[] modalities) { int pcid = PCID_START; PCID_START += 2; Dataset[] ret = null; try { string sopClassUID = UIDs.StudyRootQueryRetrieveInformationModelFIND; m_assocRQ.AddPresContext(aFact.NewPresContext(pcid, sopClassUID, new String[]{ m_tsUID })); ActiveAssociation active = OpenAssoc(); if (active != null) { Dataset ds = new Dataset(); FileMetaInfo fmi = new FileMetaInfo(); fmi.PutOB(Tags.FileMetaInformationVersion, new byte[] {0, 1}); fmi.PutUI(Tags.MediaStorageSOPClassUID, sopClassUID); fmi.PutUI(Tags.TransferSyntaxUID, m_tsUID); fmi.PutSH(Tags.ImplementationVersionName, "dicomcs-SCU"); ds.SetFileMetaInfo(fmi); ds.PutCS(Tags.QueryRetrieveLevel, "SERIES"); ds.PutCS(Tags.Modality); ds.PutUI(Tags.StudyInstanceUID, studyInstanceUID); ds.PutUI(Tags.SeriesInstanceUID); PresContext pc = null; Association assoc = active.Association; if ((ds.GetFileMetaInfo() != null) && (ds.GetFileMetaInfo().TransferSyntaxUID != null)) { String tsuid = ds.GetFileMetaInfo().TransferSyntaxUID; if ((pc = assoc.GetAcceptedPresContext(sopClassUID, tsuid)) == null) { log.Error( "SOP class UID not supported" ); return null; } } else if ((pc = assoc.GetAcceptedPresContext(sopClassUID, UIDs.ImplicitVRLittleEndian)) == null && (pc = assoc.GetAcceptedPresContext(sopClassUID, UIDs.ExplicitVRLittleEndian)) == null && (pc = assoc.GetAcceptedPresContext(sopClassUID, UIDs.ExplicitVRBigEndian)) == null) { log.Error( "SOP class UID not supported" ); return null; } Dimse rq = aFact.NewDimse(pcid, oFact.NewCommand().InitCFindRQ(assoc.NextMsgID(), sopClassUID, 0), ds); FutureRSP rsp = active.Invoke(rq); active.Release(true); if (rsp.IsReady()) { ArrayList al = rsp.ListPending(); if ((al != null) && (al.Count > 0) && (modalities != null) && (modalities.Length > 0)) { for (int i=0;i < al.Count;i++) { try { string mod = ((Dimse) al[i]).Dataset.GetString(Tags.Modality); int j=0; for (;j < modalities.Length;j++) if (string.Compare(modalities[j], mod) == 0) break; if (j == modalities.Length) al.RemoveAt(i--); } catch { al.RemoveAt(i--); } } } if (al.Count > 0) { int len = al.Count; ret = new Dataset[len]; for (int i=0;i < len;i++) ret[i] = (Dataset) ((Dimse) al[i]).Dataset; } } } } finally { m_assocRQ.RemovePresContext(pcid); } return ret; }
/// <summary> /// Send C-FIND for study /// </summary> public Dataset[] CFindStudy(string patid, string[] modalities) { int pcid = PCID_START; PCID_START += 2; Dataset[] ret = null; try { string sopClassUID = UIDs.StudyRootQueryRetrieveInformationModelFIND; m_assocRQ.AddPresContext(aFact.NewPresContext(pcid, sopClassUID, new String[]{ m_tsUID })); ActiveAssociation active = OpenAssoc(); if (active != null) { Dataset ds = new Dataset(); FileMetaInfo fmi = new FileMetaInfo(); fmi.PutOB(Tags.FileMetaInformationVersion, new byte[] {0, 1}); fmi.PutUI(Tags.MediaStorageSOPClassUID, sopClassUID); fmi.PutUI(Tags.TransferSyntaxUID, m_tsUID); fmi.PutSH(Tags.ImplementationVersionName, "dicomcs-SCU"); ds.SetFileMetaInfo(fmi); ds.PutDA(Tags.StudyDate); ds.PutTM(Tags.StudyTime); ds.PutSH(Tags.AccessionNumber); ds.PutCS(Tags.QueryRetrieveLevel, "STUDY"); ds.PutCS(Tags.ModalitiesInStudy, modalities); ds.PutLO(Tags.InstitutionName); ds.PutPN(Tags.ReferringPhysicianName); ds.PutLO(Tags.StudyDescription); ds.PutPN(Tags.PatientName); ds.PutLO(Tags.PatientID, patid); ds.PutDA(Tags.PatientBirthDate); ds.PutCS(Tags.PatientSex); ds.PutAS(Tags.PatientAge); ds.PutUI(Tags.StudyInstanceUID); PresContext pc = null; Association assoc = active.Association; if ((ds.GetFileMetaInfo() != null) && (ds.GetFileMetaInfo().TransferSyntaxUID != null)) { String tsuid = ds.GetFileMetaInfo().TransferSyntaxUID; if ((pc = assoc.GetAcceptedPresContext(sopClassUID, tsuid)) == null) { log.Error( "SOP class UID not supported" ); return null; } } else if ((pc = assoc.GetAcceptedPresContext(sopClassUID, UIDs.ImplicitVRLittleEndian)) == null && (pc = assoc.GetAcceptedPresContext(sopClassUID, UIDs.ExplicitVRLittleEndian)) == null && (pc = assoc.GetAcceptedPresContext(sopClassUID, UIDs.ExplicitVRBigEndian)) == null) { log.Error( "SOP class UID not supported" ); return null; } Dimse rq = aFact.NewDimse(pcid, oFact.NewCommand().InitCFindRQ(assoc.NextMsgID(), sopClassUID, 0), ds); FutureRSP rsp = active.Invoke(rq); active.Release(true); if (rsp.IsReady()) { ArrayList al = rsp.ListPending(); if (al.Count > 0) { int len = al.Count; ret = new Dataset[len]; for (int i=0;i < len;i++) ret[i] = (Dataset) ((Dimse) al[i]).Dataset; } } } } finally { m_assocRQ.RemovePresContext(pcid); } return ret; }
/// <summary> /// Creates a new instance of DatasetView /// </summary> public FilterDataset(Dataset backend) { this.backend = (BaseDataset) backend; }
//glowna funkcja private void mainOperations(Dataset _ds) { //inicjalizacja double[,] maxDose = new double[1, 2]; //maksymalna dawka i numer wiazki dla tej dawki maxDose[0, 0] = 0; maxDose[0, 1] = 0; double tmpDose = 0; //tymczasowa zmienna przechowujaca ostatnia dawke double[] nominalBeamEnergy; #region wiązki Dataset dsFractionGroupSequence = _ds.GetItem(Tags.FractionGroupSeq, 0); this.numberOfBeams = Convert.ToInt16(dsFractionGroupSequence.GetString(Tags.NumberOfBeams, 0)); //inicjalizacja this.beamDoses = new double[this.numberOfBeams]; this.TPR = new double[this.numberOfBeams]; this.MU = new double[this.numberOfBeams]; this.beamMetersets = new double[this.numberOfBeams]; nominalBeamEnergy = new double[this.numberOfBeams]; DcmElement dcmeReferencedBeamSequence = dsFractionGroupSequence.Get(Tags.RefBeamSeq); string message = "Liczba wiązek: " + numberOfBeams.ToString() + Environment.NewLine; Dataset dsReferencedBeams = null; for (int i = 0; i < numberOfBeams; i++) { dsReferencedBeams = dcmeReferencedBeamSequence.GetItem(i); message += "Wiązka " + (i + 1) + " = " + dsReferencedBeams.GetString(Tags.BeamDose, 0) + Environment.NewLine; tmpDose = Convert.ToDouble(dsReferencedBeams.GetString(Tags.BeamDose, 0).Replace('.', ',')); //wpisanie dawek do tablicy this.beamDoses[i] = tmpDose; //wpisanie MU do tablicy this.beamMetersets[i] = Convert.ToDouble(dsReferencedBeams.GetString(Tags.BeamMeterset, 0).Replace('.', ',')); message += "Zapisane MU = " + this.beamMetersets[i].ToString() + Environment.NewLine; //wyświetlenie //maksymalna dawka if (tmpDose > maxDose[0, 0]) { maxDose[0, 0] = tmpDose; maxDose[0, 1] = i; //numer wiazki } } message += "Maksymalna dawka: " + Math.Round(maxDose[0, 0], 3).ToString() + ", wiązka nr " + maxDose[0, 1].ToString() + Environment.NewLine; #endregion #region listki i nominalna energia wiązek DcmElement dcmeBeamSequence = _ds.Get(Tags.BeamSeq); for (int i = 0; i < this.numberOfBeams; i++) { Dataset dsBeamParams = dcmeBeamSequence.GetItem(i); DcmElement dcmeBeamLimitingDeviceSequence = dsBeamParams.Get(Tags.BeamLimitingDeviceSeq); Dataset dsLeafs = dcmeBeamLimitingDeviceSequence.GetItem(1); //bez zmian //Dataset dsLeafPositionBoundaries = dsLeafs.GetItem(Tags.LeafPositionBoundaries, 0); message += Environment.NewLine + "Listki" + Environment.NewLine; //string[] test = dsLeafs.GetStrings(Tags.LeafPositionBoundaries); message += "Parametry " + i + ": " + dsLeafs.GetString(Tags.LeafPositionBoundaries); //nominal beam energy DcmElement dcmeControlPointSequence = dsBeamParams.Get(Tags.ControlPointSeq); Dataset dsnominalBeamEnergy = dcmeControlPointSequence.GetItem(0); nominalBeamEnergy[i] = Convert.ToDouble(dsnominalBeamEnergy.GetString(Tags.NominalBeamEnergy).Replace('.', ',')); //message += "nominalBeamEnergy: " + nominalBeamEnergy.ToString() + Environment.NewLine; } #endregion #region obliczanie TPR for (int i = 0; i < numberOfBeams; i++) { this.TPR[i] = this.beamDoses[i] / nominalBeamEnergy[i]; } //message += "TPR: " + this.TPR.ToString() + Environment.NewLine; #endregion logTextbox.Text = message; }
private FutureRSP SendDataset(ActiveAssociation active, DcmParser parser, Dataset ds) { String sopInstUID = ds.GetString(Tags.SOPInstanceUID); if (sopInstUID == null) { log.Error( "SOP instance UID is null" ); return null; } String sopClassUID = ds.GetString(Tags.SOPClassUID); if (sopClassUID == null) { log.Error( "SOP class UID is null" ); return null; } PresContext pc = null; Association assoc = active.Association; if (parser != null) { if (parser.DcmDecodeParam.encapsulated) { String tsuid = ds.GetFileMetaInfo().TransferSyntaxUID; if ((pc = assoc.GetAcceptedPresContext(sopClassUID, tsuid)) == null) { log.Error( "SOP class UID not supported" ); return null; } } else if ((pc = assoc.GetAcceptedPresContext(sopClassUID, UIDs.ImplicitVRLittleEndian)) == null && (pc = assoc.GetAcceptedPresContext(sopClassUID, UIDs.ExplicitVRLittleEndian)) == null && (pc = assoc.GetAcceptedPresContext(sopClassUID, UIDs.ExplicitVRBigEndian)) == null) { log.Error( "SOP class UID not supported" ); return null; } return active.Invoke(aFact.NewDimse(pc.pcid(), oFact.NewCommand().InitCStoreRQ(assoc.NextMsgID(), sopClassUID, sopInstUID, 0), new FileDataSource(parser, ds, new byte[2048]))); } else { if ((ds.GetFileMetaInfo() != null) && (ds.GetFileMetaInfo().TransferSyntaxUID != null)) { String tsuid = ds.GetFileMetaInfo().TransferSyntaxUID; if ((pc = assoc.GetAcceptedPresContext(sopClassUID, tsuid)) == null) { log.Error( "SOP class UID not supported" ); return null; } } else if ((pc = assoc.GetAcceptedPresContext(sopClassUID, UIDs.ImplicitVRLittleEndian)) == null && (pc = assoc.GetAcceptedPresContext(sopClassUID, UIDs.ExplicitVRLittleEndian)) == null && (pc = assoc.GetAcceptedPresContext(sopClassUID, UIDs.ExplicitVRBigEndian)) == null) { log.Error( "SOP class UID not supported" ); return null; } return active.Invoke(aFact.NewDimse(pc.pcid(), oFact.NewCommand().InitCStoreRQ(assoc.NextMsgID(), sopClassUID, sopInstUID, 0), ds)); } return null; }
//glowna funkcja private void mainOperations(Dataset _ds) { //inicjalizacja double[,] maxDose = new double[1, 2]; //maksymalna dawka i numer wiazki dla tej dawki maxDose[0, 0] = 0; maxDose[0, 1] = 0; double tmpDose = 0; //tymczasowa zmienna przechowujaca ostatnia dawke double[] nominalBeamEnergy; string[] tmpLeafPostionBoundaries; #region wiązki Dataset dsFractionGroupSequence = _ds.GetItem(Tags.FractionGroupSeq, 0); this.numberOfBeams = Convert.ToInt16(dsFractionGroupSequence.GetString(Tags.NumberOfBeams, 0)); //inicjalizacja this.beamDoses = new double[this.numberOfBeams]; this.TPR = new double[this.numberOfBeams]; this.MU = new double[this.numberOfBeams]; this.beamMetersets = new double[this.numberOfBeams]; nominalBeamEnergy = new double[this.numberOfBeams]; DcmElement dcmeReferencedBeamSequence = dsFractionGroupSequence.Get(Tags.RefBeamSeq); string message = "Liczba wiązek: " + numberOfBeams.ToString() + Environment.NewLine; Dataset dsReferencedBeams = null; for (int i = 0; i < numberOfBeams; i++) { dsReferencedBeams = dcmeReferencedBeamSequence.GetItem(i); message += "Wiązka " + (i + 1) + " = " + dsReferencedBeams.GetString(Tags.BeamDose, 0) + Environment.NewLine; tmpDose = Convert.ToDouble(dsReferencedBeams.GetString(Tags.BeamDose, 0).Replace('.', ',')); //wpisanie dawek do tablicy this.beamDoses[i] = tmpDose; //wpisanie MU do tablicy this.beamMetersets[i] = Convert.ToDouble(dsReferencedBeams.GetString(Tags.BeamMeterset, 0).Replace('.', ',')); message += "Zapisane MU = " + this.beamMetersets[i].ToString() + Environment.NewLine; //wyświetlenie //maksymalna dawka if (tmpDose > maxDose[0, 0]) { maxDose[0, 0] = tmpDose; maxDose[0, 1] = i; //numer wiazki } } message += "Maksymalna dawka: " + Math.Round(maxDose[0, 0], 3).ToString() + ", wiązka nr " + maxDose[0, 1].ToString() + Environment.NewLine; #endregion #region listki i nominalna energia wiązek DcmElement dcmeBeamSequence = _ds.Get(Tags.BeamSeq); for (int i = 0; i < this.numberOfBeams; i++) { Dataset dsBeamParams = dcmeBeamSequence.GetItem(i); DcmElement dcmeBeamLimitingDeviceSequence = dsBeamParams.Get(Tags.BeamLimitingDeviceSeq); Dataset dsLeafs = dcmeBeamLimitingDeviceSequence.GetItem(1); message += Environment.NewLine + "Listki" + Environment.NewLine; //string[] test = dsLeafs.GetStrings(Tags.LeafPositionBoundaries); tmpLeafPostionBoundaries = dsLeafs.GetString(Tags.LeafPositionBoundaries).Split('\\'); //wczytanie wsp x listkow message += "Parametry " + i + ": " + dsLeafs.GetString(Tags.LeafPositionBoundaries); //jesli nie istnieje tablica tworzymy ja lub (jesli istnieje) zmieniamy jej rozmiar, gdy jest za maly/duzy dla nowego pliku if (this.leafPositionBoundaries == null || (this.leafPositionBoundaries.Length / tmpLeafPostionBoundaries.Length) != this.numberOfBeams || (this.leafPositionBoundaries.Length / this.numberOfBeams) < tmpLeafPostionBoundaries.Length) { this.leafPositionBoundaries = new double[this.numberOfBeams, tmpLeafPostionBoundaries.Length]; } for (int j = 0; j < tmpLeafPostionBoundaries.Length; j++) { this.leafPositionBoundaries[i, j] = Convert.ToDouble(tmpLeafPostionBoundaries[j].Replace('.', ',')); } DcmElement dcmeControlPointSequence = dsBeamParams.Get(Tags.ControlPointSeq); Dataset dsControlPointSequence = dcmeControlPointSequence.GetItem(0); #region nominal beam energy nominalBeamEnergy[i] = Convert.ToDouble(dsControlPointSequence.GetString(Tags.NominalBeamEnergy).Replace('.', ',')); message += Environment.NewLine + "nominalBeamEnergy: " + nominalBeamEnergy[i].ToString() + Environment.NewLine; #endregion #region leaf jaw positions DcmElement dcmeBeamLimitingDevicePositionSequence = dsControlPointSequence.Get(Tags.BeamLimitingDevicePositionSeq); //wsp x Dataset dsLeafJawPositionsX = dcmeBeamLimitingDevicePositionSequence.GetItem(1); message += Environment.NewLine + "LeafJawPositions(X): " + dsLeafJawPositionsX.GetString(Tags.LeafJawPositions) + Environment.NewLine; //wsp y Dataset dsLeafJawPositionsY = dcmeBeamLimitingDevicePositionSequence.GetItem(0); message += Environment.NewLine + "LeafJawPositions(Y): " + dsLeafJawPositionsY.GetString(Tags.LeafJawPositions) + Environment.NewLine; #endregion } #endregion #region obliczanie TPR for (int i = 0; i < numberOfBeams; i++) { this.TPR[i] = this.beamDoses[i] / nominalBeamEnergy[i]; } //message += "TPR: " + this.TPR.ToString() + Environment.NewLine; #endregion logTextbox.Text = message; }
public void Load( FileInfo file ) { Stream ins = null; DcmParser parser = null; Dataset ds = null; try { try { ins = new BufferedStream(new FileStream(file.FullName, FileMode.Open, FileAccess.Read)); parser = new DcmParser(ins); FileFormat format = parser.DetectFileFormat(); if (format != null) { ds = new Dataset(); parser.DcmHandler = ds.DcmHandler; parser.ParseDcmFile(format, Tags.PixelData); Console.WriteLine( "success!" ); } else { Console.WriteLine( "failed!" ); } } catch( Exception e) { Console.WriteLine( e.StackTrace ); } } finally { if (ins != null) { try { ins.Close(); } catch (IOException) { } } } }
internal Selection(Dataset backend, Dataset filter) : base(backend) { this.filterDs = filter; }
private String ToFileID(Dataset ds, uint tag) { try { String s = ds.GetString(tag); if (s == null || s.Length == 0) return "__NULL__"; char[] ins = s.ToUpper().ToCharArray(); char[] outs = new char[System.Math.Min(8, ins.Length)]; for (int i = 0; i < outs.Length; ++i) { outs[i] = ins[i] >= '0' && ins[i] <= '9' || ins[i] >= 'A' && ins[i] <= 'Z'?ins[i]:'_'; } return new String(outs); } catch (DcmValueException e) { return "__ERR__"; } }
/// <summary> /// Creates a new instance of ElementImpl /// </summary> public FilterSQElement(SQElement sqElem, Dataset filter) : base(sqElem.tag()) { this.sqElem = sqElem; this.filter = filter; }
private FileInfo toFile(Dataset ds) { String studyInstUID = null; try { studyInstUID = ds.GetString(Tags.StudyInstanceUID); if (studyInstUID == null) { throw new DcmServiceException(MISSING_UID, "Missing Study Instance UID"); } if (ds.vm(Tags.SeriesInstanceUID) <= 0) { throw new DcmServiceException(MISSING_UID, "Missing Series Instance UID"); } String instUID = ds.GetString(Tags.SOPInstanceUID); if (instUID == null) { throw new DcmServiceException(MISSING_UID, "Missing SOP Instance UID"); } String classUID = ds.GetString(Tags.SOPClassUID); if (classUID == null) { throw new DcmServiceException(MISSING_UID, "Missing SOP Class UID"); } if (!instUID.Equals(ds.GetFileMetaInfo().MediaStorageSOPInstanceUID)) { throw new DcmServiceException(MISMATCH_UID, "SOP Instance UID in Dataset differs from Affected SOP Instance UID"); } if (!classUID.Equals(ds.GetFileMetaInfo().MediaStorageSOPClassUID)) { throw new DcmServiceException(MISMATCH_UID, "SOP Class UID in Dataset differs from Affected SOP Class UID"); } } catch (DcmValueException e) { throw new DcmServiceException(CANNOT_UNDERSTAND, e); } String pn = ToFileID(ds, Tags.PatientName) + "____"; FileInfo dir = archiveDir; for (int i = 0; i < dirSplitLevel; ++i) { dir = new FileInfo(dir.FullName + "\\" + pn.Substring(0, (i + 1) - (0))); } dir = new FileInfo(dir.FullName + "\\" + studyInstUID); dir = new FileInfo(dir.FullName + "\\" + ToFileID(ds, Tags.SeriesNumber)); FileInfo file = new FileInfo(dir.FullName + "\\" + ToFileID(ds, Tags.InstanceNumber) + ".dcm"); return file; }
private void storeToFile(DcmParser parser, Dataset ds, FileInfo file, DcmEncodeParam encParam) { Stream outs = openOutputStream(file); try { ds.WriteFile(outs, encParam); if (parser.ReadTag == Tags.PixelData) { ds.WriteHeader(outs, encParam, parser.ReadTag, parser.ReadVR, parser.ReadLength); copy(parser.InputStream, outs); } } finally { try { outs.Close(); } catch (IOException ignore) { } } }
public virtual void AddItem(Dataset item) { throw new NotSupportedException(this.ToString()); }
/// <summary> /// Send C-STORE /// </summary> /// <param name="ds"></param> public bool CStore( Dataset ds ) { int pcid = PCID_START; PCID_START += 2; try { // // Prepare association // String classUID = ds.GetString( Tags.SOPClassUID); String tsUID = ds.GetString(Tags.TransferSyntaxUID); if( (tsUID == null || tsUID.Equals( "" )) && (ds.GetFileMetaInfo() != null) ) tsUID = ds.GetFileMetaInfo().GetString(Tags.TransferSyntaxUID); if( tsUID == null || tsUID.Equals( "" ) ) tsUID = UIDs.ImplicitVRLittleEndian; m_assocRQ.AddPresContext(aFact.NewPresContext(pcid, classUID, new String[]{ tsUID } )); ActiveAssociation active = OpenAssoc(); if (active != null) { bool bResponse = false; FutureRSP frsp = SendDataset(active, null, ds); if (frsp != null) { active.WaitOnRSP(); bResponse = true; } active.Release(true); return bResponse; } } finally { m_assocRQ.RemovePresContext(pcid); } return false; }
public virtual Dimse NewDimse(int pcid, Command cmd, Dataset ds) { return new Dimse(pcid, cmd, ds, null); }
/// <summary> /// Perform a WADO-GET /// </summary> public Dataset WADOGet(string url, string studyInstanceUID, string seriesInstanceUID, string sopInstanceUID) { if ((studyInstanceUID != null) && (seriesInstanceUID == null) || (sopInstanceUID == null)) { if (seriesInstanceUID == null) { Dataset[] ds = CFindSeries(studyInstanceUID, null); if ((ds != null) && (ds.Length == 1)) { seriesInstanceUID = ds[0].GetString(Tags.SeriesInstanceUID); } } if (seriesInstanceUID != null) { Dataset[] ds = CFindInstance(seriesInstanceUID); if ((ds != null) && (ds.Length == 1)) { sopInstanceUID = ds[0].GetString(Tags.SOPInstanceUID); } } } if ((url == null) || (studyInstanceUID == null) || (seriesInstanceUID == null) || (sopInstanceUID == null) || (url.IndexOf('?') >= 0)) return null; Dataset ret = null; System.Net.WebResponse response = null; try { StringBuilder sb = new StringBuilder(url); sb.Append("?requestType=WADO&studyUID="); sb.Append(System.Web.HttpUtility.UrlEncode(studyInstanceUID)); sb.Append("&seriesUID="); sb.Append(System.Web.HttpUtility.UrlEncode(seriesInstanceUID)); sb.Append("&objectUID="); sb.Append(System.Web.HttpUtility.UrlEncode(sopInstanceUID)); System.Net.WebRequest request = System.Net.WebRequest.Create(sb.ToString()); response = request.GetResponse(); if (string.Compare(response.ContentType, "application/dicom") == 0) { DcmParser parser = new DcmParser(response.GetResponseStream()); FileFormat format = parser.DetectFileFormat(); if (format != null) { ret = new Dataset(); parser.DcmHandler = ret.DcmHandler; parser.ParseDcmFile(format, Tags.PixelData); } } } finally { if (response != null) response.Close(); } return ret; }
public Dataset(Dataset parent) { this.parent = parent; }
public FileDataSource(DcmParser parser, Dataset ds, byte[] buffer) { this.parser = parser; this.ds = ds; this.buffer = buffer; }
internal Segment(Dataset backend, uint fromTag, uint toTag) : base(backend) { this.fromTag = fromTag & 0xFFFFFFFFL; this.toTag = toTag & 0xFFFFFFFFL; if (this.fromTag > this.toTag) { throw new System.ArgumentException("fromTag:" + Tags.toString(fromTag) + " greater toTag:" + Tags.toString(toTag)); } }
//glowna funkcja private void mainOperations(Dataset _ds) { //inicjalizacja double[,] maxDose = new double[1, 2]; //maksymalna dawka i numer wiazki dla tej dawki maxDose[0, 0] = 0; maxDose[0, 1] = 0; double tmpDose = 0; //tymczasowa zmienna przechowujaca ostatnia dawke string[] tmpLeafPostionBoundariesOrJaws; Dataset dsFractionGroupSequence = _ds.GetItem(Tags.FractionGroupSeq, 0); if (dsFractionGroupSequence != null) { try { #region wiązki this.numberOfBeams = Convert.ToInt16(dsFractionGroupSequence.GetString(Tags.NumberOfBeams, 0)); this.numberOfFractions = Convert.ToInt16(dsFractionGroupSequence.GetString(Tags.NumberOfFractionsPlanned, 0)); //inicjalizacja this.beamDoses = new double[this.numberOfBeams]; this.TPR = new double[this.numberOfBeams]; this.MU = new double[this.numberOfBeams]; this.SSD = new double[this.numberOfBeams]; this.SSDDepth = new double[this.numberOfBeams]; this.radDepth = new double[this.numberOfBeams]; this.beamMetersets = new double[this.numberOfBeams]; this.nominalBeamEnergy = new double[this.numberOfBeams]; DcmElement dcmeReferencedBeamSequence = dsFractionGroupSequence.Get(Tags.RefBeamSeq); string message = "Liczba wiązek: " + numberOfBeams.ToString() + Environment.NewLine; message += "Frakcje: " + this.numberOfFractions + Environment.NewLine; Dataset dsReferencedBeams = null; for (int i = 0; i < numberOfBeams; i++) { dsReferencedBeams = dcmeReferencedBeamSequence.GetItem(i); tmpDose = Convert.ToDouble(dsReferencedBeams.GetString(Tags.BeamDose, 0).Replace('.', ',')) * 100; //zamiana dawki na cGy message += "Wiązka " + (i + 1) + " = " + Math.Round(tmpDose, 2).ToString() + " cGy" + Environment.NewLine; //wpisanie dawek do tablicy this.beamDoses[i] = tmpDose; //wpisanie MU do tablicy this.beamMetersets[i] = Convert.ToDouble(dsReferencedBeams.GetString(Tags.BeamMeterset, 0).Replace('.', ',')); message += "Zapisane MU = " + Math.Round(this.beamMetersets[i], 2).ToString() + Environment.NewLine; //wyświetlenie //maksymalna dawka if (tmpDose > maxDose[0, 0]) { maxDose[0, 0] = tmpDose; maxDose[0, 1] = i; //numer wiazki } } message += "Maksymalna dawka: " + Math.Round(maxDose[0, 0], 3).ToString() + ", wiązka nr " + maxDose[0, 1].ToString() + Environment.NewLine; #endregion #region listki, nominalna energia wiązek i SSD DcmElement dcmeBeamSequence = _ds.Get(Tags.BeamSeq); for (int i = 0; i < this.numberOfBeams; i++) { Dataset dsBeamParams = dcmeBeamSequence.GetItem(i); DcmElement dcmeBeamLimitingDeviceSequence = dsBeamParams.Get(Tags.BeamLimitingDeviceSeq); Dataset dsLeafs = dcmeBeamLimitingDeviceSequence.GetItem(1); message += Environment.NewLine + "Listki" + Environment.NewLine; //string[] test = dsLeafs.GetStrings(Tags.LeafPositionBoundaries); tmpLeafPostionBoundariesOrJaws = dsLeafs.GetString(Tags.LeafPositionBoundaries).Split('\\'); //wczytanie wsp x listkow message += "Parametry " + i + ": " + dsLeafs.GetString(Tags.LeafPositionBoundaries); //jesli nie istnieje tablica tworzymy ja lub (jesli istnieje) zmieniamy jej rozmiar, gdy jest za maly/duzy dla nowego pliku //GetUpperBound(poziom) - indeks ostatniego el na danym poziomie tablicy if (this.leafPositionBoundaries == null || (this.leafPositionBoundaries.GetUpperBound(0) + 1) != this.numberOfBeams || (this.leafPositionBoundaries.GetUpperBound(1) + 1) != tmpLeafPostionBoundariesOrJaws.Length) { this.leafPositionBoundaries = new double[this.numberOfBeams, tmpLeafPostionBoundariesOrJaws.Length]; } for (int j = 0; j < tmpLeafPostionBoundariesOrJaws.Length; j++) { this.leafPositionBoundaries[i, j] = Convert.ToDouble(tmpLeafPostionBoundariesOrJaws[j].Replace('.', ',')); } DcmElement dcmeControlPointSequence = dsBeamParams.Get(Tags.ControlPointSeq); Dataset dsControlPointSequence = dcmeControlPointSequence.GetItem(0); #region nominal beam energy nominalBeamEnergy[i] = Convert.ToDouble(dsControlPointSequence.GetString(Tags.NominalBeamEnergy).Replace('.', ',')); message += Environment.NewLine + "nominalBeamEnergy: " + nominalBeamEnergy[i].ToString() + Environment.NewLine; #endregion #region leaf jaw positions DcmElement dcmeBeamLimitingDevicePositionSequence = dsControlPointSequence.Get(Tags.BeamLimitingDevicePositionSeq); //wsp x Dataset dsLeafJawPositionsX = dcmeBeamLimitingDevicePositionSequence.GetItem(1); message += Environment.NewLine + "LeafJawPositions(X): " + dsLeafJawPositionsX.GetString(Tags.LeafJawPositions) + Environment.NewLine; #region zapisanie do tablicy tmpLeafPostionBoundariesOrJaws = dsLeafJawPositionsX.GetString(Tags.LeafJawPositions).Split('\\'); //tymczasowa tablica //jesli nie istnieje tablica tworzymy ja lub (jesli istnieje) zmieniamy jej rozmiar, gdy jest za maly/duzy dla nowego pliku if (this.leafJawPositionsX == null || (this.leafJawPositionsX.GetUpperBound(0) + 1) != this.numberOfBeams || (this.leafJawPositionsX.GetUpperBound(1) + 1) != tmpLeafPostionBoundariesOrJaws.Length) { this.leafJawPositionsX = new double[this.numberOfBeams, tmpLeafPostionBoundariesOrJaws.Length]; } for (int j = 0; j < tmpLeafPostionBoundariesOrJaws.Length; j++) { this.leafJawPositionsX[i, j] = Convert.ToDouble(tmpLeafPostionBoundariesOrJaws[j].Replace('.', ',')); } #endregion //wsp y Dataset dsLeafJawPositionsY = dcmeBeamLimitingDevicePositionSequence.GetItem(0); message += Environment.NewLine + "LeafJawPositions(Y): " + dsLeafJawPositionsY.GetString(Tags.LeafJawPositions) + Environment.NewLine; #region zapisanie do tablicy tmpLeafPostionBoundariesOrJaws = dsLeafJawPositionsY.GetString(Tags.LeafJawPositions).Split('\\'); //tymczasowa tablica //jesli nie istnieje tablica tworzymy ja lub (jesli istnieje) zmieniamy jej rozmiar, gdy jest za maly/duzy dla nowego pliku if (this.leafJawPositionsY == null || (this.leafJawPositionsY.GetUpperBound(0) + 1) != this.numberOfBeams || (this.leafJawPositionsY.GetUpperBound(1) + 1) != tmpLeafPostionBoundariesOrJaws.Length) { this.leafJawPositionsY = new double[this.numberOfBeams, tmpLeafPostionBoundariesOrJaws.Length]; } for (int j = 0; j < tmpLeafPostionBoundariesOrJaws.Length; j++) { this.leafJawPositionsY[i, j] = Convert.ToDouble(tmpLeafPostionBoundariesOrJaws[j].Replace('.', ',')); } #endregion #endregion #region SSD i glebokosc izocentrum Dataset dsSourceAxisDistance = dcmeBeamSequence.GetItem(i); SSD[i] = Convert.ToDouble(dsControlPointSequence.GetString(Tags.SourceToSurfaceDistance).Replace('.', ',')) / 10; SSDDepth[i] = (Convert.ToDouble(dsSourceAxisDistance.GetString(Tags.SourceAxisDistance).Replace('.', ',')) / 10) - SSD[i]; message += Environment.NewLine + "SSD(cm): " + SSD[i].ToString() + Environment.NewLine; message += "Głębokość izocentrum(cm): " + SSDDepth[i].ToString() + Environment.NewLine; #endregion } #endregion this.properRTPlanLoaded = true; logTextbox.Text = message; } catch (NullReferenceException) //wyłapywanie braku którychś danych { MessageBox.Show("Ten plik nie zawiera wszystkich potrzebnych do obliczeń danych!" + Environment.NewLine + "Spróbuj załadować prawidłowy plik!", "Błąd", MessageBoxButtons.OK, MessageBoxIcon.Error); this.properRTPlanLoaded = false; } #region wczytywanie parametrow z plikow DOSE //inicjalizacja bool[] doseLoaded = new bool[this.numberOfBeams]; if (MessageBox.Show("Czy chcesz załadować pliki RT Dose?", "Ładowanie RT Dose", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { #region automatyczne wczytywanie plikow DOSE string RTPlanPath = Path.GetDirectoryName(fileNameTextbox.Text); IEnumerable<string> RTPlanDirDoseFiles = Directory.EnumerateFiles(RTPlanPath, "RD*.dcm"); int j = 0; foreach (string doseFileName in RTPlanDirDoseFiles) { DOSELoad doseload = this.doseFileLoad(doseFileName); List<List<string>> doseData = doseload.beamData(); if (doseload.success) { if (doseData[1].Count > 0) //sprawdzenie, czy potrzebne dane sa w pliku { this.SSD[doseload.beamNumber - 1] = Convert.ToDouble(doseData[1][3].Replace('.', ',')) / 10; this.SSDDepth[doseload.beamNumber - 1] = Convert.ToDouble(doseData[1][4].Replace('.', ',')) / 10; this.radDepth[doseload.beamNumber - 1] = Convert.ToDouble(doseData[1][5].Replace('.', ',')) / 10; doseLoaded[j] = true; } else { j--; //zmniejszenie licznika aby zaladowac wlasciwy plik dla kazdej wiazki } } else { doseLoaded[j] = false; } j++; } if (j > 0) { MessageBox.Show("Załadowano " + j.ToString() + " plików RT Dose", "Pliki RT Dose", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { MessageBox.Show("Nie znaleziono w katalogu RT Planu plików RT Dose", "Pliki RT Dose", MessageBoxButtons.OK, MessageBoxIcon.Information); } #endregion } else { MessageBox.Show("W związku z niewybraniem plików RT Dose niektóre wyniki mogą być nieprecyzyjne!", "Ostrzeżenie", MessageBoxButtons.OK, MessageBoxIcon.Warning); } #endregion #region automatyczne ladowanie tabeli wydajnosci i pdg dla danego aparatu bool properLoadWyd = false; bool properLoadPDG = false; if (nominalBeamEnergy[0].ToString() == "6") { properLoadWyd = this.loadTables(ref this.tlWyd, defaultTablePath6 + "wyd.dat"); properLoadPDG = this.loadTables(ref this.tlPDG, defaultTablePath6 + "pdg.dat"); } else if (nominalBeamEnergy[0].ToString() == "15") { properLoadWyd = this.loadTables(ref this.tlWyd, defaultTablePath15 + "wyd.dat"); properLoadPDG = this.loadTables(ref this.tlPDG, defaultTablePath15 + "pdg.dat"); } if (properLoadWyd && properLoadPDG) { MessageBox.Show("Pomyślnie załadowano pliki tabel wydajności i pdg!", "Sukces", MessageBoxButtons.OK, MessageBoxIcon.Information); } else if (properLoadWyd) { MessageBox.Show("Pomyślnie załadowano plik tabeli wydajności!", "Sukces", MessageBoxButtons.OK, MessageBoxIcon.Information); MessageBox.Show("Błąd ładowania pliku tabeli pdg!", "Błąd", MessageBoxButtons.OK, MessageBoxIcon.Error); } else if (properLoadPDG) { MessageBox.Show("Pomyślnie załadowano plik tabeli pdg!", "Sukces", MessageBoxButtons.OK, MessageBoxIcon.Information); MessageBox.Show("Błąd ładowania pliku tabeli wydajności!", "Błąd", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { MessageBox.Show("Błąd ładowania plików tabel wydajności i pdg!", "Błąd", MessageBoxButtons.OK, MessageBoxIcon.Error); } #endregion } else //w przypadku, gdy nie jest to RT Plan { MessageBox.Show("Ten plik nie zawiera potrzebnych danych!" + Environment.NewLine + "Najprawdopodobniej nie jest to RTPlan - spróbuj załadować prawidłowy plik!", "Błąd", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
/// <summary> /// Creates a new instance of ElementImpl /// </summary> public SQElement(uint tag, Dataset parent) : base(tag) { this.parent = parent; }
//glowna funkcja private void mainOperations(Dataset _ds) { //inicjalizacja double[,] maxDose = new double[1, 2]; //maksymalna dawka i numer wiazki dla tej dawki maxDose[0, 0] = 0; maxDose[0, 1] = 0; double tmpDose = 0; //tymczasowa zmienna przechowujaca ostatnia dawke string[] tmpLeafPostionBoundariesOrJaws; #region wiązki Dataset dsFractionGroupSequence = _ds.GetItem(Tags.FractionGroupSeq, 0); this.numberOfBeams = Convert.ToInt16(dsFractionGroupSequence.GetString(Tags.NumberOfBeams, 0)); //inicjalizacja this.beamDoses = new double[this.numberOfBeams]; this.TPR = new double[this.numberOfBeams]; this.MU = new double[this.numberOfBeams]; this.SSD = new double[this.numberOfBeams]; this.SSDDepth = new double[this.numberOfBeams]; this.beamMetersets = new double[this.numberOfBeams]; this.nominalBeamEnergy = new double[this.numberOfBeams]; DcmElement dcmeReferencedBeamSequence = dsFractionGroupSequence.Get(Tags.RefBeamSeq); string message = "Liczba wiązek: " + numberOfBeams.ToString() + Environment.NewLine; Dataset dsReferencedBeams = null; for (int i = 0; i < numberOfBeams; i++) { dsReferencedBeams = dcmeReferencedBeamSequence.GetItem(i); tmpDose = Convert.ToDouble(dsReferencedBeams.GetString(Tags.BeamDose, 0).Replace('.', ',')) * 100; //aut zamiana dawki na cGy message += "Wiązka " + (i + 1) + " = " + Math.Round(tmpDose, 2).ToString() + " cGy" + Environment.NewLine; //wpisanie dawek do tablicy this.beamDoses[i] = tmpDose; //wpisanie MU do tablicy this.beamMetersets[i] = Convert.ToDouble(dsReferencedBeams.GetString(Tags.BeamMeterset, 0).Replace('.', ',')); message += "Zapisane MU = " + Math.Round(this.beamMetersets[i], 2).ToString() + Environment.NewLine; //wyświetlenie //maksymalna dawka if (tmpDose > maxDose[0, 0]) { maxDose[0, 0] = tmpDose; maxDose[0, 1] = i; //numer wiazki } } message += "Maksymalna dawka: " + Math.Round(maxDose[0, 0], 3).ToString() + ", wiązka nr " + maxDose[0, 1].ToString() + Environment.NewLine; #endregion #region listki, nominalna energia wiązek i SSD DcmElement dcmeBeamSequence = _ds.Get(Tags.BeamSeq); for (int i = 0; i < this.numberOfBeams; i++) { Dataset dsBeamParams = dcmeBeamSequence.GetItem(i); DcmElement dcmeBeamLimitingDeviceSequence = dsBeamParams.Get(Tags.BeamLimitingDeviceSeq); Dataset dsLeafs = dcmeBeamLimitingDeviceSequence.GetItem(1); message += Environment.NewLine + "Listki" + Environment.NewLine; //string[] test = dsLeafs.GetStrings(Tags.LeafPositionBoundaries); tmpLeafPostionBoundariesOrJaws = dsLeafs.GetString(Tags.LeafPositionBoundaries).Split('\\'); //wczytanie wsp x listkow message += "Parametry " + i + ": " + dsLeafs.GetString(Tags.LeafPositionBoundaries); //jesli nie istnieje tablica tworzymy ja lub (jesli istnieje) zmieniamy jej rozmiar, gdy jest za maly/duzy dla nowego pliku if (this.leafPositionBoundaries == null || (this.leafPositionBoundaries.Length / tmpLeafPostionBoundariesOrJaws.Length) != this.numberOfBeams || (this.leafPositionBoundaries.Length / this.numberOfBeams) < tmpLeafPostionBoundariesOrJaws.Length) { this.leafPositionBoundaries = new double[this.numberOfBeams, tmpLeafPostionBoundariesOrJaws.Length]; } for (int j = 0; j < tmpLeafPostionBoundariesOrJaws.Length; j++) { this.leafPositionBoundaries[i, j] = Convert.ToDouble(tmpLeafPostionBoundariesOrJaws[j].Replace('.', ',')); } DcmElement dcmeControlPointSequence = dsBeamParams.Get(Tags.ControlPointSeq); Dataset dsControlPointSequence = dcmeControlPointSequence.GetItem(0); #region nominal beam energy nominalBeamEnergy[i] = Convert.ToDouble(dsControlPointSequence.GetString(Tags.NominalBeamEnergy).Replace('.', ',')); message += Environment.NewLine + "nominalBeamEnergy: " + nominalBeamEnergy[i].ToString() + Environment.NewLine; #endregion #region leaf jaw positions DcmElement dcmeBeamLimitingDevicePositionSequence = dsControlPointSequence.Get(Tags.BeamLimitingDevicePositionSeq); //wsp x Dataset dsLeafJawPositionsX = dcmeBeamLimitingDevicePositionSequence.GetItem(1); message += Environment.NewLine + "LeafJawPositions(X): " + dsLeafJawPositionsX.GetString(Tags.LeafJawPositions) + Environment.NewLine; #region zapisanie do tablicy tmpLeafPostionBoundariesOrJaws = dsLeafJawPositionsX.GetString(Tags.LeafJawPositions).Split('\\'); //tymczasowa tablica //jesli nie istnieje tablica tworzymy ja lub (jesli istnieje) zmieniamy jej rozmiar, gdy jest za maly/duzy dla nowego pliku if (this.leafJawPositionsX == null || (this.leafJawPositionsX.Length / tmpLeafPostionBoundariesOrJaws.Length) != this.numberOfBeams || (this.leafJawPositionsX.Length / this.numberOfBeams) < tmpLeafPostionBoundariesOrJaws.Length) { this.leafJawPositionsX = new double[this.numberOfBeams, tmpLeafPostionBoundariesOrJaws.Length]; } for (int j = 0; j < tmpLeafPostionBoundariesOrJaws.Length; j++) { this.leafJawPositionsX[i, j] = Convert.ToDouble(tmpLeafPostionBoundariesOrJaws[j].Replace('.', ',')); } #endregion //wsp y Dataset dsLeafJawPositionsY = dcmeBeamLimitingDevicePositionSequence.GetItem(0); message += Environment.NewLine + "LeafJawPositions(Y): " + dsLeafJawPositionsY.GetString(Tags.LeafJawPositions) + Environment.NewLine; #region zapisanie do tablicy tmpLeafPostionBoundariesOrJaws = dsLeafJawPositionsY.GetString(Tags.LeafJawPositions).Split('\\'); //tymczasowa tablica //jesli nie istnieje tablica tworzymy ja lub (jesli istnieje) zmieniamy jej rozmiar, gdy jest za maly/duzy dla nowego pliku if (this.leafJawPositionsY == null || (this.leafJawPositionsY.Length / tmpLeafPostionBoundariesOrJaws.Length) != this.numberOfBeams || (this.leafJawPositionsY.Length / this.numberOfBeams) < tmpLeafPostionBoundariesOrJaws.Length) { this.leafJawPositionsY = new double[this.numberOfBeams, tmpLeafPostionBoundariesOrJaws.Length]; } for (int j = 0; j < tmpLeafPostionBoundariesOrJaws.Length; j++) { this.leafJawPositionsY[i, j] = Convert.ToDouble(tmpLeafPostionBoundariesOrJaws[j].Replace('.', ',')); } #endregion #endregion #region SSD i glebokosc izocentrum Dataset dsSourceAxisDistance = dcmeBeamSequence.GetItem(i); SSD[i] = Convert.ToDouble(dsControlPointSequence.GetString(Tags.SourceToSurfaceDistance).Replace('.', ',')) / 10; SSDDepth[i] = (Convert.ToDouble(dsSourceAxisDistance.GetString(Tags.SourceAxisDistance).Replace('.', ',')) / 10) - SSD[i]; message += Environment.NewLine + "SSD(cm): " + SSD[i].ToString() + Environment.NewLine; message += "Głębokość izocentrum(cm): " + SSDDepth[i].ToString() + Environment.NewLine; #endregion } #endregion #region automatyczne ladowanie tabeli wydajnosci i pdg dla danego aparatu bool properLoadWyd = false; bool properLoadPDG = false; if (nominalBeamEnergy[0].ToString() == "6") { properLoadWyd = this.loadTables(ref this.tlWyd, defaultTablePath6 + "wyd.dat"); properLoadPDG = this.loadTables(ref this.tlPDG, defaultTablePath6 + "pdg.dat"); } else if (nominalBeamEnergy[0].ToString() == "15") { properLoadWyd = this.loadTables(ref this.tlWyd, defaultTablePath15 + "wyd.dat"); properLoadPDG = this.loadTables(ref this.tlPDG, defaultTablePath15 + "pdg.dat"); } if (properLoadWyd && properLoadPDG) { MessageBox.Show("Pomyślnie załadowano pliki tabel wydajności i pdg!", "Sukces", MessageBoxButtons.OK, MessageBoxIcon.Information); } else if (properLoadWyd) { MessageBox.Show("Pomyślnie załadowano plik tabeli wydajności!", "Sukces", MessageBoxButtons.OK, MessageBoxIcon.Information); MessageBox.Show("Błąd ładowania pliku tabeli pdg!", "Błąd", MessageBoxButtons.OK, MessageBoxIcon.Error); } else if (properLoadPDG) { MessageBox.Show("Pomyślnie załadowano plik tabeli pdg!", "Sukces", MessageBoxButtons.OK, MessageBoxIcon.Information); MessageBox.Show("Błąd ładowania pliku tabeli wydajności!", "Błąd", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { MessageBox.Show("Błąd ładowania plików tabel wydajności i pdg!", "Błąd", MessageBoxButtons.OK, MessageBoxIcon.Error); } #endregion logTextbox.Text = message; }
public override void AddItem(Dataset item) { m_list.Add(item); }
public virtual FileMetaInfo NewFileMetaInfo(Dataset ds, System.String transferSyntaxUID) { try { return new FileMetaInfo().Init(ds.GetString(Tags.SOPClassUID, null), ds.GetString(Tags.SOPInstanceUID, null), transferSyntaxUID, Implementation.ClassUID, Implementation.VersionName); } catch (DcmValueException ex) { throw new System.ArgumentException(ex.Message); } }
public override Dataset AddNewItem() { Dataset item = new Dataset(parent); m_list.Add(item); return item; }