File indexing completed on 2025-04-10 08:06:19
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026 #include "DicomBeamControlPoint.hh"
0027
0028 #include "DicomBeamDevicePos.hh"
0029 #include "dcmtk/dcmrt/seq/drtcps.h" // for ControlPointSequence
0030
0031 #include "globals.hh"
0032
0033
0034 DicomBeamControlPoint::DicomBeamControlPoint(DRTControlPointSequence::Item cpItem,
0035 DicomBeamControlPoint* point0)
0036 {
0037 OFString fstr;
0038 Sint32 fint;
0039 Float64 ffloat;
0040 Float32 ffloat32;
0041 OFVector<Float64> fvfloat;
0042
0043 cpItem.getControlPointIndex(fint);
0044 G4cout << " @ DicomBeamControlPoint: " << fint << G4endl;
0045 G4cout << " "
0046 << " ControlPointIndex " << fint << G4endl;
0047 SetIndex(fint);
0048 if (cpItem.getNominalBeamEnergy(ffloat) != EC_Normal) {
0049 if (point0) ffloat = point0->GetNominalBeamEnergy();
0050 }
0051 G4cout << " "
0052 << " NominalBeamEnergy " << ffloat << G4endl;
0053 SetNominalBeamEnergy(ffloat);
0054 cpItem.getDoseRateSet(ffloat);
0055 G4cout << " "
0056 << " DoseRateSet " << ffloat << G4endl;
0057
0058 DRTBeamLimitingDevicePositionSequence beamLDPS = cpItem.getBeamLimitingDevicePositionSequence();
0059 G4cout << " @ NUMBER OF BeamLimitingDevicePositionSequence " << beamLDPS.getNumberOfItems()
0060 << G4endl;
0061 beamLDPS.gotoFirstItem();
0062 for (size_t i3 = 0; i3 < beamLDPS.getNumberOfItems(); i3++) {
0063 DRTBeamLimitingDevicePositionSequence::Item bldpsItem = beamLDPS.getCurrentItem();
0064 DicomBeamDevicePos* dbd = new DicomBeamDevicePos(bldpsItem);
0065 AddDevice(dbd);
0066
0067 beamLDPS.gotoNextItem();
0068 }
0069
0070 cpItem.getGantryAngle(ffloat);
0071 G4cout << " "
0072 << " GantryAngle " << ffloat << G4endl;
0073
0074 cpItem.getGantryRotationDirection(fstr);
0075 G4cout << " "
0076 << " GantryRotationDirection " << fstr << G4endl;
0077 if (fstr == "CC") {
0078 SetGantryAngle(-ffloat);
0079 }
0080 else if (fstr == "CW" || fstr == "NONE" || fstr == "") {
0081 SetGantryAngle(ffloat);
0082 }
0083 if (cpItem.getBeamLimitingDeviceAngle(ffloat) != EC_Normal) {
0084 if (point0) ffloat = point0->GetBeamLimitingDeviceAngle();
0085 }
0086 G4cout << " "
0087 << " BeamLimitingDeviceAngle " << ffloat << G4endl;
0088
0089 if (cpItem.getBeamLimitingDeviceRotationDirection(fstr) != EC_Normal) {
0090 if (point0) fstr = point0->GetBeamLimitingDeviceRotationDirection();
0091 }
0092 if (fstr == "CC") {
0093 SetBeamLimitingDeviceAngle(-ffloat);
0094 }
0095 else if (fstr == "CW" || fstr == "NONE" || fstr == "") {
0096 SetBeamLimitingDeviceAngle(ffloat);
0097 }
0098 G4cout << " "
0099 << " BeamLimitingDeviceRotationDirection " << fstr << G4endl;
0100 SetBeamLimitingDeviceRotationDirection(fstr);
0101
0102 if (cpItem.getPatientSupportAngle(ffloat) != EC_Normal) {
0103 if (point0) fstr = point0->GetPatientSupportAngle();
0104 }
0105 G4cout << " "
0106 << " PatientSupportAngle " << ffloat << G4endl;
0107
0108 if (cpItem.getPatientSupportRotationDirection(fstr) != EC_Normal) {
0109 if (point0) fstr = point0->GetPatientSupportRotationDirection();
0110 }
0111 G4cout << " "
0112 << " PatientSupportRotationDirection " << fstr << G4endl;
0113 SetPatientSupportRotationDirection(fstr);
0114 if (fstr == "CC") {
0115 SetPatientSupportAngle(-ffloat);
0116 }
0117 else if (fstr == "CW" || fstr == "NONE" || fstr == "") {
0118 SetPatientSupportAngle(ffloat);
0119 }
0120
0121 if (cpItem.getTableTopEccentricAngle(ffloat) != EC_Normal) {
0122 if (point0) ffloat = point0->GetTableTopEccentricAngle();
0123 }
0124 G4cout << " "
0125 << " TableTopEccentricAngle " << ffloat << G4endl;
0126
0127 if (cpItem.getTableTopEccentricRotationDirection(fstr) != EC_Normal) {
0128 if (point0) fstr = point0->GetTableTopEccentricRotationDirection();
0129 }
0130 if (fstr == "CC") {
0131 SetTableTopEccentricAngle(-ffloat);
0132 }
0133 else if (fstr == "CW" || fstr == "NONE" || fstr == "") {
0134 SetTableTopEccentricAngle(ffloat);
0135 }
0136 G4cout << " "
0137 << " TableTopEccentricRotationDirection " << fstr << G4endl;
0138 SetTableTopEccentricRotationDirection(fstr);
0139
0140 G4ThreeVector isoCenter;
0141 if (cpItem.getIsocenterPosition(fvfloat) != EC_Normal) {
0142 if (point0) isoCenter = point0->GetIsocenterPosition();
0143 }
0144 else {
0145 isoCenter = G4ThreeVector(fvfloat[0], fvfloat[1], fvfloat[2]);
0146 }
0147 G4cout << " "
0148 << " IsocenterPosition " << isoCenter << G4endl;
0149 SetIsocenterPosition(isoCenter);
0150
0151 if (cpItem.getSourceToSurfaceDistance(ffloat) != EC_Normal) {
0152 if (point0) ffloat = point0->GetSourceToSurfaceDistance();
0153 }
0154 G4cout << " "
0155 << " SourceToSurfaceDistance " << ffloat << G4endl;
0156 SetSourceToSurfaceDistance(ffloat);
0157
0158 cpItem.getCumulativeMetersetWeight(ffloat);
0159 G4cout << " "
0160 << " CumulativeMetersetWeight " << ffloat << G4endl;
0161 SetCumulativeMetersetWeight(ffloat);
0162
0163 if (cpItem.getGantryPitchAngle(ffloat32) != EC_Normal) {
0164 if (point0) ffloat32 = point0->GetGantryPitchAngle();
0165 }
0166 G4cout << " "
0167 << " GantryPitchAngle " << ffloat32 << G4endl;
0168 SetGantryPitchAngle(ffloat32);
0169
0170 if (cpItem.getSurfaceEntryPoint(ffloat) != EC_Normal) {
0171 if (point0) ffloat = point0->GetSurfaceEntryPoint();
0172 }
0173 G4cout << " "
0174 << " SurfaceEntryPoint " << ffloat << G4endl;
0175 SetSurfaceEntryPoint(ffloat);
0176
0177 if (cpItem.getTableTopEccentricAxisDistance(ffloat) != EC_Normal) {
0178 if (point0) ffloat = point0->GetTableTopEccentricAxisDistance();
0179 }
0180 G4cout << " "
0181 << " TableTopEccentricAxisDistance " << ffloat << G4endl;
0182 SetTableTopEccentricAxisDistance(ffloat);
0183
0184 if (cpItem.getTableTopLateralPosition(ffloat) != EC_Normal) {
0185 if (point0) ffloat = point0->GetTableTopLateralPosition();
0186 }
0187 G4cout << " "
0188 << " TableTopLateralPosition " << ffloat << G4endl;
0189 SetTableTopLateralPosition(ffloat);
0190
0191 if (cpItem.getTableTopLongitudinalPosition(ffloat) != EC_Normal) {
0192 if (point0) ffloat = point0->GetTableTopLongitudinalPosition();
0193 }
0194 G4cout << " "
0195 << " TableTopLongitudinalPosition " << ffloat << G4endl;
0196 SetTableTopLongitudinalPosition(ffloat);
0197
0198 if (cpItem.getTableTopPitchAngle(ffloat32) != EC_Normal) {
0199 if (point0) ffloat32 = point0->GetTableTopPitchAngle();
0200 }
0201 G4cout << " "
0202 << " TableTopPitchAngle " << ffloat32 << G4endl;
0203
0204 if (cpItem.getTableTopPitchRotationDirection(fstr) != EC_Normal) {
0205 if (point0) fstr = point0->GetTableTopPitchRotationDirection();
0206 }
0207 if (fstr == "CC") {
0208 SetTableTopPitchAngle(-ffloat32);
0209 }
0210 else if (fstr == "CW" || fstr == "NONE" || fstr == "") {
0211 SetTableTopPitchAngle(ffloat32);
0212 }
0213 G4cout << " "
0214 << " TableTopPitchRotationDirection " << fstr << G4endl;
0215 SetTableTopPitchRotationDirection(fstr);
0216
0217 if (cpItem.getTableTopRollAngle(ffloat32) != EC_Normal) {
0218 if (point0) ffloat32 = point0->GetTableTopRollAngle();
0219 }
0220 G4cout << " "
0221 << " TableTopRollAngle " << ffloat32 << G4endl;
0222
0223 if (cpItem.getTableTopRollRotationDirection(fstr) != EC_Normal) {
0224 if (point0) fstr = point0->GetTableTopRollRotationDirection();
0225 }
0226 if (fstr == "CC") {
0227 SetTableTopRollAngle(-ffloat32);
0228 }
0229 else if (fstr == "CW" || fstr == "NONE" || fstr == "") {
0230 SetTableTopRollAngle(ffloat32);
0231 }
0232 G4cout << " "
0233 << " TableTopRollRotationDirection " << fstr << G4endl;
0234 SetTableTopRollRotationDirection(fstr);
0235
0236 if (cpItem.getTableTopVerticalPosition(ffloat) != EC_Normal) {
0237 if (point0) ffloat = point0->GetTableTopVerticalPosition();
0238 }
0239 G4cout << " "
0240 << " TableTopVerticalPosition " << ffloat << G4endl;
0241 SetTableTopVerticalPosition(ffloat);
0242
0243
0244
0245
0246 }
0247
0248
0249 void DicomBeamControlPoint::Print(std::ostream&) {}
0250
0251
0252 void DicomBeamControlPoint::DumpToFile(std::ofstream& fout)
0253 {
0254 fout << ":P ControlPointIndex " << theIndex << G4endl;
0255 fout << ":P NominalBeamEnergy " << theNominalBeamEnergy << G4endl;
0256 fout << ":P IsocenterPositionX " << theIsocenterPosition.x() << G4endl;
0257 fout << ":P IsocenterPositionY " << theIsocenterPosition.y() << G4endl;
0258 fout << ":P IsocenterPositionZ " << theIsocenterPosition.z() << G4endl;
0259
0260
0261 fout << ":P SourceToSurfaceDistance " << theSourceToSurfaceDistance << G4endl;
0262 fout << ":P GantryAngle " << theGantryAngle << G4endl;
0263 fout << ":P BeamLimitingDeviceAngle " << theBeamLimitingDeviceAngle << G4endl;
0264 fout << ":P PatientSupportAngle " << thePatientSupportAngle << G4endl;
0265 fout << ":P TableTopEccentricAngle " << theTableTopEccentricAngle << G4endl;
0266 fout << ":P SourceToSurfaceDistance " << theSourceToSurfaceDistance << G4endl;
0267 fout << ":P MetersetWeight " << theMetersetWeight << G4endl;
0268 fout << ":P GantryPitchAngle " << theGantryPitchAngle << G4endl;
0269 fout << ":P SurfaceEntryPoint " << theSurfaceEntryPoint << G4endl;
0270 fout << ":P TableTopEccentricAxisDistance " << theTableTopEccentricAxisDistance << G4endl;
0271 fout << ":P TableTopLateralPosition " << theTableTopLateralPosition << G4endl;
0272 fout << ":P TableTopLongitudinalPosition " << theTableTopLongitudinalPosition << G4endl;
0273 fout << ":P TableTopPitchAngle " << theTableTopPitchAngle << G4endl;
0274 fout << ":P TableTopRollAngle " << theTableTopRollAngle << G4endl;
0275 fout << ":P TableTopVerticalPosition " << theTableTopVerticalPosition << G4endl;
0276
0277 for (size_t ii = 0; ii < theDevices.size(); ii++) {
0278 theDevices[ii]->DumpToFile(fout);
0279 }
0280 }