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