// build slice list for a given patient private void ProcessAllCTs(string aPatientName, IODRepository mIODRepository) { foreach (string SOPClass in mIODRepository.GetSOPClassNames(aPatientName)) { foreach (string Study in mIODRepository.GetStudies(aPatientName, SOPClass)) { foreach (string Series in mIODRepository.GetSeries(aPatientName, SOPClass, Study)) { foreach (IOD IOD in mIODRepository.GetIODs(aPatientName, SOPClass, Study, Series)) { if (IOD.IsPixelDataProcessable()) { CTSliceInfo aCTSliceInfo = new Helper.CTSliceInfo(IOD.XDocument, IOD.FileName); _scol.Add(aCTSliceInfo); } } } } } }
// Helper method to handle the selection change event of the IOD Tree. // a) In case the selected tree node represents only group information (Patient, SOPClass, Study, Series), the detailed view is cleared. // b) In case the selected tree node represents an IOD, the DICOM Metainformation is displayed in the DICOM Tag Tree. // c) In case the selected tree node represents a CT Slice, in addition to the DICOM Metainformation, // the ImageFlow button, the volume buttons and the bitmap is shown. private void mIODTree_SelectedItemChanged(object sender, RoutedPropertyChangedEventArgs <object> e) { TreeViewItem aSelectedNode = _IODTree.SelectedItem as TreeViewItem; if (aSelectedNode == null) { return; } // Clear old content _DICOMTagTree.Items.Clear(); _Grid.RowDefinitions.First().Height = new GridLength(0); _Grid.RowDefinitions.Last().Height = new GridLength(0); IOD anIOD = aSelectedNode.Tag as IOD; if (anIOD == null) { return; } // Set the FileName as root node string aFileName = Path.GetFileName(anIOD.FileName); TreeViewItem rootNode = new TreeViewItem() { Header = string.Format("File: {0}", aFileName) }; _DICOMTagTree.Items.Add(rootNode); // Expand the root node rootNode.IsExpanded = true; // Add all DICOM attributes to the tree foreach (XElement xe in anIOD.XDocument.Descendants("DataSet").First().Elements("DataElement")) { AddDICOMAttributeToTree(rootNode, xe); } // In case the IOD does have a processable pixel data, the ImageFlow button, the volume buttons and the bitmap is shown. // Otherwise, only the DICOM attributes are shown and the first and last grid row is hided. if (anIOD.IsPixelDataProcessable()) { CTSliceInfo ct = _scol.Retrieve(anIOD.FileName); if (ct == null) { ct = new Helper.CTSliceInfo(anIOD.XDocument, anIOD.FileName); _scol.Add(ct); } _Grid.RowDefinitions.First().Height = new GridLength(30); _Grid.RowDefinitions.Last().Height = new GridLength(ct.RowCount + 16); _Image.Source = CTSliceHelpers.GetPixelBufferAsBitmap(ct); _curCT = ct; } else { _Grid.RowDefinitions.First().Height = new GridLength(0); _Grid.RowDefinitions.Last().Height = new GridLength(0); _curCT = null; } }
public void Add(IOD theIODInfo) { myIODRepository.Add(theIODInfo); }