/// <summary> /// Called by the framework when the user clicks the "apply" menu item or toolbar button. /// </summary> public void SeriesQuery() { string callingAE = ServerTree.GetClientAETitle(); List<SeriesItem> SeriesList = new List<SeriesItem>(); #region remote datastore // If remote data store, need to query server for series level information if (!this.Context.SelectedServerGroup.IsLocalDatastore) { // Loop through all selected servers foreach (Server node in this.Context.SelectedServerGroup.Servers) { DicomAttributeCollection dicomAttributeCollection = new DicomAttributeCollection(); // Query on "Series" Level dicomAttributeCollection[DicomTags.QueryRetrieveLevel].SetStringValue("SERIES"); string studyUID = this.Context.SelectedStudies[0].StudyInstanceUid; dicomAttributeCollection[DicomTags.StudyInstanceUid].SetStringValue(studyUID); dicomAttributeCollection[DicomTags.SeriesDescription].SetNullValue(); dicomAttributeCollection[DicomTags.SeriesInstanceUid].SetNullValue(); dicomAttributeCollection[DicomTags.SeriesNumber].SetNullValue(); dicomAttributeCollection[DicomTags.Modality].SetNullValue(); dicomAttributeCollection[DicomTags.Date].SetNullValue(); dicomAttributeCollection[DicomTags.Time].SetNullValue(); dicomAttributeCollection[DicomTags.RepetitionTime].SetNullValue(); IList<DicomAttributeCollection> resultsList; StudyRootFindScu findScu = new StudyRootFindScu(); List<string> seriesUIDs = new List<string>(); resultsList = findScu.Find( callingAE, node.AETitle, node.Host, node.Port, dicomAttributeCollection); findScu.CloseAssociation(); findScu.Dispose(); foreach (DicomAttributeCollection msg in resultsList) { string text = msg[DicomTags.SeriesInstanceUid]; Platform.Log(LogLevel.Info, text); SeriesItem series = new SeriesItem(); series.SeriesNumber = msg[DicomTags.SeriesNumber]; series.SeriesDescription = msg[DicomTags.SeriesDescription]; series.StudyInstanceUID = msg[DicomTags.StudyInstanceUid]; series.SeriesInstanceUID = msg[DicomTags.SeriesInstanceUid]; series.Modality = msg[DicomTags.Modality]; series.Date = msg[DicomTags.Date]; series.Time = msg[DicomTags.Time]; //series.NumberOfSeriesRelatedInstances = int.Parse(msg[DicomTags.NumberOfSeriesRelatedInstances].ToString()); SeriesList.Add(series); } _component = new SeriesBrowserComponent(SeriesList, node); _shelf = ApplicationComponent.LaunchAsShelf(this.Context.DesktopWindow, _component, "Series Browser", ShelfDisplayHint.DockBottom | ShelfDisplayHint.DockAutoHide); _shelf.Closed += Shelf_Closed; } } #endregion #region Local Datastore // If local datastore, can obtain series information by building study tree else { IImageViewer viewer = new ImageViewerComponent(); StudyTree studyTree = viewer.StudyTree; // Add selected objects studies to study tree foreach (StudyItem selectedstudy in this.Context.SelectedStudies) { string studyUID = selectedstudy.StudyInstanceUid; int numberOfSops = LocalStudyLoader.Start(new StudyLoaderArgs(studyUID, null)); for (int i = 0; i < numberOfSops; ++i) { Sop imageSop = LocalStudyLoader.LoadNextSop(); studyTree.AddSop(imageSop); } } foreach (Patient patient in studyTree.Patients) { foreach (Study study in patient.Studies) { foreach (Series series in study.Series) { SeriesItem seriesitem = new SeriesItem(); seriesitem.SeriesNumber = series.SeriesNumber.ToString(); seriesitem.SeriesDescription = series.SeriesDescription; seriesitem.StudyInstanceUID = study.StudyInstanceUid; seriesitem.SeriesInstanceUID = series.SeriesInstanceUid; seriesitem.Modality = series.Modality; seriesitem.Date = series.SeriesDate; seriesitem.Time = series.SeriesTime; //series.NumberOfSeriesRelatedInstances = int.Parse(msg[DicomTags.NumberOfSeriesRelatedInstances].ToString()); seriesitem.NumberOfSeriesRelatedInstances = series.Sops.Count.ToString(); SeriesList.Add(seriesitem); } _component = new SeriesBrowserComponent(SeriesList, null); _shelf = ApplicationComponent.LaunchAsShelf(this.Context.DesktopWindow, _component, DicomDataFormatHelper.PersonNameFormatter(patient.PatientsName), ShelfDisplayHint.DockBottom | ShelfDisplayHint.DockAutoHide); _shelf.Closed += Shelf_Closed; } } } #endregion }
/// <summary> /// Called by the framework when the user clicks the "apply" menu item or toolbar button. /// </summary> public void SeriesQuery() { string callingAE = ServerTree.GetClientAETitle(); List <SeriesItem> SeriesList = new List <SeriesItem>(); #region remote datastore // If remote data store, need to query server for series level information if (!this.Context.SelectedServerGroup.IsLocalDatastore) { // Loop through all selected servers foreach (Server node in this.Context.SelectedServerGroup.Servers) { DicomAttributeCollection dicomAttributeCollection = new DicomAttributeCollection(); // Query on "Series" Level dicomAttributeCollection[DicomTags.QueryRetrieveLevel].SetStringValue("SERIES"); string studyUID = this.Context.SelectedStudies[0].StudyInstanceUid; dicomAttributeCollection[DicomTags.StudyInstanceUid].SetStringValue(studyUID); dicomAttributeCollection[DicomTags.SeriesDescription].SetNullValue(); dicomAttributeCollection[DicomTags.SeriesInstanceUid].SetNullValue(); dicomAttributeCollection[DicomTags.SeriesNumber].SetNullValue(); dicomAttributeCollection[DicomTags.Modality].SetNullValue(); dicomAttributeCollection[DicomTags.Date].SetNullValue(); dicomAttributeCollection[DicomTags.Time].SetNullValue(); dicomAttributeCollection[DicomTags.RepetitionTime].SetNullValue(); IList <DicomAttributeCollection> resultsList; StudyRootFindScu findScu = new StudyRootFindScu(); List <string> seriesUIDs = new List <string>(); resultsList = findScu.Find( callingAE, node.AETitle, node.Host, node.Port, dicomAttributeCollection); findScu.CloseAssociation(); findScu.Dispose(); foreach (DicomAttributeCollection msg in resultsList) { string text = msg[DicomTags.SeriesInstanceUid]; Platform.Log(LogLevel.Info, text); SeriesItem series = new SeriesItem(); series.SeriesNumber = msg[DicomTags.SeriesNumber]; series.SeriesDescription = msg[DicomTags.SeriesDescription]; series.StudyInstanceUID = msg[DicomTags.StudyInstanceUid]; series.SeriesInstanceUID = msg[DicomTags.SeriesInstanceUid]; series.Modality = msg[DicomTags.Modality]; series.Date = msg[DicomTags.Date]; series.Time = msg[DicomTags.Time]; //series.NumberOfSeriesRelatedInstances = int.Parse(msg[DicomTags.NumberOfSeriesRelatedInstances].ToString()); SeriesList.Add(series); } _component = new SeriesBrowserComponent(SeriesList, node); _shelf = ApplicationComponent.LaunchAsShelf(this.Context.DesktopWindow, _component, "Series Browser", ShelfDisplayHint.DockBottom | ShelfDisplayHint.DockAutoHide); _shelf.Closed += Shelf_Closed; } } #endregion #region Local Datastore // If local datastore, can obtain series information by building study tree else { IImageViewer viewer = new ImageViewerComponent(); StudyTree studyTree = viewer.StudyTree; // Add selected objects studies to study tree foreach (StudyItem selectedstudy in this.Context.SelectedStudies) { string studyUID = selectedstudy.StudyInstanceUid; int numberOfSops = LocalStudyLoader.Start(new StudyLoaderArgs(studyUID, null)); for (int i = 0; i < numberOfSops; ++i) { Sop imageSop = LocalStudyLoader.LoadNextSop(); studyTree.AddSop(imageSop); } } foreach (Patient patient in studyTree.Patients) { foreach (Study study in patient.Studies) { foreach (Series series in study.Series) { SeriesItem seriesitem = new SeriesItem(); seriesitem.SeriesNumber = series.SeriesNumber.ToString(); seriesitem.SeriesDescription = series.SeriesDescription; seriesitem.StudyInstanceUID = study.StudyInstanceUid; seriesitem.SeriesInstanceUID = series.SeriesInstanceUid; seriesitem.Modality = series.Modality; seriesitem.Date = series.SeriesDate; seriesitem.Time = series.SeriesTime; //series.NumberOfSeriesRelatedInstances = int.Parse(msg[DicomTags.NumberOfSeriesRelatedInstances].ToString()); seriesitem.NumberOfSeriesRelatedInstances = series.Sops.Count.ToString(); SeriesList.Add(seriesitem); } _component = new SeriesBrowserComponent(SeriesList, null); _shelf = ApplicationComponent.LaunchAsShelf(this.Context.DesktopWindow, _component, DicomDataFormatHelper.PersonNameFormatter(patient.PatientsName), ShelfDisplayHint.DockBottom | ShelfDisplayHint.DockAutoHide); _shelf.Closed += Shelf_Closed; } } } #endregion }
/// <summary> /// Called by the framework when the user clicks the "apply" menu item or toolbar button. /// </summary> public void Apply() { List <string> seriesUIDs = new List <string>(); List <string> studyUIDs = new List <string>(); foreach (SeriesItem item in this.Context.SelectedMultipleSeries) { string foo = item.SeriesInstanceUID; Platform.Log(LogLevel.Info, foo); seriesUIDs.Add(item.SeriesInstanceUID); studyUIDs.Add(item.StudyInstanceUID); } // Code for local data store only (tool should be disabled for remote devices IImageViewer viewer = new ImageViewerComponent(); StudyTree studyTree = viewer.StudyTree; List <SeriesItem> imageList = new List <SeriesItem>(); // Add selected objects studies to study tree foreach (SeriesItem selectedseries in this.Context.SelectedMultipleSeries) { string studyUID = selectedseries.StudyInstanceUID; int numberOfSops = LocalStudyLoader.Start(new StudyLoaderArgs(studyUID, null)); for (int i = 0; i < numberOfSops; ++i) { Sop imageSop = LocalStudyLoader.LoadNextSop(); studyTree.AddSop(imageSop); } } foreach (Patient patient in studyTree.Patients) { foreach (Study study in patient.Studies) { string description = ""; foreach (Series series in study.Series) { string saveseries = seriesUIDs.Find(delegate(string s) { return(s.Equals(series.SeriesInstanceUid)); }); if (saveseries != null) { foreach (Sop sop in series.Sops) { SeriesItem image = new SeriesItem(); DicomFile file = ((ILocalSopDataSource)sop.DataSource).File; StudyData originalData = new StudyData(); file.DataSet.LoadDicomFields(originalData); image.Time = file.DataSet[DicomTags.TriggerTime]; image.SeriesDescription = file.DataSet[DicomTags.SeriesDescription]; image.Modality = file.DataSet[DicomTags.Modality]; image.SeriesNumber = sop.InstanceNumber.ToString(); image.Date = file.DataSet[DicomTags.StudyDate]; imageList.Add(image); description = image.SeriesDescription; } } } _component = new ImageBrowserComponent(imageList, null); _image_shelf = ApplicationComponent.LaunchAsShelf(this.Context.DesktopWindow, _component, DicomDataFormatHelper.PersonNameFormatter(patient.PatientsName) + ": " + description, ShelfDisplayHint.DockBottom | ShelfDisplayHint.DockAutoHide); _image_shelf.Closed += Image_Shelf_Closed; } } }