Geant4  10.03.p02
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
DicomFileCT_NOdcmrt.hh
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 #ifndef DicomFileCT_NOdcmrt__HH
27 #define DicomFileCT_NOdcmrt__HH
28 
29 #include "DicomVFile.hh"
30 #include "DicomFileMgr.hh"
31 #include "G4ThreeVector.hh"
32 
34 {
35 public:
37  DicomFileCT_NOdcmrt(DcmDataset* dset);
39 
40 public:
41  virtual void ReadData();
42 
43  void operator+=( const DicomFileCT_NOdcmrt& rhs );
45  // add two slices that have the same dimensions, merging them in Z
46 
47  void BuildMaterials();
48  void DumpHeaderToTextFile(std::ofstream& fout);
49  void DumpMateIDsToTextFile(std::ofstream& fout);
50  void DumpDensitiesToTextFile(std::ofstream& fout);
51  void BuildStructureIDs();
52  void DumpStructureIDsToTextFile(std::ofstream& fout);
53 
54  // Get and set methods
55  G4int GetNoVoxelX() const { return fNoVoxelX; };
56  G4int GetNoVoxelY() const { return fNoVoxelY; };
57  G4int GetNoVoxelZ() const { return fNoVoxelZ; };
58  G4int GetNoVoxels() const { return fNoVoxelX*fNoVoxelY*fNoVoxelZ; };
59 
60  G4double GetMinX() const { return fMinX; };
61  G4double GetMinY() const { return fMinY; };
62  G4double GetMinZ() const { return fMinZ; };
63  G4double GetMaxX() const { return fMaxX; };
64  G4double GetMaxY() const { return fMaxY; };
65  G4double GetMaxZ() const { return fMaxZ; };
66 
67  void SetNoVoxelX(const G4int& val) { fNoVoxelX = val; }
68  void SetNoVoxelY(const G4int& val) { fNoVoxelY = val; }
69  void SetNoVoxelZ(const G4int& val) { fNoVoxelZ = val; }
70 
71  void SetMinX(const G4double& val) { fMinX = val; };
72  void SetMaxX(const G4double& val) { fMaxX = val; };
73  void SetMinY(const G4double& val) { fMinY = val; };
74  void SetMaxY(const G4double& val) { fMaxY = val; };
75  void SetMinZ(const G4double& val) { fMinZ = val; };
76  void SetMaxZ(const G4double& val) { fMaxZ = val; };
77 
78  const G4double& GetLocation() const { return fLocation; }
79 
80  void SetLocation(const G4double& val) { fLocation = val; }
81 
82  G4ThreeVector GetOrientationRows() const { return fOrientationRows; }
83  G4ThreeVector GetOrientationColumns() const { return fOrientationColumns; }
84 
85  void DumpToTextFile();
86  void DumpToBinaryFile();
87 
88  void ReadDataFromFile();
89 
90 private:
91  template <typename T> inline bool CheckConsistency(const T&, const T&, G4String);
92 
93  void ReadPixelData();
94  void Print( std::ostream& out );
95 
96 private:
97  G4double fLocation;
98  G4double fBitAllocated;
99  G4double fRescaleSlope;
100  G4double fRescaleIntercept;
101 
102  G4int fNoVoxelX, fNoVoxelY, fNoVoxelZ; // number of voxels in each dimensions
103  G4double fMinX,fMinY,fMinZ; // minimum extension of voxels (position of wall)
104  G4double fMaxX,fMaxY,fMaxZ; // maximum extension of voxels (position of wall)
105  G4double fVoxelDimX,fVoxelDimY,fVoxelDimZ; // maximum extension of voxels (position of wall)
106 
107  G4ThreeVector fOrientationRows;
108  G4ThreeVector fOrientationColumns;
109 
110  std::vector<int> fHounsfieldV;
111  std::vector<size_t> fMateIDs;
112  std::vector<G4double> fDensities;
113  std::vector<G4int> fStructure;
114  // G4int* fStructure;
115 
116  DicomFileMgr* theFileMgr;
117 };
118 
119 //============================================================================
120 template <typename T>
121 inline bool DicomFileCT_NOdcmrt::CheckConsistency(const T& val1, const T& val2,
122  G4String category) {
123  if(val1 != val2) {
124  G4Exception("DicomFileCT_NOdcmrtr::CheckConsistency",
125  "Consistency Mismatch : Keeping previous value if nonzero",
126  JustWarning, category.c_str());
127  return false;
128  }
129  return true;
130 }
131 
132 #endif
void DumpStructureIDsToTextFile(std::ofstream &fout)
G4ThreeVector GetOrientationColumns() const
const G4double & GetLocation() const
G4int GetNoVoxels() const
G4double GetMaxZ() const
void DumpMateIDsToTextFile(std::ofstream &fout)
int G4int
Definition: G4Types.hh:78
void SetLocation(const G4double &val)
G4double GetMaxX() const
void SetMinX(const G4double &val)
void SetMaxX(const G4double &val)
G4int GetNoVoxelZ() const
G4double GetMaxY() const
void SetMaxZ(const G4double &val)
G4double GetMinZ() const
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41
G4int GetNoVoxelX() const
G4double GetMinX() const
void SetNoVoxelX(const G4int &val)
void SetMinY(const G4double &val)
G4double GetMinY() const
virtual void ReadData()
void DumpDensitiesToTextFile(std::ofstream &fout)
G4ThreeVector GetOrientationRows() const
void operator+=(const DicomFileCT_NOdcmrt &rhs)
void SetNoVoxelY(const G4int &val)
DicomFileCT_NOdcmrt operator+(const DicomFileCT_NOdcmrt &rhs)
void SetNoVoxelZ(const G4int &val)
double G4double
Definition: G4Types.hh:76
void SetMinZ(const G4double &val)
G4int GetNoVoxelY() const
void DumpHeaderToTextFile(std::ofstream &fout)
void SetMaxY(const G4double &val)