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3 ] [ 10.5 ] [ 10.5.p1 ] [ 10.6 ] [ 10.6.p1 ] [ 10.6.p2 ] [ 10.6.p3 ] [ 10.7 ] [ 10.7.p1 ] [ 10.7.p2 ] [ 10.7.p3 ] [ 10.7.p4 ] [ 11.0 ] [ 11.0.p1 ] [ 11.0.p2 ] [ 11.0.p3, ] [ 11.0.p4 ] [ 11.1 ] [ 11.1.1 ] [ 11.1.2 ] [ 11.1.3 ] [ 11.2 ] [ 11.2.1 ] [ 11.2.2 ] [ 11.3.0 ]

Diff markup

Differences between /examples/extended/medical/DICOM/dicomReader/src/DicomFileStructure.cc (Version 11.3.0) and /examples/extended/medical/DICOM/dicomReader/src/DicomFileStructure.cc (Version 1.0)


  1 //                                                  1 
  2 // *******************************************    
  3 // * License and Disclaimer                       
  4 // *                                              
  5 // * The  Geant4 software  is  copyright of th    
  6 // * the Geant4 Collaboration.  It is provided    
  7 // * conditions of the Geant4 Software License    
  8 // * LICENSE and available at  http://cern.ch/    
  9 // * include a list of copyright holders.         
 10 // *                                              
 11 // * Neither the authors of this software syst    
 12 // * institutes,nor the agencies providing fin    
 13 // * work  make  any representation or  warran    
 14 // * regarding  this  software system or assum    
 15 // * use.  Please see the license in the file     
 16 // * for the full disclaimer and the limitatio    
 17 // *                                              
 18 // * This  code  implementation is the result     
 19 // * technical work of the GEANT4 collaboratio    
 20 // * By using,  copying,  modifying or  distri    
 21 // * any work based  on the software)  you  ag    
 22 // * use  in  resulting  scientific  publicati    
 23 // * acceptance of all terms of the Geant4 Sof    
 24 // *******************************************    
 25 //                                                
 26 #include "DicomFileStructure.hh"                  
 27                                                   
 28 #include "dcmtk/config/osconfig.h"  // make su    
 29 #include "dcmtk/dcmdata/dcdeftag.h"               
 30 #include "dcmtk/dcmdata/dcfilefo.h"               
 31 #include "dcmtk/dcmdata/dcpixel.h"                
 32 #include "dcmtk/dcmdata/dcpixseq.h"               
 33 #include "dcmtk/dcmdata/dcpxitem.h"               
 34 #include "dcmtk/dcmrt/drtstrct.h"                 
 35 #include "dcmtk/dcmrt/seq/drtcis.h"  // for Co    
 36 #include "dcmtk/dcmrt/seq/drtcs.h"  // for Con    
 37 #include "dcmtk/dcmrt/seq/drtrcs.h"  // for RO    
 38 #include "dcmtk/dcmrt/seq/drtrfors.h"  // for     
 39 #include "dcmtk/dcmrt/seq/drtssrs.h"  // for S    
 40                                                   
 41 #include "G4ThreeVector.hh"                       
 42 #include "G4UIcommand.hh"                         
 43                                                   
 44 //....oooOO0OOooo........oooOO0OOooo........oo    
 45 DicomFileStructure::DicomFileStructure(DcmData    
 46                                                   
 47 //....oooOO0OOooo........oooOO0OOooo........oo    
 48 void DicomFileStructure::ReadData()               
 49 {                                                 
 50   DRTStructureSetIOD rtstruct;                    
 51   OFCondition result = rtstruct.read(*theDatas    
 52   //  DCMRT_INFO("Read RT Structure Set: " <<     
 53   if (!result.good()) {                           
 54     G4Exception("DicomFileStructure::ReadData"    
 55   }                                               
 56                                                   
 57   //@@@@@@@@@@@@ DRTReferencedFrameOfReference    
 58   DRTReferencedFrameOfReferenceSequence refSeq    
 59   if (refSeq.isEmpty()) {                         
 60     G4Exception("DicomFileStructure::ReadData"    
 61                 "DRTReferencedFrameOfReference    
 62   }                                               
 63                                                   
 64   G4cout << "@@@@@ NUMBER OF ReferenceSequence    
 65   refSeq.gotoFirstItem();                         
 66   for (size_t i1 = 0; i1 < refSeq.getNumberOfI    
 67     DRTReferencedFrameOfReferenceSequence::Ite    
 68     OFString uid;                                 
 69     item.getFrameOfReferenceUID(uid);             
 70     G4cout << " FrameOfReferenceUID " << uid <    
 71     DRTRTReferencedStudySequence& reference_st    
 72       item.getRTReferencedStudySequence();        
 73     G4cout << "@@@@ NUMBER OF ReferenceStudySe    
 74            << reference_study_sequence_ref.get    
 75     reference_study_sequence_ref.gotoFirstItem    
 76     for (size_t i2 = 0; i2 < reference_study_s    
 77       DRTRTReferencedStudySequence::Item& rss_    
 78       DRTRTReferencedSeriesSequence& series_se    
 79       G4cout << "@@@ NUMBER OF SeriesSequences    
 80       series_seq_ref.gotoFirstItem();             
 81       for (size_t i3 = 0; i3 < series_seq_ref.    
 82         DRTRTReferencedSeriesSequence::Item& r    
 83         DRTContourImageSequence& image_sequenc    
 84           ref_series_seq_item.getContourImageS    
 85         G4cout << "@@ NUMBER OF ContourImageSe    
 86                << G4endl;                         
 87         image_sequence_seq_ref.gotoFirstItem()    
 88         for (size_t i4 = 0; i4 < image_sequenc    
 89           DRTContourImageSequence::Item& image    
 90             image_sequence_seq_ref.getCurrentI    
 91           OFString refSOPInstUID;                 
 92           image_contour_item.getReferencedSOPI    
 93           std::cout << "ReferencedSOPInstanceU    
 94           image_sequence_seq_ref.gotoNextItem(    
 95         }  // end if image_sequence_seq_ref       
 96         series_seq_ref.gotoNextItem();            
 97       }  // end if series_seq_ref good            
 98       reference_study_sequence_ref.gotoNextIte    
 99     }  // end if reference_study_sequence_ref     
100     refSeq.gotoNextItem();                        
101   }  // end if refSeq.first item                  
102                                                   
103   //@@@@@@@@@@@@   DRTROISequence                 
104   DRTStructureSetROISequence ROISeq = rtstruct    
105   G4cout << "@@@@@ NUMBER OF ROISequences " <<    
106   for (size_t i1 = 0; i1 < ROISeq.getNumberOfI    
107     DRTStructureSetROISequence::Item& item = R    
108     OFString ROIName, ROINumber, ROIGeneration    
109     item.getROINumber(ROINumber);                 
110     item.getROIName(ROIName);                     
111     item.getROIGenerationAlgorithm(ROIGenerati    
112     if (ROINumber != "") {                        
113       DicomROI* roi = new DicomROI(G4UIcommand    
114       theROIs.push_back(roi);                     
115       G4cout << " ROI: " << roi->GetNumber() <    
116              << ROIGenerationAlgorithm << G4en    
117     }                                             
118                                                   
119     ROISeq.gotoNextItem().good();                 
120   }  // end if ROISeq.first item                  
121                                                   
122   //@@@@@@@@@@@@   DRTROIContourSequence          
123   DRTROIContourSequence ROIContourSeq = rtstru    
124   if (ROISeq.getNumberOfItems() != ROIContourS    
125     G4Exception("DicomFileStructure", "DCS0001    
126                 ("Different number of ROIs and    
127                  + std::to_string(ROISeq.getNu    
128                  + std::to_string(ROIContourSe    
129                   .c_str());                      
130   }                                               
131                                                   
132   ROIContourSeq.gotoFirstItem();                  
133   for (size_t i1 = 0; i1 < ROIContourSeq.getNu    
134     DRTROIContourSequence::Item& item = ROICon    
135     OFString displayColor;                        
136     item.getROIDisplayColor(displayColor);        
137     //    G4cout << " ROIDisplayColor " << dis    
138                                                   
139     DRTContourSequence contour_seq = item.getC    
140     //    G4cout << "@@@@ NUMBER OF ContourSeq    
141     contour_seq.gotoFirstItem();                  
142     for (size_t i2 = 0; i2 < contour_seq.getNu    
143       //      if (contour_seq.gotoFirstItem().    
144       //        do {                              
145       DRTContourSequence::Item& cs_item = cont    
146                                                   
147       DicomROIContour* roiC = new DicomROICont    
148                                                   
149       DRTContourImageSequence& contour_image_s    
150                                                   
151       contour_image_seq.gotoFirstItem();          
152       for (size_t i3 = 0; i3 < contour_image_s    
153         DRTContourImageSequence::Item cis_item    
154         OFString refSOPCUID;                      
155         cis_item.getReferencedSOPClassUID(refS    
156         OFString refSOPIUID;                      
157         cis_item.getReferencedSOPInstanceUID(r    
158         if (refSOPIUID != "") roiC->AddImageIU    
159         contour_image_seq.gotoNextItem();         
160       }  // end if contour_image_seq              
161                                                   
162       //@@@                                       
163       OFString geomType;                          
164       cs_item.getContourGeometricType(geomType    
165       Sint32 nPoints;                             
166       cs_item.getNumberOfContourPoints(nPoints    
167       roiC->SetGeomType(geomType);                
168       OFVector<Float64> data;                     
169       cs_item.getContourData(data);               
170       std::vector<G4ThreeVector> dataV;           
171       for (Sint32 ii = 0; ii < nPoints * 3; ii    
172         if (ii % 3 == 2) dataV.push_back(G4Thr    
173       }                                           
174       roiC->SetData(dataV);                       
175       theROIs[i1]->AddContour(roiC);              
176                                                   
177       contour_seq.gotoNextItem();                 
178     }                                             
179     ROIContourSeq.gotoNextItem();                 
180   }  // end if ROIContourSeq.first item           
181                                                   
182   //@@@@ Print ROIs                               
183   G4cout << " @@@@@@@@@@@ ROIs " << G4endl;       
184   for (size_t ii = 0; ii < theROIs.size(); ii+    
185     theROIs[ii]->Print(G4cout);                   
186   }                                               
187 }                                                 
188