Geant4  10.03.p02
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
DicomFileStructure Class Reference

#include <DicomFileStructure.hh>

Inheritance diagram for DicomFileStructure:
Collaboration diagram for DicomFileStructure:

Public Member Functions

 DicomFileStructure (DcmDataset *dset)
 
 ~DicomFileStructure ()
 
std::vector< DicomROI * > GetROIs () const
 
virtual void ReadData ()
 
- Public Member Functions inherited from DicomVFile
 DicomVFile ()
 
 DicomVFile (DcmDataset *dset)
 
 ~DicomVFile ()
 
void SetFileName (G4String fName)
 

Additional Inherited Members

- Protected Member Functions inherited from DicomVFile
virtual std::vector< G4doubleRead1Data (DcmDataset *dset, DcmTagKey tagKey, G4int nData)
 
virtual OFString Read1DataStr (DcmDataset *dset, DcmTagKey tagKey)
 
- Protected Attributes inherited from DicomVFile
DcmDataset * theDataset
 
G4String fFileName
 

Detailed Description

Definition at line 32 of file DicomFileStructure.hh.

Constructor & Destructor Documentation

DicomFileStructure::DicomFileStructure ( DcmDataset *  dset)

Definition at line 45 of file DicomFileStructure.cc.

45  : DicomVFile(dset)
46 {
47 }
DicomFileStructure::~DicomFileStructure ( )
inline

Definition at line 36 of file DicomFileStructure.hh.

36 {};

Member Function Documentation

std::vector<DicomROI*> DicomFileStructure::GetROIs ( ) const
inline

Definition at line 39 of file DicomFileStructure.hh.

39  {
40  return theROIs;
41  }
void DicomFileStructure::ReadData ( )
virtual

Implements DicomVFile.

Definition at line 50 of file DicomFileStructure.cc.

51 {
52  DRTStructureSetIOD rtstruct;
53  OFCondition result = rtstruct.read(*theDataset);
54  // DCMRT_INFO("Read RT Structure Set: " << status.text());
55  if (!result.good()) {
56  G4Exception("DicomFileStructure::ReadData",
57  "DFS001",
59  result.text());
60  }
61 
62 
63  //@@@@@@@@@@@@ DRTReferencedFrameOfReferenceSequence
64  DRTReferencedFrameOfReferenceSequence refSeq = rtstruct.getReferencedFrameOfReferenceSequence();
65  if( refSeq.isEmpty() ) {
66  G4Exception("DicomFileStructure::ReadData",
67  "DFS002",
69  "DRTReferencedFrameOfReferenceSequence is empty");
70  }
71 
72  G4cout << "@@@@@ NUMBER OF ReferenceSequences " << refSeq.getNumberOfItems() << G4endl;
73  refSeq.gotoFirstItem();
74  for( size_t i1 = 0; i1 < refSeq.getNumberOfItems(); i1++ ) {
75  DRTReferencedFrameOfReferenceSequence::Item &item = refSeq.getCurrentItem();
76  OFString uid;
77  item.getFrameOfReferenceUID(uid);
78  G4cout << " FrameOfReferenceUID " << uid << G4endl;
79  DRTRTReferencedStudySequence &reference_study_sequence_ref =
80  item.getRTReferencedStudySequence();
81  G4cout << "@@@@ NUMBER OF ReferenceStudySequences "
82  << reference_study_sequence_ref.getNumberOfItems() << G4endl;
83  reference_study_sequence_ref.gotoFirstItem();
84  for( size_t i2 = 0; i2 < reference_study_sequence_ref.getNumberOfItems(); i2++ ) {
85  DRTRTReferencedStudySequence::Item &rss_item = reference_study_sequence_ref.getCurrentItem();
86  DRTRTReferencedSeriesSequence &series_seq_ref = rss_item.getRTReferencedSeriesSequence();
87  G4cout << "@@@ NUMBER OF SeriesSequences " << series_seq_ref.getNumberOfItems() << G4endl;
88  series_seq_ref.gotoFirstItem();
89  for( size_t i3 = 0; i3 < series_seq_ref.getNumberOfItems(); i3++ ) {
90  DRTRTReferencedSeriesSequence::Item &ref_series_seq_item = series_seq_ref.getCurrentItem();
91  DRTContourImageSequence &image_sequence_seq_ref =
92  ref_series_seq_item.getContourImageSequence();
93  G4cout << "@@ NUMBER OF ContourImageSequences "
94  << image_sequence_seq_ref.getNumberOfItems() << G4endl;
95  image_sequence_seq_ref.gotoFirstItem();
96  for( size_t i4 = 0; i4 < image_sequence_seq_ref.getNumberOfItems(); i4++ ) {
97  DRTContourImageSequence::Item &image_contour_item =
98  image_sequence_seq_ref.getCurrentItem();
99  OFString refSOPInstUID;
100  image_contour_item.getReferencedSOPInstanceUID(refSOPInstUID);
101  std::cout <<"ReferencedSOPInstanceUID= " << refSOPInstUID << std::endl;
102  image_sequence_seq_ref.gotoNextItem().good();
103  } // end if image_sequence_seq_ref
104  series_seq_ref.gotoNextItem();
105  } // end if series_seq_ref good
106  reference_study_sequence_ref.gotoNextItem();
107  } // end if reference_study_sequence_ref good
108  refSeq.gotoNextItem();
109  } // end if refSeq.first item
110 
111  //@@@@@@@@@@@@ DRTROISequence
112  DRTStructureSetROISequence ROISeq = rtstruct.getStructureSetROISequence();
113  G4cout << "@@@@@ NUMBER OF ROISequences " << ROISeq.getNumberOfItems() << G4endl;
114  for( size_t i1 = 0; i1 < ROISeq.getNumberOfItems(); i1++ ) {
115  DRTStructureSetROISequence::Item &item = ROISeq.getCurrentItem();
116  OFString ROIName, ROINumber, ROIGenerationAlgorithm;
117  item.getROINumber(ROINumber);
118  item.getROIName(ROIName);
119  item.getROIGenerationAlgorithm(ROIGenerationAlgorithm);
120  if( ROINumber != "" ) {
121  DicomROI* roi = new DicomROI(G4UIcommand::ConvertToInt(ROINumber.c_str()), ROIName.c_str());
122  theROIs.push_back( roi );
123  G4cout << " ROI: " << roi->GetNumber() << " " << roi->GetName() << " "
124  << ROIGenerationAlgorithm << G4endl;
125  }
126 
127  ROISeq.gotoNextItem().good();
128  } // end if ROISeq.first item
129 
130 
131  //@@@@@@@@@@@@ DRTROIContourSequence
132  DRTROIContourSequence ROIContourSeq = rtstruct.getROIContourSequence();
133  if( ROISeq.getNumberOfItems() != ROIContourSeq.getNumberOfItems() ) {
134  G4Exception("DicomFileStructure",
135  "DCS0001",
137  ("Different number of ROIs and ROI Contours "
138  + std::to_string(ROISeq.getNumberOfItems()) + " <> "
139  + std::to_string(ROIContourSeq.getNumberOfItems())).c_str());
140  }
141 
142  ROIContourSeq.gotoFirstItem();
143  for( size_t i1 = 0; i1 < ROIContourSeq.getNumberOfItems(); i1++ ) {
144  DRTROIContourSequence::Item &item = ROIContourSeq.getCurrentItem();
145  OFString displayColor;
146  item.getROIDisplayColor(displayColor);
147  // G4cout << " ROIDisplayColor " << displayColor << G4endl;
148 
149  DRTContourSequence contour_seq = item.getContourSequence();
150  // G4cout << "@@@@ NUMBER OF ContourSequences " << contour_seq.getNumberOfItems() << G4endl;
151  contour_seq.gotoFirstItem();
152  for( size_t i2 = 0; i2 < contour_seq.getNumberOfItems(); i2++ ) {
153  // if (contour_seq.gotoFirstItem().good()) {
154  // do {
155  DRTContourSequence::Item &cs_item = contour_seq.getCurrentItem();
156 
157  DicomROIContour* roiC = new DicomROIContour();
158 
159  DRTContourImageSequence &contour_image_seq = cs_item.getContourImageSequence();
160 
161  contour_image_seq.gotoFirstItem();
162  for( size_t i3 = 0; i3 < contour_image_seq.getNumberOfItems(); i3++ ) {
163  DRTContourImageSequence::Item cis_item = contour_image_seq.getCurrentItem();
164  OFString refSOPCUID;
165  cis_item.getReferencedSOPClassUID(refSOPCUID);
166  OFString refSOPIUID;
167  cis_item.getReferencedSOPInstanceUID(refSOPIUID);
168  if( refSOPIUID != "") roiC->AddImageIUID(refSOPIUID.c_str());
169  contour_image_seq.gotoNextItem();
170  } // end if contour_image_seq
171 
172  //@@@
173  OFString geomType;
174  cs_item.getContourGeometricType(geomType);
175  Sint32 nPoints;
176  cs_item.getNumberOfContourPoints(nPoints);
177  roiC->SetGeomType(geomType);
178  OFVector<Float64> data;
179  cs_item.getContourData(data);
180  std::vector<G4ThreeVector> dataV;
181  for( Sint32 ii = 0; ii < nPoints*3; ii++ ) {
182  if( ii%3 == 2 ) dataV.push_back( G4ThreeVector( data[ii-2], data[ii-1], data[ii] ) );
183  }
184  roiC->SetData(dataV);
185  theROIs[i1]->AddContour(roiC);
186 
187  contour_seq.gotoNextItem();
188  }
189  ROIContourSeq.gotoNextItem();
190  } // end if ROIContourSeq.first item
191 
192  //@@@@ Print ROIs
193  G4cout << " @@@@@@@@@@@ ROIs " << G4endl;
194  for( size_t ii = 0; ii < theROIs.size(); ii++ ) {
195  theROIs[ii]->Print(G4cout);
196  }
197 }
G4double G4ParticleHPJENDLHEData::G4double result
CLHEP::Hep3Vector G4ThreeVector
void SetData(std::vector< G4ThreeVector > data)
const XML_Char const XML_Char * data
Definition: expat.h:268
G4GLOB_DLL std::ostream G4cout
int GetNumber() const
Definition: DicomROI.hh:47
DcmDataset * theDataset
Definition: DicomVFile.hh:52
static G4int ConvertToInt(const char *st)
Definition: G4UIcommand.cc:447
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41
#define G4endl
Definition: G4ios.hh:61
void SetGeomType(OFString gt)
void AddImageIUID(OFString ima)
OFString GetName() const
Definition: DicomROI.hh:50

Here is the call graph for this function:

Here is the caller graph for this function:


The documentation for this class was generated from the following files: