|Message: Re: Printing out density of each voxel in DICOM.cc example||Not Logged In (login)|
Click on the Forum title, e.g. on the "Forums by Category" page, to read a sequence of postings to the Forum and its threads all in one page. If you are only interested in one thread or the thread following a specific posting, click the thread or the posting, which takes you to a smaller page, which contains only the part you are interested in and may be easier to navigate.
Messages are "chained" if there are only replies at the first level, i.e. 1/1.html, 1/1/1.html etc. In case of "chained" messages the message number is replaced by the icon and there is no indentation.
Inline: Display the subject line only or also the text of the posting(s); for the choice "All" the "Outline" choices are switched off.
|1||0||1||no text / full text of posting|
|2||1||All||text for level 1 only / text for All postings|
Outline: Choose the depth of the posting thread, successive toggle controls provide increasing detail.
|1||2||1||2 levels / 1 level (original posting)|
|2||3||2||3 levels / 2 levels|
|3||3||All||3 levels / all levels (all postings)|
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 > "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:||Outline Depth:||Add message:|