Geant4 Cross Reference |
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 "DicomFilePlan.hh" 27 28 #include "DicomBeam.hh" 29 #include "DicomBeamBlock.hh" 30 #include "DicomBeamCompensator.hh" 31 #include "DicomBeamControlPoint.hh" 32 #include "DicomBeamDevicePos.hh" 33 #include "DicomBeamDeviceRef.hh" 34 #include "DicomBeamWedge.hh" 35 #include "dcmtk/dcmdata/dcdeftag.h" 36 #include "dcmtk/dcmdata/dcfilefo.h" 37 #include "dcmtk/dcmrt/drtplan.h" 38 #include "dcmtk/dcmrt/seq/drtbl2.h" // for Bl 39 #include "dcmtk/dcmrt/seq/drtbldps.h" // for 40 #include "dcmtk/dcmrt/seq/drtblds1.h" // for 41 #include "dcmtk/dcmrt/seq/drtbs.h" // for Bea 42 #include "dcmtk/dcmrt/seq/drtcos.h" // for Co 43 #include "dcmtk/dcmrt/seq/drtcps.h" // for Co 44 #include "dcmtk/dcmrt/seq/drtfgs.h" // DRTFra 45 #include "dcmtk/dcmrt/seq/drtrbs8.h" // DRTRe 46 #include "dcmtk/dcmrt/seq/drtws.h" // for Wed 47 48 #include "G4ThreeVector.hh" 49 50 //....oooOO0OOooo........oooOO0OOooo........oo 51 DicomFilePlan::DicomFilePlan(DcmDataset* dset) 52 53 //....oooOO0OOooo........oooOO0OOooo........oo 54 void DicomFilePlan::ReadData() 55 { 56 DRTPlanIOD rtplan; 57 OFCondition result = rtplan.read(*theDataset 58 if (!result.good()) { 59 G4Exception("DicomFilePlan::ReadData", "DF 60 } 61 OFString fstr; 62 Sint32 fint; 63 Float64 ffloat; 64 OFVector<Float64> fvfloat; 65 66 DRTFractionGroupSequence frgSeq = rtplan.get 67 if (frgSeq.isEmpty()) { 68 G4Exception("DicomFilePlan::ReadData", "DF 69 "DRTFractionGroupSequence is e 70 } 71 G4cout << "@@@@@ NUMBER OF FractionSequences 72 frgSeq.gotoFirstItem(); 73 for (size_t i1 = 0; i1 < frgSeq.getNumberOfI 74 DRTFractionGroupSequence::Item& rfgItem = 75 rfgItem.getBeamDoseMeaning(fstr); 76 G4cout << " " << i1 << " BeamDoseMeaning " 77 rfgItem.getFractionGroupDescription(fstr); 78 G4cout << " " << i1 << " FractionGroupDesc 79 rfgItem.getFractionGroupNumber(fint); 80 G4cout << " " << i1 << " FractionGroupNumb 81 rfgItem.getFractionPattern(fstr); 82 G4cout << " " << i1 << " FractionPattern " 83 rfgItem.getNumberOfBeams(fint); 84 G4cout << " " << i1 << " NumberOfBeams " < 85 theNumberOfBeams = fint; 86 rfgItem.getNumberOfBrachyApplicationSetups 87 G4cout << " " << i1 << " NumberOfBrachyApp 88 CheckData0(" NumberOfBrachyApplicationSetu 89 rfgItem.getNumberOfFractionPatternDigitsPe 90 G4cout << " " << i1 << " NumberOfFractionP 91 rfgItem.getNumberOfFractionsPlanned(fint); 92 G4cout << " " << i1 << " NumberOfFractions 93 rfgItem.getRepeatFractionCycleLength(fint) 94 G4cout << " " << i1 << " RepeatFractionCyc 95 DRTReferencedBeamSequenceInRTFractionSchem 96 rfgItem.getReferencedBeamSequence(); 97 G4cout << " @@@ NUMBER OF ReferencedBeamSe 98 99 refBeamSeq.gotoFirstItem(); 100 for (size_t i2 = 0; i2 < refBeamSeq.getNum 101 DicomBeam* db = new DicomBeam(); 102 theBeams.push_back(db); 103 DRTReferencedBeamSequenceInRTFractionSch 104 refBeamSeq.getCurrentItem(); 105 rbsItem.getBeamDeliveryDurationLimit(ffl 106 G4cout << " " << i2 << " BeamDeliveryDu 107 rbsItem.getBeamDose(ffloat); 108 G4cout << " " << i2 << " BeamDose " << 109 rbsItem.getBeamDoseSpecificationPoint(fv 110 G4cout << " " << i2 << " BeamDoseSpecif 111 << "," << fvfloat[2] << ")" << G4 112 db->SetDoseSpecificationPoint(G4ThreeVec 113 rbsItem.getBeamMeterset(ffloat); 114 G4cout << " " << i2 << " BeamMeterset " 115 db->SetMeterset(ffloat); 116 rbsItem.getReferencedBeamNumber(fint); 117 G4cout << " " << i2 << " ReferencedBeam 118 119 refBeamSeq.gotoNextItem(); 120 } 121 122 frgSeq.gotoNextItem(); 123 } 124 125 DRTBeamSequence beamSeq = rtplan.getBeamSequ 126 if (beamSeq.isEmpty()) { 127 G4Exception("DicomFilePlan::ReadData", "DF 128 } 129 G4cout << "@@@@@ NUMBER OF BeamSequences " < 130 beamSeq.gotoFirstItem(); 131 for (size_t i1 = 0; i1 < beamSeq.getNumberOf 132 DicomBeam* db = theBeams[i1]; 133 DRTBeamSequence::Item& beamItem = beamSeq. 134 135 beamItem.getManufacturer(fstr); 136 G4cout << " " << i1 << " Manufacturer " << 137 beamItem.getManufacturerModelName(fstr); 138 G4cout << " " << i1 << " ManufacturerModel 139 beamItem.getTreatmentMachineName(fstr); 140 G4cout << " " << i1 << " TreatmentMachineN 141 beamItem.getPrimaryDosimeterUnit(fstr); 142 G4cout << " " << i1 << " PrimaryDosimeterU 143 beamItem.getSourceAxisDistance(ffloat); 144 G4cout << " " << i1 << " SourceAxisDistanc 145 db->SetSourceAxisDistance(ffloat); 146 147 DRTBeamLimitingDeviceSequenceInRTBeamsModu 148 G4cout << " @@@ NUMBER OF BeamLimitingDevi 149 beamLDS.gotoFirstItem(); 150 for (size_t i2 = 0; i2 < beamLDS.getNumber 151 DRTBeamLimitingDeviceSequenceInRTBeamsMo 152 DicomBeamDeviceRef* dbd = new DicomBeamD 153 db->AddDevice(dbd); 154 155 beamLDS.gotoNextItem(); 156 } 157 158 beamItem.getBeamNumber(fint); 159 G4cout << " " << i1 << " BeamNumber " << f 160 db->SetNumber(fint); 161 beamItem.getBeamName(fstr); 162 G4cout << " " << i1 << " BeamName " << fst 163 beamItem.getBeamDescription(fstr); 164 G4cout << " " << i1 << " BeamDescription " 165 beamItem.getBeamType(fstr); 166 G4cout << " " << i1 << " BeamType " << fst 167 beamItem.getRadiationType(fstr); 168 G4cout << " " << i1 << " RadiationType " < 169 db->SetRadiationType(fstr); 170 beamItem.getTreatmentDeliveryType(fstr); 171 G4cout << " " << i1 << " TreatmentDelivery 172 beamItem.getNumberOfWedges(fint); 173 G4cout << " " << i1 << " NumberOfWedges " 174 DRTWedgeSequence beamWedge = beamItem.getW 175 beamWedge.gotoFirstItem(); 176 for (size_t i2 = 0; i2 < beamWedge.getNumb 177 DRTWedgeSequence::Item bwedItem = beamWe 178 DicomBeamWedge* dbwed = new DicomBeamWed 179 db->AddWedge(dbwed); 180 beamWedge.gotoNextItem(); 181 } 182 183 beamItem.getNumberOfCompensators(fint); 184 G4cout << " " << i1 << " NumberOfCompensat 185 DRTCompensatorSequence beamCompens = beamI 186 beamCompens.gotoFirstItem(); 187 for (size_t i2 = 0; i2 < beamCompens.getNu 188 DRTCompensatorSequence::Item bcompItem = 189 DicomBeamCompensator* dbcomp = new Dicom 190 db->AddCompensator(dbcomp); 191 beamCompens.gotoNextItem(); 192 } 193 194 beamItem.getNumberOfBoli(fint); 195 G4cout << " " << i1 << " NumberOfBoli " << 196 // Bolus has no relevant info (see drtrbos 197 198 beamItem.getNumberOfBlocks(fint); 199 G4cout << " " << i1 << " NumberOfBlocks " 200 DRTBlockSequenceInRTBeamsModule beamBlock 201 beamBlock.gotoFirstItem(); 202 for (size_t i2 = 0; i2 < beamBlock.getNumb 203 DRTBlockSequenceInRTBeamsModule::Item bb 204 DicomBeamBlock* dbbl = new DicomBeamBloc 205 db->AddBlock(dbbl); 206 beamBlock.gotoNextItem(); 207 } 208 209 beamItem.getFinalCumulativeMetersetWeight( 210 G4cout << " " << i1 << " FinalCumulativeMe 211 beamItem.getDeviceSerialNumber(fstr); 212 G4cout << " " << i1 << " DeviceSerialNumbe 213 beamItem.getHighDoseTechniqueType(fstr); 214 G4cout << " " << i1 << " HighDoseTechnique 215 beamItem.getInstitutionAddress(fstr); 216 G4cout << " " << i1 << " InstitutionAddres 217 beamItem.getInstitutionName(fstr); 218 G4cout << " " << i1 << " InstitutionName " 219 beamItem.getInstitutionalDepartmentName(fs 220 G4cout << " " << i1 << " InstitutionalDepa 221 beamItem.getReferencedPatientSetupNumber(f 222 G4cout << " " << i1 << " ReferencedPatient 223 beamItem.getReferencedToleranceTableNumber 224 G4cout << " " << i1 << " ReferencedToleran 225 beamItem.getTotalBlockTrayFactor(ffloat); 226 G4cout << " " << i1 << " TotalBlockTrayFac 227 beamItem.getTotalCompensatorTrayFactor(ffl 228 G4cout << " " << i1 << " TotalCompensatorT 229 230 beamItem.getNumberOfControlPoints(fint); 231 DRTControlPointSequence controlPSeq = beam 232 G4cout << " @@@ NUMBER OF ControlPointSequ 233 << fint << G4endl; 234 controlPSeq.gotoFirstItem(); 235 DicomBeamControlPoint* dbcp0 = 0; 236 // Only first ControlPoint has some info i 237 for (size_t i2 = 0; i2 < controlPSeq.getNu 238 DRTControlPointSequence::Item& cpItem = 239 if (db->GetNControlPoints() != 0) dbcp0 240 DicomBeamControlPoint* dbcp = new DicomB 241 db->AddControlPoint(dbcp); 242 controlPSeq.gotoNextItem(); 243 } 244 245 beamSeq.gotoNextItem(); 246 } 247 248 //(300a,0180) SQ (Sequence with explicit len 249 //(300c,0060) SQ (Sequence with explicit len 250 //(300e,0002) CS [UNAPPROVED] 251 //(7fe0,0010) OW (no value available) 252 } 253 254 //....oooOO0OOooo........oooOO0OOooo........oo 255 void DicomFilePlan::CheckData0(OFString title, 256 { 257 if (val != 0) { 258 G4Exception("DicomFilePlan::CheckData", "D 259 (title + " exists, and code is 260 } 261 } 262 263 //....oooOO0OOooo........oooOO0OOooo........oo 264 void DicomFilePlan::SetControlPointMetersets() 265 { 266 for (size_t ii = 0; ii < theBeams.size(); ii 267 theBeams[ii]->SetControlPointMetersets(); 268 } 269 } 270 271 //....oooOO0OOooo........oooOO0OOooo........oo 272 void DicomFilePlan::DumpToFile() 273 { 274 for (size_t ii = 0; ii < theBeams.size(); ii 275 theBeams[ii]->DumpToFile(); 276 } 277 } 278