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

Ok Re: Printing out density of each voxel in example 

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

Thank you so much, Ming!

I am just wondering; how does GEANT4 know to execute the new function? I know that the initialize() command in main executes the construct() command in the detector source files, thus building the phantom, but how would it know to run the printPhantom() command in the DicomNestedPhantomParameterisation class?

I really appreciate your thorough and clear response, -Katya

On Mon, 25 Jul 2016 20:26:07 GMT, Youming Yang wrote:

> 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    
>     ""
> 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 None: Re: Printing out density of each voxel in example   (Youming Yang - 26 Jul, 2016)
(_ Ok: Re: Printing out density of each voxel in example   (Katya Gilbo - 26 Jul, 2016)
 Add Message Add Message
to: "Re: Printing out density of each voxel in 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 ]