Loading...
Searching...
No Matches
Public Member Functions | Private Member Functions | Private Attributes | List of all members
DicomPhantomZSliceHeader Class Reference

DicomPhantomZSliceHeader class. More...

#include <Doxymodules_medical.h>

Public Member Functions

 DicomPhantomZSliceHeader (const G4String &)
 
 DicomPhantomZSliceHeader (const DicomPhantomZSliceHeader &)=default
 
 DicomPhantomZSliceHeader (std::ifstream &fin)
 
 ~DicomPhantomZSliceHeader ()
 
G4int GetNoVoxelsX () const
 
G4int GetNoVoxelsY () const
 
G4int GetNoVoxelsZ () const
 
G4int GetNoVoxels () const
 
G4double GetMinX () const
 
G4double GetMinY () const
 
G4double GetMinZ () const
 
G4double GetMaxX () const
 
G4double GetMaxY () const
 
G4double GetMaxZ () const
 
G4double GetVoxelHalfX () const
 
G4double GetVoxelHalfY () const
 
G4double GetVoxelHalfZ () const
 
const std::vector< G4String > & GetMaterialNames () const
 
void SetNoVoxelsX (const G4int &val)
 
void SetNoVoxelsY (const G4int &val)
 
void SetNoVoxelsZ (const G4int &val)
 
void SetMinX (const G4double &val)
 
void SetMaxX (const G4double &val)
 
void SetMinY (const G4double &val)
 
void SetMaxY (const G4double &val)
 
void SetMinZ (const G4double &val)
 
void SetMaxZ (const G4double &val)
 
void SetMaterialNames (std::vector< G4String > &mn)
 
void operator+= (const DicomPhantomZSliceHeader &rhs)
 
DicomPhantomZSliceHeader operator+ (const DicomPhantomZSliceHeader &rhs)
 
void SetFilename (const G4String &val)
 
void SetSliceLocation (const G4double &val)
 
void AddMaterial (const G4String &val)
 
const G4double & GetSliceLocation () const
 
void AddRow ()
 
void AddValue (G4double val)
 
void AddValue (const std::vector< G4double > &val)
 
void AddValue (const std::vector< std::vector< G4double > > &val)
 
void AddMateID (G4int val)
 
void AddMateID (const std::vector< G4int > &val)
 
void AddMateID (const std::vector< std::vector< G4int > > &val)
 
const std::vector< std::vector< G4double > > & GetValues () const
 
const std::vector< std::vector< G4int > > & GetMateIDs () const
 
void DumpToFile ()
 
void ReadDataFromFile ()
 
void DumpExcessMemory ()
 
void FlipData ()
 

Private Member Functions

G4bool IsInteger (const G4String &)
 
template<typename T >
void Print (std::ostream &, const std::vector< T > &, const G4String &, G4int breakLine=-1)
 
template<typename T >
G4s2n (const G4String &)
 
template<typename T >
bool CheckConsistency (const T &, const T &, G4String)
 
G4bool CheckMaterialExists (const G4String &mateName)
 

Private Attributes

G4int fNoVoxelsX
 
G4int fNoVoxelsY
 
G4int fNoVoxelsZ
 
G4double fMinX
 
G4double fMinY
 
G4double fMinZ
 
G4double fMaxX
 
G4double fMaxY
 
G4double fMaxZ
 
std::vector< G4StringfMaterialNames
 
G4String fFilename
 
std::vector< std::vector< G4double > > fValues
 
std::vector< std::vector< G4int > > fMateIDs
 
G4double fSliceLocation
 

Detailed Description

DicomPhantomZSliceHeader class.

Contains the meta data information corresponding to one or several Z slices (number of voxels, dimension)

History: 30.11.07 First version

Author
P. Arce

Definition at line 27 of file Doxymodules_medical.h.

Constructor & Destructor Documentation

◆ DicomPhantomZSliceHeader() [1/3]

DicomPhantomZSliceHeader::DicomPhantomZSliceHeader ( const G4String fname)

◆ DicomPhantomZSliceHeader() [2/3]

DicomPhantomZSliceHeader::DicomPhantomZSliceHeader ( const DicomPhantomZSliceHeader )
default

◆ DicomPhantomZSliceHeader() [3/3]

DicomPhantomZSliceHeader::DicomPhantomZSliceHeader ( std::ifstream &  fin)

Definition at line 57 of file DicomPhantomZSliceHeader.cc.

58{
59 //----- Read material indices and names
60 G4int nmate;
61 G4String mateindex;
62 G4String matename;
63 fin >> nmate;
64#ifdef G4VERBOSE
65 G4cout << " DicomPhantomZSliceHeader reading number of materials "
66 << nmate << G4endl;
67#endif
68
69 for( G4int im = 0; im < nmate; im++ ){
70 fin >> mateindex >> matename;
71#ifdef G4VERBOSE
72 //G4cout << " DicomPhantomZSliceHeader reading material "
73 // << im << " : "<< mateindex << " " << matename << G4endl;
74#endif
75
76 if( ! CheckMaterialExists( matename ) ) {
77 G4Exception("DicomPhantomZSliceHeader::DicomPhantomZSliceHeader",
78 "A material is found in file that is not built in the C++ code",
79 FatalErrorInArgument, matename.c_str());
80 }
81
82 fMaterialNames.push_back(matename);
83 }
84
85 //----- Read number of voxels
86 fin >> fNoVoxelsX >> fNoVoxelsY >> fNoVoxelsZ;
87#ifdef G4VERBOSE
88 G4cout << " Number of voxels " << fNoVoxelsX << " " << fNoVoxelsY
89 << " " << fNoVoxelsZ << G4endl;
90#endif
91
92 //----- Read minimal and maximal extensions (= walls of phantom)
93 fin >> fMinX >> fMaxX;
94 fin >> fMinY >> fMaxY;
95 fin >> fMinZ >> fMaxZ;
96#ifdef G4VERBOSE
97 G4cout << " Extension in X " << fMinX << " " << fMaxX << G4endl
98 << " Extension in Y " << fMinY << " " << fMaxY << G4endl
99 << " Extension in Z " << fMinZ << " " << fMaxZ << G4endl;
100#endif
101
102 fSliceLocation = 0.5*(fMinZ + fMaxZ);
103}
G4bool CheckMaterialExists(const G4String &mateName)
std::vector< G4String > fMaterialNames

◆ ~DicomPhantomZSliceHeader()

DicomPhantomZSliceHeader::~DicomPhantomZSliceHeader ( )

Definition at line 51 of file DicomPhantomZSliceHeader.cc.

52{
53
54}

Member Function Documentation

◆ GetNoVoxelsX()

G4int DicomPhantomZSliceHeader::GetNoVoxelsX ( ) const
inline

Definition at line 64 of file DicomPhantomZSliceHeader.hh.

64{ return fNoVoxelsX; };

◆ GetNoVoxelsY()

G4int DicomPhantomZSliceHeader::GetNoVoxelsY ( ) const
inline

Definition at line 65 of file DicomPhantomZSliceHeader.hh.

65{ return fNoVoxelsY; };

◆ GetNoVoxelsZ()

G4int DicomPhantomZSliceHeader::GetNoVoxelsZ ( ) const
inline

Definition at line 66 of file DicomPhantomZSliceHeader.hh.

66{ return fNoVoxelsZ; };

◆ GetNoVoxels()

G4int DicomPhantomZSliceHeader::GetNoVoxels ( ) const
inline

Definition at line 67 of file DicomPhantomZSliceHeader.hh.

◆ GetMinX()

G4double DicomPhantomZSliceHeader::GetMinX ( ) const
inline

Definition at line 69 of file DicomPhantomZSliceHeader.hh.

69{ return fMinX; };

◆ GetMinY()

G4double DicomPhantomZSliceHeader::GetMinY ( ) const
inline

Definition at line 70 of file DicomPhantomZSliceHeader.hh.

70{ return fMinY; };

◆ GetMinZ()

G4double DicomPhantomZSliceHeader::GetMinZ ( ) const
inline

Definition at line 71 of file DicomPhantomZSliceHeader.hh.

71{ return fMinZ; };

◆ GetMaxX()

G4double DicomPhantomZSliceHeader::GetMaxX ( ) const
inline

Definition at line 72 of file DicomPhantomZSliceHeader.hh.

72{ return fMaxX; };

◆ GetMaxY()

G4double DicomPhantomZSliceHeader::GetMaxY ( ) const
inline

Definition at line 73 of file DicomPhantomZSliceHeader.hh.

73{ return fMaxY; };

◆ GetMaxZ()

G4double DicomPhantomZSliceHeader::GetMaxZ ( ) const
inline

Definition at line 74 of file DicomPhantomZSliceHeader.hh.

74{ return fMaxZ; };

◆ GetVoxelHalfX()

G4double DicomPhantomZSliceHeader::GetVoxelHalfX ( ) const
inline

Definition at line 76 of file DicomPhantomZSliceHeader.hh.

76{ return (fMaxX-fMinX)/fNoVoxelsX/2.; };

◆ GetVoxelHalfY()

G4double DicomPhantomZSliceHeader::GetVoxelHalfY ( ) const
inline

Definition at line 77 of file DicomPhantomZSliceHeader.hh.

77{ return (fMaxY-fMinY)/fNoVoxelsY/2.; };

◆ GetVoxelHalfZ()

G4double DicomPhantomZSliceHeader::GetVoxelHalfZ ( ) const
inline

Definition at line 78 of file DicomPhantomZSliceHeader.hh.

78{ return (fMaxZ-fMinZ)/fNoVoxelsZ/2.; };

◆ GetMaterialNames()

const std::vector< G4String > & DicomPhantomZSliceHeader::GetMaterialNames ( ) const
inline

Definition at line 80 of file DicomPhantomZSliceHeader.hh.

80{ return fMaterialNames; };

◆ SetNoVoxelsX()

void DicomPhantomZSliceHeader::SetNoVoxelsX ( const G4int &  val)
inline

Definition at line 82 of file DicomPhantomZSliceHeader.hh.

82{ fNoVoxelsX = val; }

◆ SetNoVoxelsY()

void DicomPhantomZSliceHeader::SetNoVoxelsY ( const G4int &  val)
inline

Definition at line 83 of file DicomPhantomZSliceHeader.hh.

83{ fNoVoxelsY = val; }

◆ SetNoVoxelsZ()

void DicomPhantomZSliceHeader::SetNoVoxelsZ ( const G4int &  val)
inline

Definition at line 84 of file DicomPhantomZSliceHeader.hh.

84{ fNoVoxelsZ = val; }

◆ SetMinX()

void DicomPhantomZSliceHeader::SetMinX ( const G4double &  val)
inline

Definition at line 86 of file DicomPhantomZSliceHeader.hh.

86{ fMinX = val; };

◆ SetMaxX()

void DicomPhantomZSliceHeader::SetMaxX ( const G4double &  val)
inline

Definition at line 87 of file DicomPhantomZSliceHeader.hh.

87{ fMaxX = val; };

◆ SetMinY()

void DicomPhantomZSliceHeader::SetMinY ( const G4double &  val)
inline

Definition at line 88 of file DicomPhantomZSliceHeader.hh.

88{ fMinY = val; };

◆ SetMaxY()

void DicomPhantomZSliceHeader::SetMaxY ( const G4double &  val)
inline

Definition at line 89 of file DicomPhantomZSliceHeader.hh.

89{ fMaxY = val; };

◆ SetMinZ()

void DicomPhantomZSliceHeader::SetMinZ ( const G4double &  val)
inline

Definition at line 90 of file DicomPhantomZSliceHeader.hh.

90{ fMinZ = val; };

◆ SetMaxZ()

void DicomPhantomZSliceHeader::SetMaxZ ( const G4double &  val)
inline

Definition at line 91 of file DicomPhantomZSliceHeader.hh.

91{ fMaxZ = val; };

◆ SetMaterialNames()

void DicomPhantomZSliceHeader::SetMaterialNames ( std::vector< G4String > &  mn)
inline

Definition at line 93 of file DicomPhantomZSliceHeader.hh.

93{ fMaterialNames = mn; }

◆ operator+=()

void DicomPhantomZSliceHeader::operator+= ( const DicomPhantomZSliceHeader rhs)

Definition at line 124 of file DicomPhantomZSliceHeader.cc.

125{
126 *this = *this + rhs;
127}

◆ operator+()

DicomPhantomZSliceHeader DicomPhantomZSliceHeader::operator+ ( const DicomPhantomZSliceHeader rhs)

Definition at line 130 of file DicomPhantomZSliceHeader.cc.

132{
133 //----- Check that both slices has the same dimensions
134 if( fNoVoxelsX != rhs.GetNoVoxelsX()
135 || fNoVoxelsY != rhs.GetNoVoxelsY() ) {
136 G4cerr << "DicomPhantomZSliceHeader error adding two slice headers:\
137 !!! Different number of voxels: "
138 << " X= " << fNoVoxelsX << " =? " << rhs.GetNoVoxelsX()
139 << " Y= " << fNoVoxelsY << " =? " << rhs.GetNoVoxelsY()
140 << " Z= " << fNoVoxelsZ << " =? " << rhs.GetNoVoxelsZ()
141 << G4endl;
142 G4Exception("DicomPhantomZSliceHeader::DicomPhantomZSliceHeader",
143 "",FatalErrorInArgument,"");
144 }
145 //----- Check that both slices has the same extensions
146 if( fMinX != rhs.GetMinX() || fMaxX != rhs.GetMaxX()
147 || fMinY != rhs.GetMinY() || fMaxY != rhs.GetMaxY() ) {
148 G4cerr << "DicomPhantomZSliceHeader error adding two slice headers:\
149 !!! Different extensions: "
150 << " Xmin= " << fMinX << " =? " << rhs.GetMinX()
151 << " Xmax= " << fMaxX << " =? " << rhs.GetMaxX()
152 << " Ymin= " << fMinY << " =? " << rhs.GetMinY()
153 << " Ymax= " << fMaxY << " =? " << rhs.GetMaxY()
154 << G4endl;
155 G4Exception("DicomPhantomZSliceHeader::operator+","",
156 FatalErrorInArgument,"");
157 }
158
159 //----- Check that both slices have the same materials
160 std::vector<G4String> fMaterialNames2 = rhs.GetMaterialNames();
161 if( fMaterialNames.size() != fMaterialNames2.size() ) {
162 G4cerr << "DicomPhantomZSliceHeader error adding two slice headers:\
163 !!! Different number of materials: " << fMaterialNames.size() << " =? "
164 << fMaterialNames2.size() << G4endl;
165 G4Exception("DicomPhantomZSliceHeader::operator+","",
166 FatalErrorInArgument,"");
167 }
168 for( unsigned int ii = 0; ii < fMaterialNames.size(); ii++ ) {
169 if( fMaterialNames[ii] != fMaterialNames2[ii] ) {
170 G4cerr << "DicomPhantomZSliceHeader error adding two slice headers:\
171 !!! Different material number " << ii << " : "
172 << fMaterialNames[ii] << " =? "
173 << fMaterialNames2[ii] << G4endl;
174 G4Exception("DicomPhantomZSliceHeader::operator+","",
175 FatalErrorInArgument,"");
176 }
177 }
178
179 //----- Check that the slices are contiguous in Z
180 if( std::fabs( fMinZ - rhs.GetMaxZ() ) >
181 G4GeometryTolerance::GetInstance()->GetRadialTolerance() &&
182 std::fabs( fMaxZ - rhs.GetMinZ() ) >
183 G4GeometryTolerance::GetInstance()->GetRadialTolerance() ){
184 G4cerr << "DicomPhantomZSliceHeader error adding two slice headers:!!!\
185 Slices are not contiguous in Z "
186 << " Zmin= " << fMinZ << " & " << rhs.GetMinZ()
187 << " Zmax= " << fMaxZ << " & " << rhs.GetMaxZ()
188 << G4endl;
189 G4Exception("DicomPhantomZSliceHeader::operator+","",
190 FatalErrorInArgument,"");
191 }
192
193 //----- Build slice header copying first one
194 DicomPhantomZSliceHeader temp( *this );
195
196 //----- Add data from second slice header
197 temp.SetMinZ( std::min( fMinZ, rhs.GetMinZ() ) );
198 temp.SetMaxZ( std::max( fMaxZ, rhs.GetMaxZ() ) );
199 temp.SetNoVoxelsZ( fNoVoxelsZ + rhs.GetNoVoxelsZ() );
200
201 return temp;
202}
DicomPhantomZSliceHeader class.
const std::vector< G4String > & GetMaterialNames() const

◆ SetFilename()

void DicomPhantomZSliceHeader::SetFilename ( const G4String val)
inline

Definition at line 113 of file DicomPhantomZSliceHeader.hh.

113{ fFilename = val; }

◆ SetSliceLocation()

void DicomPhantomZSliceHeader::SetSliceLocation ( const G4double &  val)
inline

Definition at line 114 of file DicomPhantomZSliceHeader.hh.

114{ fSliceLocation = val; }

◆ AddMaterial()

void DicomPhantomZSliceHeader::AddMaterial ( const G4String val)
inline

Definition at line 115 of file DicomPhantomZSliceHeader.hh.

115{ fMaterialNames.push_back(val); }

◆ GetSliceLocation()

const G4double & DicomPhantomZSliceHeader::GetSliceLocation ( ) const
inline

Definition at line 117 of file DicomPhantomZSliceHeader.hh.

117{ return fSliceLocation; }

◆ AddRow()

void DicomPhantomZSliceHeader::AddRow ( )
inline

Definition at line 119 of file DicomPhantomZSliceHeader.hh.

119 { fValues.push_back(std::vector<G4double>(0));
120 fMateIDs.push_back(std::vector<G4int>(0)); }
std::vector< std::vector< G4int > > fMateIDs
std::vector< std::vector< G4double > > fValues

◆ AddValue() [1/3]

void DicomPhantomZSliceHeader::AddValue ( G4double  val)
inline

Definition at line 122 of file DicomPhantomZSliceHeader.hh.

122 { (fValues.size() > 0) ?
123 fValues.back().push_back(val) :
124 fValues.push_back(std::vector<G4double>(1,val)); }

◆ AddValue() [2/3]

void DicomPhantomZSliceHeader::AddValue ( const std::vector< G4double > &  val)
inline

Definition at line 125 of file DicomPhantomZSliceHeader.hh.

125{ fValues.push_back(val); }

◆ AddValue() [3/3]

void DicomPhantomZSliceHeader::AddValue ( const std::vector< std::vector< G4double > > &  val)
inline

Definition at line 126 of file DicomPhantomZSliceHeader.hh.

126 {
127 for(unsigned int i = 0; i < val.size(); ++i) { fValues.push_back(val.at(i)); }
128 }

◆ AddMateID() [1/3]

void DicomPhantomZSliceHeader::AddMateID ( G4int  val)
inline

Definition at line 130 of file DicomPhantomZSliceHeader.hh.

130 { (fMateIDs.size() > 0) ?
131 fMateIDs.back().push_back(val) :
132 fMateIDs.push_back(std::vector<G4int>(1,val)); }

◆ AddMateID() [2/3]

void DicomPhantomZSliceHeader::AddMateID ( const std::vector< G4int > &  val)
inline

Definition at line 133 of file DicomPhantomZSliceHeader.hh.

133{ fMateIDs.push_back(val); }

◆ AddMateID() [3/3]

void DicomPhantomZSliceHeader::AddMateID ( const std::vector< std::vector< G4int > > &  val)
inline

Definition at line 134 of file DicomPhantomZSliceHeader.hh.

134 {
135 for(unsigned int i = 0; i < val.size(); ++i) { fMateIDs.push_back(val.at(i)); }
136 }

◆ GetValues()

const std::vector< std::vector< G4double > > & DicomPhantomZSliceHeader::GetValues ( ) const
inline

Definition at line 138 of file DicomPhantomZSliceHeader.hh.

138{ return fValues; }

◆ GetMateIDs()

const std::vector< std::vector< G4int > > & DicomPhantomZSliceHeader::GetMateIDs ( ) const
inline

Definition at line 139 of file DicomPhantomZSliceHeader.hh.

139{ return fMateIDs; }

◆ DumpToFile()

void DicomPhantomZSliceHeader::DumpToFile ( )

Definition at line 205 of file DicomPhantomZSliceHeader.cc.

206{
207
208 G4cout << "DicomPhantomZSliceHeader::Dumping Z Slice data to "
209 << fFilename << "..." << G4endl;
210 //sleep(5);
211
212 // May seen counter-intuitive (dumping to file you are reading from), but
213 // the reason for this is modification slice spacing
214 if(fMateIDs.size() == 0 || fValues.size() == 0) { ReadDataFromFile(); }
215
216
217 std::ofstream out;
218 out.open(fFilename.c_str());
219
220 if(!out) {
221 G4String descript = "DicomPhantomZSliceHeader::DumpToFile: could not open "
222 +fFilename;
223 G4Exception(descript.c_str(),"", FatalException, "");
224 }
225
226 out << fMaterialNames.size() << std::endl;
227 for(unsigned int i = 0; i < fMaterialNames.size(); ++i) {
228 out << i << " " << fMaterialNames.at(i) << std::endl;
229 }
230
231 out << fNoVoxelsX << " " << fNoVoxelsY << " " << fNoVoxelsZ << std::endl;
232 out << fMinX << " " << fMaxX << std::endl;
233 out << fMinY << " " << fMaxY << std::endl;
234 out << fMinZ << " " << fMaxZ << std::endl;
235
236 for(unsigned int i = 0; i < fMateIDs.size(); ++i)
237 { Print(out,fMateIDs.at(i)," "); }
238
239 for(unsigned int i = 0; i < fValues.size(); ++i)
240 { Print(out,fValues.at(i)," ",6); }
241
242 out.close();
243
244}
void Print(std::ostream &, const std::vector< T > &, const G4String &, G4int breakLine=-1)

◆ ReadDataFromFile()

void DicomPhantomZSliceHeader::ReadDataFromFile ( )

Definition at line 247 of file DicomPhantomZSliceHeader.cc.

248{
249 std::ifstream in;
250 in.open(fFilename.c_str());
251
252 if(!in) {
253 G4String descript = "DicomPhantomZSliceHeader::DumpToFile: could not open "
254 +fFilename;
255 G4Exception(descript.c_str(),"", FatalException, "");
256 }
257
258 G4int nMaterials;
259 in >> nMaterials;
260
261 fMaterialNames.resize(nMaterials,"");
262 for(G4int i = 0; i < nMaterials; ++i) {
263 G4String str1, str2;
264 in >> str1 >> str2;
265 if(!IsInteger(str1)) {
266 G4String descript = "String : " + str1 + " supposed to be integer";
267 G4Exception("DicomPhantomZSliceHeader::ReadDataFromFile - error in \
268 formatting: missing material index","", FatalException,descript.c_str());
269 }
270 G4int index = G4s2n<G4int>(str1);
271 if(index > nMaterials || index < 0) {
272 G4String descript = "Index : " + str1;
273 G4Exception("DicomPhantomZSliceHeader::ReadDataFromFile - error:\
274 bad material index","", FatalException,descript.c_str());
275 }
276 fMaterialNames[index] = str2;
277 }
278
279 in >> fNoVoxelsX >> fNoVoxelsY >> fNoVoxelsZ;
280
281 G4double tmpMinX, tmpMinY, tmpMinZ;
282 G4double tmpMaxX, tmpMaxY, tmpMaxZ;
283
284 in >> tmpMinX >> tmpMaxX;
285 in >> tmpMinY >> tmpMaxY;
286 in >> tmpMinZ >> tmpMaxZ;
287
288 fMinX = (CheckConsistency(tmpMinX,fMinX,"Min X value")) ?
289 fMinX : ((fMinX == 0) ? tmpMinX : fMinX);
290 fMaxX = (CheckConsistency(tmpMaxX,fMaxX,"Max X value")) ?
291 fMaxX : ((fMaxX == 0) ? tmpMaxX : fMaxX);
292
293 fMinY = (CheckConsistency(tmpMinY,fMinY,"Min Y value")) ?
294 fMinY : ((fMinY == 0) ? tmpMinY : fMinY);
295 fMaxY = (CheckConsistency(tmpMaxY,fMaxY,"Max Y value")) ?
296 fMaxY : ((fMaxY == 0) ? tmpMaxY : fMaxY);
297
298 fMinZ = (CheckConsistency(tmpMinZ,fMinZ,"Min Z value")) ?
299 fMinZ : ((fMinZ == 0) ? tmpMinZ : fMinZ);
300 fMaxZ = (CheckConsistency(tmpMaxZ,fMaxZ,"Max Z value")) ?
301 fMaxZ : ((fMaxZ == 0) ? tmpMaxZ : fMaxZ);
302
303 fMateIDs.clear();
304 fValues.clear();
305 fMateIDs.resize(fNoVoxelsY*fNoVoxelsZ,std::vector<G4int>(fNoVoxelsX,0));
306 fValues.resize(fNoVoxelsY*fNoVoxelsZ,std::vector<G4double>(fNoVoxelsX,0.));
307 for(G4int k = 0; k < fNoVoxelsZ; ++k) {
308 for(G4int j = 0; j < fNoVoxelsY; ++j) {
309 for(G4int i = 0; i < fNoVoxelsX; ++i) {
310 G4int tmpMateID;
311 in >> tmpMateID;
312 G4int row = j*(k+1);
313 fMateIDs[row][i] = tmpMateID;
314 }
315 }
316 }
317
318 for(G4int k = 0; k < fNoVoxelsZ; ++k) {
319 for(G4int j = 0; j < fNoVoxelsY; ++j) {
320 for(G4int i = 0; i < fNoVoxelsX; ++i) {
321 G4double tmpValue;
322 in >> tmpValue;
323 G4int row = j*(k+1);
324 fValues[row][i] = tmpValue;
325 }
326 }
327 }
328
329 in.close();
330}
G4bool IsInteger(const G4String &)
bool CheckConsistency(const T &, const T &, G4String)

◆ DumpExcessMemory()

void DicomPhantomZSliceHeader::DumpExcessMemory ( )
inline

Definition at line 144 of file DicomPhantomZSliceHeader.hh.

144 {
145 if(fFilename.length() != 0) { fValues.clear(); fMateIDs.clear(); } }

◆ FlipData()

void DicomPhantomZSliceHeader::FlipData ( )
inline

Definition at line 181 of file DicomPhantomZSliceHeader.hh.

182{
183 std::reverse(fValues.begin(), fValues.end());
184 std::reverse(fMateIDs.begin(), fMateIDs.end());
185}

◆ IsInteger()

G4bool DicomPhantomZSliceHeader::IsInteger ( const G4String str)
inlineprivate

Definition at line 187 of file DicomPhantomZSliceHeader.hh.

188{
189 return (str.find_first_not_of("0123456789") == std::string::npos) ? true : false;
190}

◆ Print()

template<typename T >
void DicomPhantomZSliceHeader::Print ( std::ostream &  out,
const std::vector< T > &  val,
const G4String delim,
G4int  breakLine = -1 
)
inlineprivate

Definition at line 215 of file DicomPhantomZSliceHeader.hh.

217{
218 for(unsigned int i = 0; i < val.size(); ++i) {
219 out << val.at(i);
220 if(breakLine < 0) {
221 if(i+1 < val.size()) { out << delim; }
222 else { out << G4endl; }
223 } else {
224 ((i != 0 && i%breakLine == 0) ? (out << G4endl) : (out << delim)); }
225 }
226}

◆ G4s2n()

template<typename T >
T DicomPhantomZSliceHeader::G4s2n ( const G4String str)
inlineprivate

Definition at line 193 of file DicomPhantomZSliceHeader.hh.

194{
195 std::istringstream iss(str);
196 T val;
197 iss >> val;
198 return val;
199}

◆ CheckConsistency()

template<typename T >
bool DicomPhantomZSliceHeader::CheckConsistency ( const T &  val1,
const T &  val2,
G4String  category 
)
inlineprivate

Definition at line 203 of file DicomPhantomZSliceHeader.hh.

204 {
205 if(val1 != val2) {
206 G4Exception("DicomPhantomSliceZHeader::CheckConsistency",
207 "Consistency Mismatch : Keeping previous value if nonzero",
208 JustWarning, category.c_str());
209 return false;
210 }
211 return true;
212}

◆ CheckMaterialExists()

G4bool DicomPhantomZSliceHeader::CheckMaterialExists ( const G4String mateName)
private

Definition at line 106 of file DicomPhantomZSliceHeader.cc.

107{
108 const G4MaterialTable* matTab = G4Material::GetMaterialTable();
109 std::vector<G4Material*>::const_iterator matite;
110 for( matite = matTab->begin(); matite != matTab->end(); ++matite ) {
111 if( (*matite)->GetName() == mateName ) { return true; }
112 }
113
114 G4Material* g4mate = G4NistManager::Instance()->FindOrBuildMaterial(mateName);
115 if( g4mate ) {
116 return false;
117 } else {
118 return true;
119 }
120
121}

Member Data Documentation

◆ fNoVoxelsX

G4int DicomPhantomZSliceHeader::fNoVoxelsX
private

Definition at line 165 of file DicomPhantomZSliceHeader.hh.

◆ fNoVoxelsY

G4int DicomPhantomZSliceHeader::fNoVoxelsY
private

Definition at line 165 of file DicomPhantomZSliceHeader.hh.

◆ fNoVoxelsZ

G4int DicomPhantomZSliceHeader::fNoVoxelsZ
private

Definition at line 165 of file DicomPhantomZSliceHeader.hh.

◆ fMinX

G4double DicomPhantomZSliceHeader::fMinX
private

Definition at line 166 of file DicomPhantomZSliceHeader.hh.

◆ fMinY

G4double DicomPhantomZSliceHeader::fMinY
private

Definition at line 166 of file DicomPhantomZSliceHeader.hh.

◆ fMinZ

G4double DicomPhantomZSliceHeader::fMinZ
private

Definition at line 166 of file DicomPhantomZSliceHeader.hh.

◆ fMaxX

G4double DicomPhantomZSliceHeader::fMaxX
private

Definition at line 167 of file DicomPhantomZSliceHeader.hh.

◆ fMaxY

G4double DicomPhantomZSliceHeader::fMaxY
private

Definition at line 167 of file DicomPhantomZSliceHeader.hh.

◆ fMaxZ

G4double DicomPhantomZSliceHeader::fMaxZ
private

Definition at line 167 of file DicomPhantomZSliceHeader.hh.

◆ fMaterialNames

std::vector<G4String> DicomPhantomZSliceHeader::fMaterialNames
private

Definition at line 169 of file DicomPhantomZSliceHeader.hh.

◆ fFilename

G4String DicomPhantomZSliceHeader::fFilename
private

Definition at line 171 of file DicomPhantomZSliceHeader.hh.

◆ fValues

std::vector<std::vector<G4double> > DicomPhantomZSliceHeader::fValues
private

Definition at line 172 of file DicomPhantomZSliceHeader.hh.

◆ fMateIDs

std::vector<std::vector<G4int> > DicomPhantomZSliceHeader::fMateIDs
private

Definition at line 173 of file DicomPhantomZSliceHeader.hh.

◆ fSliceLocation

G4double DicomPhantomZSliceHeader::fSliceLocation
private

Definition at line 174 of file DicomPhantomZSliceHeader.hh.


The documentation for this class was generated from the following files:

Applications | User Support | Publications | Collaboration