e0404/matRad

Restrict voxels used in computations

TheFInPhysics opened this issue · 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.

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

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.

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):

% take only voxels inside patient
VctGrid = [cst{:,4}];
VctGrid = unique(vertcat(VctGrid{:}));

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.