Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Restrict voxels used in computations #714

Open
TheFInPhysics opened this issue May 6, 2024 · 4 comments
Open

Restrict voxels used in computations #714

TheFInPhysics opened this issue May 6, 2024 · 4 comments
Labels
question stale Automatic label for stale issues

Comments

@TheFInPhysics
Copy link

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
Copy link
Contributor

wahln commented May 7, 2024

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

@TheFInPhysics
Copy link
Author

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.

@wahln
Copy link
Contributor

wahln commented May 8, 2024

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.

Copy link

github-actions bot commented Jul 6, 2024

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 github-actions bot added the stale Automatic label for stale issues label Jul 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question stale Automatic label for stale issues
Projects
None yet
Development

No branches or pull requests

2 participants