Geant4 Cross Reference |
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 #ifndef DicomVFileImage__HH 27 #define DicomVFileImage__HH 28 29 #include "DicomFileMgr.hh" 30 #include "DicomVFile.hh" 31 32 #include "G4ThreeVector.hh" 33 34 class DicomVFileImage : public DicomVFile 35 { 36 public: 37 DicomVFileImage(); 38 DicomVFileImage(DcmDataset* dset); 39 ~DicomVFileImage() {}; 40 41 public: 42 virtual void ReadData(); 43 44 void operator+=(const DicomVFileImage& rhs); 45 DicomVFileImage operator+(const DicomVFileImage& rhs); 46 // add two slices that have the same dimensions, merging them in Z 47 48 void DumpHeaderToTextFile(std::ofstream& fout); 49 50 // Get and set methods 51 G4int GetNoVoxelsX() const { return fNoVoxelsX; }; 52 G4int GetNoVoxelsY() const { return fNoVoxelsY; }; 53 G4int GetNoVoxelsZ() const { return fNoVoxelsZ; }; 54 G4int GetNoVoxels() const { return fNoVoxelsX * fNoVoxelsY * fNoVoxelsZ; }; 55 56 G4double GetMinX() const { return fMinX; }; 57 G4double GetMinY() const { return fMinY; }; 58 G4double GetMinZ() const { return fMinZ; }; 59 G4double GetMaxX() const { return fMaxX; }; 60 G4double GetMaxY() const { return fMaxY; }; 61 G4double GetMaxZ() const { return fMaxZ; }; 62 63 void SetNoVoxelsX(const G4int& val) { fNoVoxelsX = val; } 64 void SetNoVoxelsY(const G4int& val) { fNoVoxelsY = val; } 65 void SetNoVoxelsZ(const G4int& val) { fNoVoxelsZ = val; } 66 67 void SetMinX(const G4double& val) { fMinX = val; }; 68 void SetMaxX(const G4double& val) { fMaxX = val; }; 69 void SetMinY(const G4double& val) { fMinY = val; }; 70 void SetMaxY(const G4double& val) { fMaxY = val; }; 71 void SetMinZ(const G4double& val) { fMinZ = val; }; 72 void SetMaxZ(const G4double& val) { fMaxZ = val; }; 73 74 const G4double& GetLocation() const { return fLocation; } 75 76 void SetLocation(const G4double& val) { fLocation = val; } 77 78 G4ThreeVector GetOrientationRows() const { return fOrientationRows; } 79 G4ThreeVector GetOrientationColumns() const { return fOrientationColumns; } 80 81 private: 82 template<typename T> 83 inline bool CheckConsistency(const T&, const T&, G4String); 84 85 void ReadPixelData(); 86 void Print(std::ostream& out); 87 88 protected: 89 G4double fLocation; 90 G4double fBitAllocated; 91 G4double fRescaleSlope; 92 G4double fRescaleIntercept; 93 94 G4int fNoVoxelsX, fNoVoxelsY, fNoVoxelsZ; // number of voxels in each dimensions 95 G4double fMinX, fMinY, fMinZ; // minimum extension of voxels (position of wall) 96 G4double fMaxX, fMaxY, fMaxZ; // maximum extension of voxels (position of wall) 97 G4double fVoxelDimX, fVoxelDimY, fVoxelDimZ; // maximum extension of voxels (position of wall) 98 99 G4ThreeVector fOrientationRows; 100 G4ThreeVector fOrientationColumns; 101 102 std::vector<int> fHounsfieldV; 103 104 DicomFileMgr* theFileMgr; 105 }; 106 107 //============================================================================ 108 template<typename T> 109 inline bool DicomVFileImage::CheckConsistency(const T& val1, const T& val2, G4String category) 110 { 111 if (val1 != val2) { 112 G4Exception("DicomVFileImager::CheckConsistency", 113 "Consistency Mismatch : Keeping previous value if nonzero", JustWarning, 114 category.c_str()); 115 return false; 116 } 117 return true; 118 } 119 120 #endif 121