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 "DicomBeamCompensator.hh"
0027
0028 #include "dcmtk/dcmrt/seq/drtcos.h"
0029
0030 #include "G4UIcommand.hh"
0031
0032
0033
0034 DicomBeamCompensator::DicomBeamCompensator(DRTCompensatorSequence::Item bcompItem)
0035 {
0036 OFString fstr;
0037 Sint32 fint;
0038 Float64 ffloat;
0039 OFVector<Float64> fvfloat;
0040 OFCondition cond;
0041 G4cout << " DicomBeamCompensator::DicomBeamCompensator " << G4endl;
0042 cond = bcompItem.getCompensatorNumber(fint);
0043 theCompensatorNumber = fint;
0044 G4cout << " Number " << fint << G4endl;
0045
0046 cond = bcompItem.getCompensatorColumns(fint);
0047 theCompensatorColumns = fint;
0048 cond = bcompItem.getCompensatorRows(fint);
0049 theCompensatorRows = fint;
0050
0051
0052 cond = bcompItem.getCompensatorPixelSpacing(fvfloat);
0053 theCompensatorPixelSpacing = fvfloat;
0054
0055 cond = bcompItem.getCompensatorPosition(fvfloat);
0056 theCompensatorPosition = fvfloat;
0057
0058 cond = bcompItem.getCompensatorTransmissionData(fvfloat);
0059 if (cond.good()) theCompensatorTransmissionData = fvfloat;
0060 cond = bcompItem.getCompensatorThicknessData(fvfloat);
0061 if (cond.good()) theCompensatorThicknessData = fvfloat;
0062
0063 cond = bcompItem.getCompensatorTrayID(fstr);
0064 cond = bcompItem.getCompensatorType(fstr);
0065
0066 cond = bcompItem.getMaterialID(fstr);
0067 if (cond.good()) theMaterialID = fstr;
0068 cond = bcompItem.getSourceToCompensatorDistance(fvfloat);
0069 if (cond.good()) theSourceToCompensatorDistance = fvfloat;
0070 cond = bcompItem.getSourceToCompensatorTrayDistance(ffloat);
0071 theSourceToCompensatorTrayDistance = ffloat;
0072
0073 cond = bcompItem.getCompensatorDescription(fstr);
0074 cond = bcompItem.getCompensatorDivergence(fstr);
0075 cond = bcompItem.getCompensatorID(fstr);
0076 cond = bcompItem.getCompensatorMountingPosition(fstr);
0077 cond = bcompItem.getAccessoryCode(fstr);
0078 }
0079
0080
0081 void DicomBeamCompensator::Print(std::ostream&) {}
0082
0083
0084 void DicomBeamCompensator::DumpToFile(std::ofstream& fout)
0085 {
0086 std::string name = ":P COMP_" + G4UIcommand::ConvertToString(theCompensatorNumber) + "_";
0087 fout << name << "PixelSpacing_1 " << theCompensatorPixelSpacing[0] << G4endl;
0088 fout << name << "PixelSpacing_2 " << theCompensatorPixelSpacing[1] << G4endl;
0089
0090 fout << name << "POSX " << theCompensatorPosition[0] << G4endl;
0091 fout << name << "POSY " << theCompensatorPosition[1] << G4endl;
0092
0093 fout << name << "SourceToCompensatorTrayDistance " << theSourceToCompensatorTrayDistance
0094 << G4endl;
0095
0096 for (size_t ii = 0; ii < theSourceToCompensatorDistance.size(); ii++) {
0097 int iCol = ii % theCompensatorColumns;
0098 int iRow = ii / theCompensatorColumns;
0099 fout << name
0100 << "SourceToCompensatorDistance_" + G4UIcommand::ConvertToString(iRow) + "_"
0101 + G4UIcommand::ConvertToString(iCol)
0102 << " " << theSourceToCompensatorDistance[ii] << G4endl;
0103 }
0104
0105
0106
0107
0108
0109
0110
0111
0112
0113
0114
0115
0116
0117
0118
0119 }