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 #ifndef DicomFileCT_NOdcmrt__HH
0027 #define DicomFileCT_NOdcmrt__HH
0028
0029 #include "DicomFileMgr.hh"
0030 #include "DicomVFile.hh"
0031
0032 #include "G4ThreeVector.hh"
0033
0034 class DicomFileCT_NOdcmrt : public DicomVFile
0035 {
0036 public:
0037 DicomFileCT_NOdcmrt();
0038 DicomFileCT_NOdcmrt(DcmDataset* dset);
0039 ~DicomFileCT_NOdcmrt() {};
0040
0041 public:
0042 virtual void ReadData();
0043
0044 void operator+=(const DicomFileCT_NOdcmrt& rhs);
0045 DicomFileCT_NOdcmrt operator+(const DicomFileCT_NOdcmrt& rhs);
0046
0047
0048 void BuildMaterials();
0049 void DumpHeaderToTextFile(std::ofstream& fout);
0050 void DumpMateIDsToTextFile(std::ofstream& fout);
0051 void DumpDensitiesToTextFile(std::ofstream& fout);
0052 void BuildStructureIDs();
0053 void DumpStructureIDsToTextFile(std::ofstream& fout);
0054
0055
0056 G4int GetNoVoxelsX() const { return fNoVoxelsX; };
0057 G4int GetNoVoxelsY() const { return fNoVoxelsY; };
0058 G4int GetNoVoxelsZ() const { return fNoVoxelsZ; };
0059 G4int GetNoVoxels() const { return fNoVoxelsX * fNoVoxelsY * fNoVoxelsZ; };
0060
0061 G4double GetMinX() const { return fMinX; };
0062 G4double GetMinY() const { return fMinY; };
0063 G4double GetMinZ() const { return fMinZ; };
0064 G4double GetMaxX() const { return fMaxX; };
0065 G4double GetMaxY() const { return fMaxY; };
0066 G4double GetMaxZ() const { return fMaxZ; };
0067
0068 void SetNoVoxelsX(const G4int& val) { fNoVoxelsX = val; }
0069 void SetNoVoxelsY(const G4int& val) { fNoVoxelsY = val; }
0070 void SetNoVoxelsZ(const G4int& val) { fNoVoxelsZ = val; }
0071
0072 void SetMinX(const G4double& val) { fMinX = val; };
0073 void SetMaxX(const G4double& val) { fMaxX = val; };
0074 void SetMinY(const G4double& val) { fMinY = val; };
0075 void SetMaxY(const G4double& val) { fMaxY = val; };
0076 void SetMinZ(const G4double& val) { fMinZ = val; };
0077 void SetMaxZ(const G4double& val) { fMaxZ = val; };
0078
0079 const G4double& GetLocation() const { return fLocation; }
0080
0081 void SetLocation(const G4double& val) { fLocation = val; }
0082
0083 G4ThreeVector GetOrientationRows() const { return fOrientationRows; }
0084 G4ThreeVector GetOrientationColumns() const { return fOrientationColumns; }
0085
0086 void DumpToTextFile();
0087 void DumpToBinaryFile();
0088
0089 void ReadDataFromFile();
0090
0091 private:
0092 template<typename T>
0093 inline bool CheckConsistency(const T&, const T&, G4String);
0094
0095 void ReadPixelData();
0096 void Print(std::ostream& out);
0097
0098 private:
0099 G4double fLocation;
0100 G4double fBitAllocated;
0101 G4double fRescaleSlope;
0102 G4double fRescaleIntercept;
0103
0104 G4int fNoVoxelsX, fNoVoxelsY, fNoVoxelsZ;
0105 G4double fMinX, fMinY, fMinZ;
0106 G4double fMaxX, fMaxY, fMaxZ;
0107 G4double fVoxelDimX, fVoxelDimY, fVoxelDimZ;
0108
0109 G4ThreeVector fOrientationRows;
0110 G4ThreeVector fOrientationColumns;
0111
0112 std::vector<int> fHounsfieldV;
0113 std::vector<size_t> fMateIDs;
0114 std::vector<G4double> fDensities;
0115 std::vector<G4int> fStructure;
0116
0117
0118 DicomFileMgr* theFileMgr;
0119 };
0120
0121
0122 template<typename T>
0123 inline bool DicomFileCT_NOdcmrt::CheckConsistency(const T& val1, const T& val2, G4String category)
0124 {
0125 if (val1 != val2) {
0126 G4Exception("DicomFileCT_NOdcmrtr::CheckConsistency",
0127 "Consistency Mismatch : Keeping previous value if nonzero", JustWarning,
0128 category.c_str());
0129 return false;
0130 }
0131 return true;
0132 }
0133
0134 #endif