60 fPartialPhantomParam(0),
116 std::ifstream finDF(dataFile.c_str());
118 if(finDF.good() != 1 ) {
119 G4Exception(
" DicomPartialDetectorConstruction::ReadPhantomData",
122 " Problem reading data file: Data.dat");
126 finDF >> compression;
130 if( numFiles != 1 ) {
131 G4Exception(
"DicomPartialDetectorConstruction::ReadPhantomData",
134 "More than 1 DICOM file is not supported");
136 for(
G4int i = 0; i < numFiles; i++ ) {
152 G4cout <<
" DicomDetectorConstruction::ReadPhantomDataFile opening file "
156 if( !
fin.is_open() ) {
157 G4Exception(
"DicomPartialDetectorConstruction::ReadPhantomDataFile",
160 G4String(
"File not found " + fname).c_str());
167 fin >> nmate >> stemp;
168 G4cout <<
"DicomPartialDetectorConstruction::ReadPhantomData reading nmate "
169 << ii <<
" = " << nmate <<
" mate " << stemp <<
G4endl;
171 G4Exception(
"DicomPartialDetectorConstruction::ReadPhantomData",
174 "Material number should be in increasing order: \
175 wrong material number ");
180 G4cout <<
"DicomPartialDetectorConstruction::ReadPhantomData nVoxel X/Y/Z "
187 fDimZ = (fDimZ -
fOffsetZ)/fNVoxelZ;
188 G4cout <<
"DicomPartialDetectorConstruction::ReadPhantomData voxelDimX "
190 G4cout <<
"DicomPartialDetectorConstruction::ReadPhantomData voxelDimY "
192 G4cout <<
"DicomPartialDetectorConstruction::ReadPhantomData voxelDimZ "
200 G4int ifxmin1, ifxmax1;
202 std::map< G4int, G4int > ifmin, ifmax;
204 fin >> ifxmin1 >> ifxmax1;
209 G4int ifxdiff = ifxmax1-ifxmin1+1;
210 if( ifxmax1 == -1 && ifxmin1 == -1 ) ifxdiff = 0;
212 G4cout <<
"DicomPartialDetectorConstruction::ReadPhantomData insert "
213 <<
" FilledIDs " << ifxdiff+
fNVoxels-1 <<
" min " << ifxmin1
217 if( ix >=
G4int(ifxmin1) && ix <=
G4int(ifxmax1) ) {
238 if( ix >=
G4int(ifxmin1) && ix <=
G4int(ifxmax1) ) {
240 if( mateID1 < 0 || mateID1 >= nMaterials ) {
241 G4Exception(
"DicomPartialDetectorConstruction::ReadPhantomData",
244 G4String(
"Wrong index in phantom file: It should be between 0 and "
265 std::map<G4int, std::pair<G4double,G4double> > densiMinMax;
266 std::map<G4int, std::pair<G4double,G4double> >::iterator mpite;
274 char*
part = std::getenv(
"DICOM_CHANGE_MATERIAL_DENSITY" );
277 std::map<G4int,G4double> densityDiffs;
278 if( densityDiff != -1. )
282 densityDiffs[ii] = densityDiff;
298 std::map< std::pair<G4Material*,G4int>,
matInfo* > newMateDens;
301 G4int ifxmin1, ifxmax1;
315 if( ix >=
G4int(ifxmin1) && ix <=
G4int(ifxmax1) ) {
320 if( dens1 < (*mpite).second.first ) (*mpite).second.first = dens1;
321 if( dens1 > (*mpite).second.second ) (*mpite).second.second = dens1;
335 G4int densityBin = 0;
339 if( densityDiff != -1.) {
340 densityBin = (
G4int(dens1/densityDiffs[mateID]));
346 std::pair<G4Material*,G4int> matdens(mate, densityBin );
348 auto mppite = newMateDens.find( matdens );
349 if( mppite != newMateDens.cend() ){
350 matInfo* mi = (*mppite).second;
360 mi->
fId =
G4int(newMateDens.size()+1);
361 newMateDens[matdens] = mi;
384 for(
auto mppite= newMateDens.cbegin();
385 mppite != newMateDens.cend(); ++mppite )
387 G4double averdens = (*mppite).second->fSumdens/(*mppite).second->fNvoxels;
389 G4cout <<
"GmReadPhantomGeometry::ReadVoxelDensities AVER DENS "
390 << averdens <<
" -> " << saverdens <<
" -> "
391 <<
G4int(1000*averdens) <<
" " <<
G4int(1000*averdens)/1000 <<
" "
394 G4cout <<
"GmReadPhantomGeometry::ReadVoxelDensities AVER DENS "
395 << averdens <<
" -> " << saverdens <<
" -> "
397 <<(*mppite).second->fNvoxels <<
G4endl;
398 G4String mateName = ((*mppite).first).first->GetName() +
"_" +
401 (*mppite).first.first,
402 G4float(averdens), mateName ) );
413 G4String contname=
"PhantomContainer";
416 G4Tubs* container_tube =
new G4Tubs(contname,0., 200., 100., 0., 360*
deg);
443 G4bool bSkipEqualMaterials = 0;
444 G4int regStructureID = 2;
483 if( OptimAxis ==
"kUndefined" ) {
487 }
else if( OptimAxis ==
"kXAxis" ) {
494 G4Exception(
"GmReadPhantomGeometry::ConstructPhantom",
497 G4String(
"Wrong argument to parameter \
498 GmReadPhantomGeometry:Phantom:OptimAxis: \
499 Only allowed 'kUndefined' or 'kXAxis', it is: "+OptimAxis).c_str());