32 #ifndef DicomPhantomZSliceHeader_h
33 #define DicomPhantomZSliceHeader_h 1
119 void AddRow() { fValues.push_back(std::vector<G4double>(0));
120 fMateIDs.push_back(std::vector<G4int>(0)); }
123 fValues.back().push_back(val) :
124 fValues.push_back(std::vector<G4double>(1,val)); }
125 void AddValue(
const std::vector<G4double>& val) { fValues.push_back(val); }
126 void AddValue(
const std::vector<std::vector<G4double> >& val) {
127 for(
unsigned int i = 0; i < val.size(); ++i) { fValues.push_back(val.at(i)); }
131 fMateIDs.back().push_back(val) :
132 fMateIDs.push_back(std::vector<G4int>(1,val)); }
133 void AddMateID(
const std::vector<G4int>& val) { fMateIDs.push_back(val); }
134 void AddMateID(
const std::vector<std::vector<G4int> >& val) {
135 for(
unsigned int i = 0; i < val.size(); ++i) { fMateIDs.push_back(val.at(i)); }
138 const std::vector<std::vector<G4double> >&
GetValues()
const {
return fValues; }
139 const std::vector<std::vector<G4int> >&
GetMateIDs()
const {
return fMateIDs; }
145 if(fFilename.length() != 0) { fValues.clear(); fMateIDs.clear(); } }
151 template <
typename T>
152 inline void Print(std::ostream&,
const std::vector<T>&,
const G4String&,
153 G4int breakLine = -1);
154 template <
typename T>
inline T G4s2n(
const G4String&);
155 template <
typename T>
inline bool CheckConsistency(
const T&,
const T&,
G4String);
165 G4int fNoVoxelX, fNoVoxelY, fNoVoxelZ;
169 std::vector<G4String> fMaterialNames;
172 std::vector<std::vector<G4double> > fValues;
173 std::vector<std::vector<G4int> > fMateIDs;
187 inline G4bool DicomPhantomZSliceHeader::IsInteger(
const G4String& str)
189 return (str.find_first_not_of(
"0123456789") == std::string::npos) ?
true :
false;
192 template <
typename T>
193 inline T DicomPhantomZSliceHeader::G4s2n(
const G4String& str)
195 std::istringstream iss(str);
202 template <
typename T>
203 inline bool DicomPhantomZSliceHeader::CheckConsistency(
const T& val1,
const T& val2,
206 G4Exception(
"DicomPhantomSliceZHeader::CheckConsistency",
207 "Consistency Mismatch : Keeping previous value if nonzero",
214 template <
typename T>
215 inline void DicomPhantomZSliceHeader::Print(std::ostream& out,
const std::vector<T>& val,
218 for(
unsigned int i = 0; i < val.size(); ++i) {
221 if(i+1 < val.size()) { out << delim; }
224 ((i != 0 && i%breakLine == 0) ? (out <<
G4endl) : (out << delim)); }
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)