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

Error in robust optimization plan #747

Open
MP1234567899 opened this issue Jul 16, 2024 · 10 comments
Open

Error in robust optimization plan #747

MP1234567899 opened this issue Jul 16, 2024 · 10 comments

Comments

@MP1234567899
Copy link

Hi,
I used 4DCT data with 10 phases for robust optimization in matRad. However, I encountered an issue when planning in the average phase. The optimization only ran for one iteration and produced warnings and errors in the MATLAB command window. I suspect there might be an error with how the image was exported from my TPS, since optimization works for other individual phases from the same 4DCT data.
Error showed about using caxis; limits must be a 2-element , matRad_plotColorbar, matRad_ViewingWidget/UpdatePlot
I get an error when using gantry angles of xx and xx degrees without including couch rotation. However, if I add couch rotation while keeping the same gantry angles, the optimization completes, but the resulting dose distribution is unusual.

Thank you.

@wahln
Copy link
Contributor

wahln commented Jul 16, 2024

Don't have enough information to judge what is going on.

  • Which branch was used? Recent version of the dev branch? Or the master branch / last release
  • Related to the previous question - you precompute the average phase yourself or used matRad's robust optimization (only reliably working on dev branch and some other branches) over all phases?
  • Did you do everything from the GUI or used a script? Your errors sound like plotting errors, which can happen when the optimization errors out and does not produce dose cube / a coube of all zeros / a cube of NaNs.
  • Which Matlab version was used?

@wahln
Copy link
Contributor

wahln commented Jul 16, 2024

@amitantony I actually thought that I made sure that in such cases would be caught in the code such that it always uses some sensible color window for colorbar and plotting, such tthat it doesn't error out when getting, e.g., a zero-cube from optimization. Can you check (after we know which version was used exactly by @MP1234567899 ?)

@MP1234567899
Copy link
Author

Hello, @wahln

I've been using Blaise version 2.10.1 via the GUI. I've been exporting data from TPS incrementally, organizing each phase into its own folder. Then, I've been importing this data into matRad step-by-step. However, I encountered issues specifically when working with the phase averages. An error message popped up in the command window, halting the dose influence calculation process.

Error on command window >>

Error using matRad_Widget/showError (line 111)
CalcDoseCallback: Error in dose calculation!Unrecognized field name "radDepths".
Error in matRad_WorkflowWidget/btnCalcDose_Callback (line 411)
showError(this,'CalcDoseCallback: Error in dose calculation!',ME);
Error in matRad_WorkflowWidget>@(hObject,eventdata)btnCalcDose_Callback(this,hObject,eventdata) (line 159)
'Callback',@(hObject,eventdata) btnCalcDose_Callback(this,hObject,eventdata),...

Thank you

@wahln
Copy link
Contributor

wahln commented Jul 18, 2024

I still don't understand what "working with the phase averages" means in the context of matRad. There is no phase averaging in matRad.

I also assume that you do not use the downloaded release, but are working with a version from the dev or dev_varRBErobOpt branch (because I see that it uses the new GUI elements).

@MP1234567899
Copy link
Author

I apologize for any confusion earlier. I utilized the AIP (Average Intensity Projection) image for planning by importing its DICOM files. Specifically, I imported DICOM files of the AIP for planning purposes. To clarify, I mentioned that I imported images for each phase (0-90) from the 4DCT, which allows me to plan for each phase individually. However, when attempting to plan using the AIP, I encountered issues. I am using matRadGUI on matRad-dev_varRBErobOpt.

@wahln
Copy link
Contributor

wahln commented Jul 18, 2024

What about the structures you use on the AIP image?

  • Do you have a sensible TARGET defined
  • Is the isocenter located in the target structure before planning?
  • What are there Priority values of the structures ("OP" in the User interface)?

To me, it looks like that something is off with geometry when dose calculation is triggered.

@MP1234567899
Copy link
Author

I planned the Clinical Target Volume (CTV)(now set only for CTV) using OP 1, positioning the isocenter at its center. However, when I tried to calculate dose influence and optimize the plan, an error occurred, with a pop-up message on my desktop stating: "CalcDoseCallback: Error in dose calculation - Unrecognized field name 'radDepths'."

Previously, I successfully planned treatments in the 0% to 90% phases using similar data from other images. It's unclear why planning works with those images but encounters issues with the current DICOM data. The data originates from the same patient's Treatment Planning System (TPS), and I suspect there might be faults within the DICOM data that are causing these issue. This issue only occurred with AIP.

@wahln
Copy link
Contributor

wahln commented Jul 19, 2024

Hmm, okay. Difficult to say what is going on exactly.

Do you have more information about the error? Usually, if an error is shown in the GUI, matRad will also print the Error to the Command Window of Matlab in the Background with line numbers and additional information. Can you extract more information from there?

Also, you can try updating to the latest version of the dev branch (or, if you want to be a bit more on the safe side, just have a second installation of the up-to-date dev branch and try it there).

@MP1234567899
Copy link
Author

Hi,
I checked the version and updated the dev-branch, but the issue persists with the AIP image from the 4DCT; it’s the only image showing a problem. Initially, I verified that the patient's body contour was correctly covered and immobilized, which resolved the radDepth error. However, we’re now encountering a new error related to Clim.

matRad: Generating stf struct...
Warning: Could not find HLUT Siemens Healthineers-SOMATOM go.Open Pro-ConvolutionKernel-Qr40f_protons.hlut in hlutLibrary folder. matRad default HLUT loaded
Warning: projecting out of range HU values
Warning: projecting out of range HU values
Progress: 100.00 %
Dose influence matrix calculation using 'Analytical Bortfeld Pencil-Beam' Dose Engine...
Dose grid has dimensions 120x120x57
Adjusting structures for overlap... Done!
Resampling structure set... Done!
Adjusting structures for overlap... Done!
Warning: Could not find HLUT Siemens Healthineers-SOMATOM go.Open Pro-ConvolutionKernel-Qr40f_protons.hlut in hlutLibrary folder. matRad default HLUT loaded
Warning: projecting out of range HU values
Warning: projecting out of range HU values
Using an analytically computed Shift scenario 1 of 7:
matRad: calculate radiological depth cube... 0.47 %Error using matRad_Widget/showError
CalcDoseCallback: Error in dose calculation!Unrecognized field name "radDepths".

Error in matRad_WorkflowWidget/btnCalcDose_Callback (line 411)
showError(this,'CalcDoseCallback: Error in dose calculation!',ME);

Error in matRad_WorkflowWidget>@(hObject,eventdata)btnCalcDose_Callback(this,hObject,eventdata) (line 159)
'Callback',@(hObject,eventdata) btnCalcDose_Callback(this,hObject,eventdata),...

Error using matlab.ui.internal.legacyMoveGUI
Error while evaluating UIControl Callback.

this error show only when I planned on AIP image in other image from only patients dosen't show this error.

After that, a pop-up error labeled "propstf" appeared, causing both the CT and contour to disappear.
It runs the calculation, but when I optimize, it only shows a single iteration point.

P.S. Could you explain the differences between the HongPB algorithm and AnalyticalPB?
Thank you.

@wahln
Copy link
Contributor

wahln commented Jul 26, 2024

This is really difficult to debug from remotely, because I don't know how the ct struct, the cst array and the pln looks like.

Is the error occuring only when using AnalyticalPB?

  • AnalyticalPB implements a fully analytical pencil-beam dose calculation algorithm for protons based on the Method described in Bortfeld (1997) and using an analytical description for the lateral scatter based on the Highland Approximation. I would say that it is more an "academic" implementation.
  • The HongPB algorithm is also a pencil-beam implementation, but uses tabulated data (depth dose kernels, lateral kernels, etc.). It is mostly based on the original idea by Hong et al. (1996) but adapted for IMPT and biological calculations for ions.

Your error seems to mostly be related with matRad not being able to get correct WEPL from within the patient. Some sources of errors I could think of:

  • matRad does not correctly find the patient surface (HU-values not correct / out of range). Sometimes this also happens because someone writes rED or rSP cubes in ct.cubeHU and then tries dose calculation.
  • Contours are weirdly defined / have wrong overlap priorities or TARGET/OAR designations (seems like you already checked that).
  • It could be related to matRad thinking that there are multiple 4D CT scenarios (for example, the ct.numOfCtScen being bigger than 1 while ct.cubeHU only stores one cube. Or usage of an old scenario model (pln.multScen) instantiated for a ct with multiple scenarios etc.. This, to me, seems one of the few possible reasons to consistently get this missing radDepths-error in the dose calculation giving what you are trying to do.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants