3D volume dose in DICOM

Hi,
I am trying to implement the DICOM class into my simulation involving heavy ions and I was wondering how I could get an output of 3D volume dose. Do I have to implement an SD? I would really appreciate any help.
Thanks.

The best way is to do scoring (a G4MultiFunctionalDetector). There are many examples about this

I appreciate for your prompt response Pedro. I have implemented the G4MultiFunctionalDetector and I do get the 2-column output as dicom.out. The README file says the first column is voxel number in order of xyz. Is it possible to get a 4 column output with x,y,z,dose with the multifunctional detector?
Thanks.

You have to extract each individual coordinate yourself from xyz ID (first X, then Y and last Z)

When I use the 3 example dicom slices 1,2 and 3 (128x128x3), I get the output dicom.out which contains voxels with ID and dose like (6475 2.37412e-10). I would really appreciate if you could help me understand the voxel numbering before I start parsing their individual IDs.

I also implemented the method used in the advanced example of medical linac to extract 3d voxel dose using the copy number. But, the voxel IDs and the corresponding dose in this case are different from the default output. I am not sure if this is the correct 3D dose. I am including the code as well as the two output files.
Thank you.

std::ofstream file1(“TotalDose.txt”);
for ( G4int i = 0; i < (G4int)fSDName.size(); i++ ){
G4THitsMap* totDose = reRun ->GetHitsMap(fSDName[i]+“/DoseDeposit”);
for ( iz = 0; iz < fNoVoxelsZ; iz++){
for ( iy = 0; iy < fNoVoxelsY; iy++){
for (ix = 0; ix < fNoVoxelsX; ix++){
G4double* TotD = (*totDose)[CopyNo(ix,iy,iz)];
if ( !TotD ) TotD = new G4double(0.0);
if (*TotD!=0) {
file1 << ix << " “<<iy<<” “<<iz<<” "<< *TotD/gray << G4endl;
}
}
}
}
}
file.close();
dicom.txt (5.9 KB)
TotalDose.txt (5.5 KB)