Geant4  10.03.p03
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
DicomBeamControlPoint.cc
Go to the documentation of this file.
1 //
2 // ********************************************************************
3 // * License and Disclaimer *
4 // * *
5 // * The Geant4 software is copyright of the Copyright Holders of *
6 // * the Geant4 Collaboration. It is provided under the terms and *
7 // * conditions of the Geant4 Software License, included in the file *
8 // * LICENSE and available at http://cern.ch/geant4/license . These *
9 // * include a list of copyright holders. *
10 // * *
11 // * Neither the authors of this software system, nor their employing *
12 // * institutes,nor the agencies providing financial support for this *
13 // * work make any representation or warranty, express or implied, *
14 // * regarding this software system or assume any liability for its *
15 // * use. Please see the license in the file LICENSE and URL above *
16 // * for the full disclaimer and the limitation of liability. *
17 // * *
18 // * This code implementation is the result of the scientific and *
19 // * technical work of the GEANT4 collaboration. *
20 // * By using, copying, modifying or distributing the software (or *
21 // * any work based on the software) you agree to acknowledge its *
22 // * use in resulting scientific publications, and indicate your *
23 // * acceptance of all terms of the Geant4 Software license. *
24 // ********************************************************************
25 //
26 #include "DicomBeamControlPoint.hh"
27 #include "DicomBeamDevicePos.hh"
28 
29 #include "dcmtk/dcmrt/seq/drtcps.h" // for ControlPointSequence
30 #include "globals.hh"
31 
32 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
33 DicomBeamControlPoint::DicomBeamControlPoint(DRTControlPointSequence::Item cpItem,
34  DicomBeamControlPoint* point0 )
35 {
36  OFString fstr;
37  Sint32 fint;
38  Float64 ffloat;
39  Float32 ffloat32;
40  OFVector<Float64> fvfloat;
41 
42  cpItem.getControlPointIndex(fint);
43  G4cout << " @ DicomBeamControlPoint: " << fint << G4endl;
44  G4cout << " " << " ControlPointIndex " << fint << G4endl;
45  SetIndex( fint );
46  if( cpItem.getNominalBeamEnergy(ffloat) != EC_Normal ) {
47  if( point0 ) ffloat = point0->GetNominalBeamEnergy();
48  }
49  G4cout << " " << " NominalBeamEnergy " << ffloat << G4endl;
50  SetNominalBeamEnergy(ffloat);
51  cpItem.getDoseRateSet(ffloat); // != EC_Normal ) {
52  G4cout << " " << " DoseRateSet " << ffloat << G4endl;
53 
54  DRTBeamLimitingDevicePositionSequence beamLDPS = cpItem.getBeamLimitingDevicePositionSequence();
55  G4cout << " @ NUMBER OF BeamLimitingDevicePositionSequence " << beamLDPS.getNumberOfItems()
56  << G4endl;
57  beamLDPS.gotoFirstItem();
58  for( size_t i3 = 0; i3 < beamLDPS.getNumberOfItems(); i3++ ) {
59  DRTBeamLimitingDevicePositionSequence::Item bldpsItem = beamLDPS.getCurrentItem();
60  DicomBeamDevicePos* dbd = new DicomBeamDevicePos(bldpsItem);
61  AddDevice(dbd);
62 
63  beamLDPS.gotoNextItem();
64  }
65 
66  cpItem.getGantryAngle(ffloat);
67  G4cout << " " << " GantryAngle " << ffloat << G4endl;
68 
69  cpItem.getGantryRotationDirection(fstr); //**
70  G4cout << " " << " GantryRotationDirection " << fstr << G4endl;
71  if( fstr == "CC" ) { // counter-clockwise
72  SetGantryAngle(-ffloat);
73  } else if( fstr == "CW" || fstr == "NONE" || fstr == "") { // clockwise
74  SetGantryAngle(ffloat);
75  }
76  if( cpItem.getBeamLimitingDeviceAngle(ffloat) != EC_Normal ) {
77  if( point0 ) ffloat = point0->GetBeamLimitingDeviceAngle();
78  }
79  G4cout << " " << " BeamLimitingDeviceAngle " << ffloat << G4endl;
80 
81  if( cpItem.getBeamLimitingDeviceRotationDirection(fstr) != EC_Normal ) {
82  if( point0 ) fstr = point0->GetBeamLimitingDeviceRotationDirection();
83  }
84  if( fstr == "CC" ) { // counter-clockwise
86  } else if( fstr == "CW" || fstr == "NONE" || fstr == "") { // clockwise
88  }
89  G4cout << " " << " BeamLimitingDeviceRotationDirection " << fstr << G4endl;
91 
92  if( cpItem.getPatientSupportAngle(ffloat) != EC_Normal ) {
93  if( point0 ) fstr = point0->GetPatientSupportAngle();
94  }
95  G4cout << " " << " PatientSupportAngle " << ffloat << G4endl;
96 
97  if( cpItem.getPatientSupportRotationDirection(fstr) != EC_Normal ) {
98  if( point0 ) fstr = point0->GetPatientSupportRotationDirection();
99  }
100  G4cout << " " << " PatientSupportRotationDirection " << fstr << G4endl;
102  if( fstr == "CC" ) { // counter-clockwise
103  SetPatientSupportAngle(-ffloat);
104  } else if( fstr == "CW" || fstr == "NONE" || fstr == "") { // clockwise
105  SetPatientSupportAngle(ffloat);
106  }
107 
108  if( cpItem.getTableTopEccentricAngle(ffloat) != EC_Normal ) {
109  if( point0 ) ffloat = point0->GetTableTopEccentricAngle();
110  }
111  G4cout << " " << " TableTopEccentricAngle " << ffloat << G4endl;
112 
113  if( cpItem.getTableTopEccentricRotationDirection(fstr) != EC_Normal ) {
114  if( point0 ) fstr = point0->GetTableTopEccentricRotationDirection();
115  }
116  if( fstr == "CC" ) { // counter-clockwise
117  SetTableTopEccentricAngle(-ffloat);
118  } else if( fstr == "CW" || fstr == "NONE" || fstr == "") { // clockwise
120  }
121  G4cout << " " << " TableTopEccentricRotationDirection " << fstr << G4endl;
123 
124  G4ThreeVector isoCenter;
125  if( cpItem.getIsocenterPosition(fvfloat) != EC_Normal ) {
126  if( point0 ) isoCenter = point0->GetIsocenterPosition();
127  } else {
128  isoCenter = G4ThreeVector(fvfloat[0],fvfloat[1],fvfloat[2]);
129  }
130  G4cout << " " << " IsocenterPosition " << isoCenter << G4endl;
131  SetIsocenterPosition(isoCenter);
132 
133  if( cpItem.getSourceToSurfaceDistance(ffloat) != EC_Normal ) {
134  if( point0 ) ffloat = point0->GetSourceToSurfaceDistance();
135  }
136  G4cout << " " << " SourceToSurfaceDistance " << ffloat << G4endl;
138 
139  cpItem.getCumulativeMetersetWeight(ffloat);
140  G4cout << " " << " CumulativeMetersetWeight " << ffloat << G4endl;
142 
143  if( cpItem.getGantryPitchAngle(ffloat32) != EC_Normal ) {
144  if( point0 ) ffloat32 = point0->GetGantryPitchAngle();
145  }
146  G4cout << " " << " GantryPitchAngle " << ffloat32 << G4endl;
147  SetGantryPitchAngle(ffloat32);
148 
149  if( cpItem.getSurfaceEntryPoint(ffloat) != EC_Normal ) {
150  if( point0 ) ffloat = point0->GetSurfaceEntryPoint();
151  }
152  G4cout << " " << " SurfaceEntryPoint " << ffloat << G4endl;
153  SetSurfaceEntryPoint(ffloat);
154 
155  if( cpItem.getTableTopEccentricAxisDistance(ffloat) != EC_Normal ) {
156  if( point0 ) ffloat = point0->GetTableTopEccentricAxisDistance();
157  }
158  G4cout << " " << " TableTopEccentricAxisDistance " << ffloat << G4endl;
160 
161  if( cpItem.getTableTopLateralPosition(ffloat) != EC_Normal ) {
162  if( point0 ) ffloat = point0->GetTableTopLateralPosition();
163  }
164  G4cout << " " << " TableTopLateralPosition " << ffloat << G4endl;
166 
167  if( cpItem.getTableTopLongitudinalPosition(ffloat) != EC_Normal ) {
168  if( point0 ) ffloat = point0->GetTableTopLongitudinalPosition();
169  }
170  G4cout << " " << " TableTopLongitudinalPosition " << ffloat << G4endl;
172 
173  if( cpItem.getTableTopPitchAngle(ffloat32) != EC_Normal ) {
174  if( point0 ) ffloat32 = point0->GetTableTopPitchAngle();
175  }
176  G4cout << " " << " TableTopPitchAngle " << ffloat32 << G4endl;
177 
178  if( cpItem.getTableTopPitchRotationDirection(fstr) != EC_Normal ) {
179  if( point0 ) fstr = point0->GetTableTopPitchRotationDirection();
180  }
181  if( fstr == "CC" ) { // counter-clockwise
182  SetTableTopPitchAngle(-ffloat32);
183  } else if( fstr == "CW" || fstr == "NONE" || fstr == "") { // clockwise
184  SetTableTopPitchAngle(ffloat32);
185  }
186  G4cout << " " << " TableTopPitchRotationDirection " << fstr << G4endl;
188 
189  if( cpItem.getTableTopRollAngle(ffloat32) != EC_Normal ) {
190  if( point0 ) ffloat32 = point0->GetTableTopRollAngle();
191  }
192  G4cout << " " << " TableTopRollAngle " << ffloat32 << G4endl;
193 
194  if( cpItem.getTableTopRollRotationDirection(fstr) != EC_Normal ) {
195  if( point0 ) fstr = point0->GetTableTopRollRotationDirection();
196  }
197  if( fstr == "CC" ) { // counter-clockwise
198  SetTableTopRollAngle(-ffloat32);
199  } else if( fstr == "CW" || fstr == "NONE" || fstr == "") { // clockwise
200  SetTableTopRollAngle(ffloat32);
201  }
202  G4cout << " " << " TableTopRollRotationDirection " << fstr << G4endl;
204 
205  if( cpItem.getTableTopVerticalPosition(ffloat) != EC_Normal ) {
206  if( point0 ) ffloat = point0->GetTableTopVerticalPosition();
207  }
208  G4cout << " " << " TableTopVerticalPosition " << ffloat << G4endl;
210 
211  // --- get DICOM sequence attributes ---
212  //t DRTWedgePositionSequence &getWedgePositionSequence()
213  //t const DRTWedgePositionSequence &getWedgePositionSequence() const
214 }
215 
216 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
217 void DicomBeamControlPoint::Print( std::ostream& )
218 {
219 
220 }
221 
222 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
223 void DicomBeamControlPoint::DumpToFile( std::ofstream& fout )
224 {
225  fout << ":P ControlPointIndex " << theIndex << G4endl;
226  fout << ":P NominalBeamEnergy " << theNominalBeamEnergy << G4endl;
227  fout << ":P IsocenterPositionX " << theIsocenterPosition.x() << G4endl;
228  fout << ":P IsocenterPositionY " << theIsocenterPosition.y() << G4endl;
229  fout << ":P IsocenterPositionZ " << theIsocenterPosition.z() << G4endl;
230 
231  // std::string iistr = std::to_string(theControlPointIndex);
232  fout << ":P SourceToSurfaceDistance " << theSourceToSurfaceDistance << G4endl;
233  fout << ":P GantryAngle " << theGantryAngle << G4endl;
234  fout << ":P BeamLimitingDeviceAngle " << theBeamLimitingDeviceAngle << G4endl;
235  fout << ":P PatientSupportAngle " << thePatientSupportAngle << G4endl;
236  fout << ":P TableTopEccentricAngle " << theTableTopEccentricAngle << G4endl;
237  fout << ":P SourceToSurfaceDistance " << theSourceToSurfaceDistance<< G4endl;
238  fout << ":P MetersetWeight " << theMetersetWeight<< G4endl;
239  fout << ":P GantryPitchAngle " << theGantryPitchAngle << G4endl;
240  fout << ":P SurfaceEntryPoint " << theSurfaceEntryPoint << G4endl;
241  fout << ":P TableTopEccentricAxisDistance " << theTableTopEccentricAxisDistance << G4endl;
242  fout << ":P TableTopLateralPosition " << theTableTopLateralPosition << G4endl;
243  fout << ":P TableTopLongitudinalPosition " << theTableTopLongitudinalPosition<< G4endl;
244  fout << ":P TableTopPitchAngle " << theTableTopPitchAngle << G4endl;
245  fout << ":P TableTopRollAngle " << theTableTopRollAngle << G4endl;
246  fout << ":P TableTopVerticalPosition " << theTableTopVerticalPosition << G4endl;
247 
248  for( size_t ii = 0; ii < theDevices.size(); ii++ ){
249  theDevices[ii]->DumpToFile(fout);
250  }
251 
252 }
Float64 GetTableTopLongitudinalPosition() const
OFString GetBeamLimitingDeviceRotationDirection() const
void SetTableTopLateralPosition(Float64 dat)
CLHEP::Hep3Vector G4ThreeVector
double x() const
Float64 GetBeamLimitingDeviceAngle() const
Float64 GetSourceToSurfaceDistance() const
void SetSurfaceEntryPoint(Float64 dat)
void SetTableTopRollRotationDirection(OFString dat)
OFString GetTableTopEccentricRotationDirection() const
void SetGantryPitchAngle(Float32 dat)
double z() const
void DumpToFile(std::ofstream &out)
Float64 GetNominalBeamEnergy() const
Float32 GetTableTopRollAngle() const
void SetTableTopPitchAngle(Float32 dat)
G4ThreeVector GetIsocenterPosition() const
G4GLOB_DLL std::ostream G4cout
Float32 GetGantryPitchAngle() const
void SetTableTopVerticalPosition(Float64 dat)
void SetBeamLimitingDeviceRotationDirection(OFString dat)
void SetGantryAngle(Float64 dat)
Float64 GetTableTopEccentricAxisDistance() const
void SetPatientSupportAngle(Float64 dat)
void SetCumulativeMetersetWeight(Float64 dat)
void SetTableTopEccentricRotationDirection(OFString dat)
Float64 GetTableTopVerticalPosition() const
void SetTableTopRollAngle(Float32 dat)
void SetTableTopPitchRotationDirection(OFString dat)
Float64 GetTableTopLateralPosition() const
OFString GetPatientSupportRotationDirection() const
void Print(std::ostream &out)
void SetTableTopLongitudinalPosition(Float64 dat)
Float64 GetTableTopEccentricAngle() const
double y() const
OFString GetTableTopRollRotationDirection() const
void SetPatientSupportRotationDirection(OFString dat)
#define G4endl
Definition: G4ios.hh:61
void SetTableTopEccentricAngle(Float64 dat)
void SetSourceToSurfaceDistance(Float64 dat)
OFString GetTableTopPitchRotationDirection() const
Float32 GetTableTopPitchAngle() const
void AddDevice(DicomBeamDevicePos *dbd)
DicomBeamControlPoint(DRTControlPointSequence::Item cpItem, DicomBeamControlPoint *point0)
void SetTableTopEccentricAxisDistance(Float64 dat)
Float64 GetSurfaceEntryPoint() const
void SetBeamLimitingDeviceAngle(Float64 dat)
void SetNominalBeamEnergy(Float64 dat)
void SetIsocenterPosition(G4ThreeVector dat)
Float64 GetPatientSupportAngle() const