e0404 / matRad

An open source multi-modality radiation treatment planning sytem developed by e0404 @ DKFZ
http://www.matRad.org
Other
226 stars 176 forks source link

How to resolve errors when importing nii format data for dose calculation #735

Closed Kilong closed 5 months ago

Kilong commented 5 months ago

Hello, first of all, thank you very much for your last help in importing nii format data into matRad. However, I recently encountered some errors while using this data. When running matRad_example5_protons.m, an error occurred at the statement stf = matRad_generateStf(ct,cst,pln); matRad: Generating stf struct... Error using matRad_generateStf (line 135) Could not find target. I checked the difference between my cst data and the example cst data, and found that the sixth column of data used in the example was not present when importing with matRad_importPatient.m. However, it seems that this column of data is necessary for finding the target in matRad_generateStf.m. Therefore, I would like to ask how I should import and set this part of the data? 捕获

wahln commented 5 months ago

Which branch are you using exactly at the moment?

It is indeed due to the 6th column. The 6th column stores objectives for planning / optimization, and matRad will use only targets with an objective (i.e. a prescription) to generate the spot grid. Here you see the condition with ~isempty.

https://github.com/e0404/matRad/blob/a5b8762da006ff78702f7d4065bb0bf7c110047d/matRad_generateStf.m#L53-L58

The V will be later used to identify target voxels, and will in your case stay empty. I don't know if this is the best idea to already consider the optimization objectives here, or maybe we should have a special case when no objective is set or at least throw a more descriptive error.

A short workaround for you is to just assign an objective to your structure "target":

cst{3,6}{1} = struct(DoseObjectives.matRad_SquaredDeviation(1000,60));

This one prescribes 60 Gy in n fractions (depending on what you have set in pln.numOfFractions) with a weight of 1000 to the 3rd VOI (which is a target in your list). We turn Objectives into structs usually for Octave-compatible *.mat files, but the struct conversion is not strictly necessary.

Kilong commented 5 months ago

Thank you for your quick reply. I am using the branch feature/niftireader. I tried the method you suggested and have successfully run it.

stf = matRad_generateStf(ct,cst,pln); matRad: Generating stf struct... Warning: Could not find HLUT in hlutLibrary folder. matRad default HLUT loaded Warning: projecting out of range HU values Progress: 100.00 %

wahln commented 5 months ago

Thanks, I will close this issue. The Nifti-Reader Functionality is now fully merged onto the dev-branch, so you can use this one from now on.