Message: Re: Printing out density of each voxel in DICOM.cc example Not Logged In (login)
 Next-in-Thread Next-in-Thread
 Next-in-Forum Next-in-Forum

None Re: Printing out density of each voxel in DICOM.cc example 

Forum: Geometry
Re: Question Printing out density of each voxel in DICOM.cc example (Katya Gilbo)
Date: 25 Jul, 2016
From: Youming Yang <Youming Yang>

Hi Katya,

The simplest way would likely to be creating a new output function once your phantom has been constructed.

Assuming you are using the nested parameterisation (low memory, fast), then the important bits of code can be found in    
    "DicomNestedParamDetectorConstruction.cc/.hh"

In the .cc file, you should see the lines (104-121):

    G4ThreeVector voxelSize(fVoxelHalfDimX,fVoxelHalfDimY,fVoxelHalfDimZ);
    DicomNestedPhantomParameterisation* param =
    new DicomNestedPhantomParameterisation(voxelSize, fMaterials);

    new G4PVParameterised("phantom",    // their name
                          logicVoxel, // their logical volume
                          logXRep,      // Mother logical volume
                          kZAxis,       // Are placed along this axis
                          //kUndefined,
                          // Are placed along this axis
                          fNVoxelZ,      // Number of cells
                          param);       // Parameterisation.

    param->SetMaterialIndices( fMateIDs );
    param->SetNoVoxel( fNVoxelX, fNVoxelY, fNVoxelZ );

Here, the CT file has been read, and voxels have been mapped to their respective materials.

What you could do is create a new function in this cc file (and its declarationin the header file) like:
     void DicomNestedParamDetectorConstruction::printPhantom()

In such a function, you would want to do for loops through nx, ny, nz (or nxyz=nx*ny*nz), where you print the voxel index, as well as
     fMaterials[fMateIDs[i]]->GetDensity();  //something like this line

Basically what that will do is take the index of the voxel, get the material ID from the fMateIDs vector, and grab that material from the fMaterials vector. Then you can just print the density. You may also consider writing the densities to a binary block of data, and out putting that using a file i/o command.

Best, Ming

Inline Depth:
 1 1
 All All
Outline Depth:
 1 1
 2 2
 All All
Add message: (add)

1 Ok: Re: Printing out density of each voxel in DICOM.cc example   (Katya Gilbo - 26 Jul, 2016)
(_ None: Re: Printing out density of each voxel in DICOM.cc example   (Youming Yang - 26 Jul, 2016)
(_ Ok: Re: Printing out density of each voxel in DICOM.cc example   (Katya Gilbo - 26 Jul, 2016)
 Add Message Add Message
to: "Re: Printing out density of each voxel in DICOM.cc example"

 Subscribe Subscribe

This site runs SLAC HyperNews version 1.11-slac-98, derived from the original HyperNews


[ Geant 4 Home | Geant 4 HyperNews | Search | Request New Forum | Feedback ]