matRad icon indicating copy to clipboard operation
matRad copied to clipboard

Restrict voxels used in computations

Open TheFInPhysics opened this issue 1 year ago • 4 comments

Hi, I have a too big CT. I tried using other software (LifeX) to generate a cropped CT but the new dicom files have a different structure that causes errors when reading them with matRad. I therefore wanted to ask if there would be a way to work within matRad reading the whole CT but restricting the voxels used in calculations (e.g. similar to the option RestricVoxelsXmin, ...Xmax, etc from Topas). Thank you very much in advance.

TheFInPhysics avatar May 06 '24 13:05 TheFInPhysics

Before we go into that in detail - do you already have problems reading the CT or is it about dose calculation and optimization? Some meta information would also be nice

  • How big is your CT (dimensionality? 4D?)
  • How many structures do you have in there?

If you can read the CT, you could either downsample it at import, use a coarser dose grid, or remove voxels during dose calculation / optimization. But let's delve into this when we have more information

wahln avatar May 07 '24 20:05 wahln

Hi, thank you very much for the prompt reply.

  • I can read the original (complete size) CT without problems in matRad.
  • The CT is 3D, it has 256x256x186 voxels (and the relevant part is only 128x158x97 voxels).
  • It has 27 structures (only ~20 are relevant). I would like to make the dose influence matrix calculation faster and more memory- efficient (as I export it) by restricting the calculation to only the relevant voxels. I do not know how to do this, so I would be very grateful if you could explain how to remove unnecessary voxels during dose calculation. I understand that the dose-influence matrix calculation is done in matRad_calcPhotonDose/matRad_calcParticleDose. However, I do not understand in which voxels the computation is actually made (is it in all voxels of the CT, or only in voxels that are in structures?). Thank you very much again.

TheFInPhysics avatar May 07 '24 22:05 TheFInPhysics

Hi, the CT sounds not too big, so I am a bit wondering about the computational resources needed. How does your plan geometry look like?

Apart from that, matRad should automatically restrict calculation (at least with default settings) to all voxels within contours. However, we are a bit limited with the data structures available to us within matRad, so the data structure containing dose influence (dij) can become quite large and calculation is not as efficient as it could be.

Are you using the current master branch or another branch? The dev_varRBErobOpt branch has some methods to choose voxels implemented. On the master branch, the voxels are selected within matRad_calcDoseInit (Note that this only holds for the master branch, as we are refactoring dose calculation at the moment): https://github.com/e0404/matRad/blob/c3de378b7813611e619f7383f4498aedb618b0ce/matRad_calcDoseInit.m#L107-L109 There, one can also choose specific voxel indices to calculate dose.

Another way to restrict voxels is playing with the various cut-offs applied to dose (i.e., which dose of a beamlet should be left out), there are some parameters for that. Or, alternatively, one can calculated in a more coarse dose grid by plaing with pln.propDoseCalc.doseGrid.resolution. In the end, the solution will be upsampled to the ct grid again.

Let me know, which method sounds most useful for you, then I can help with it specifically.

wahln avatar May 08 '24 10:05 wahln

This issue was automatically marked as stale because it has been sitting there for 14 days without activity. It will be closed in 14 days if no further activity occurs.

github-actions[bot] avatar Jul 06 '24 01:07 github-actions[bot]

This issue was automatically closed because it has not seen any activity in four weeks. This happens usually when the issue has already been solved or it is no longer relevant. If this is not the case, feel free to reopen the issue.

github-actions[bot] avatar Feb 14 '25 01:02 github-actions[bot]