e0404 / matRad

An open source multi-modality radiation treatment planning sytem
Other
210 stars 168 forks source link

Restrict voxels used in computations #714

Open TheFInPhysics opened 1 month ago

TheFInPhysics commented 1 month ago

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.

wahln commented 1 month ago

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

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

TheFInPhysics commented 1 month ago

Hi, thank you very much for the prompt reply.

wahln commented 1 month ago

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.