e0404 / matRad

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

Proton Dose calculation for DICOM RT plan from Eclipse #416

Closed bterracino closed 3 years ago

bterracino commented 4 years ago

I have a CT series, RT plan RT structure and RT dose file all of which are DICOM format.

When using DICOM import, I get a message "no RT dose file directly associated to plan file. showing all rt dose files." This happens when I have the RT plan file selected. This is followed by a message "Import steering information from DICOM plan. Choose corresponding matured base data for procedure." I selected the proton_generic.mat file for this. After this, the import does not continue and I get the errors below.

If I try to import with the RT dose file highlighted instead of the RT plan, I get the same errors.

=================================================================== importing ct-cube... creating info...Progress: 100.00 % reading slices...Progress: 100.00 %

z-coordinates taken from ImagePositionPatient

Interpolating CT cube...finished!

conversion of ct-Cube to Hounsfield units...finished!

Reading structures...Warning: Contour Breast is empty

In matRad_importDicomRtss (line 87) In matRad_importDicom (line 77) In matRad_importDicomGUI>import_button_Callback (line 330) In gui_mainfcn (line 95) In matRad_importDicomGUI (line 53) In matlab.graphics.internal.figfile.FigFile/read>@(hObject,eventdata)matRad_importDicomGUI('import_button_Callback',hObject,eventdata,guidata(hObject)) finished! creating cube for LungLt volume... creating cube for LungRt volume... creating cube for Lungs volume... creating cube for CTV volume... creating cube for PTV volume... creating cube for SpinalCord volume... creating cube for Breast volume... creating cube for Esophagus volume... creating cube for Heart volume... creating cube for NonTargetBody volume... creating cube for NonTargetLung volume... creating cube for Bones volume... creating cube for Rib volume... creating cube for Cord+5mm volume... creating cube for IGTVt volume... creating cube for BronchiLt volume... creating cube for PlanBody volume... creating cube for Body volume... creating cube for Table volume... creating cube for Skin volume... creating cube for T9 L volume... creating cube for T11 R volume... creating cube for T11 L volume... creating cube for T9 R volume... creating cube for L1 L volume... creating cube for T7 L volume... creating cube for T7 R volume... creating cube for L1 R volume... creating cube for L1 A volume... creating cube for T12 P volume... creating cube for T11 A volume... creating cube for T9 A volume... creating cube for T8 A volume... creating cube for Carina volume... finished! Warning: Could not determine mass and atomic number of the particle In matRad_importDicomRTPlan (line 106) In matRad_importDicom (line 105) In matRad_importDicomGUI>import_button_Callback (line 330) In gui_mainfcn (line 95) In matRad_importDicomGUI (line 53) In matlab.graphics.internal.figfile.FigFile/read>@(hObject,eventdata)matRad_importDicomGUI('import_button_Callback',hObject,eventdata,guidata(hObject)) Reference to non-existent field 'ScanSpotMetersetWeights'.

Error in matRad_importDicomSteeringParticles (line 86) if sum(currContrSeq.ScanSpotMetersetWeights) == 0

Error in matRad_importDicom (line 115) [stf, pln] = matRad_importDicomSteeringParticles(ct, pln, files.rtplan);

Error in matRad_importDicomGUI>import_button_Callback (line 330) matRad_importDicom(files, dicomMetaBool);

Error in gui_mainfcn (line 95) feval(varargin{:});

Error in matRad_importDicomGUI (line 53) [varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});

Error in matlab.graphics.internal.figfile.FigFile/read>@(hObject,eventdata)matRad_importDicomGUI('import_button_Callback',hObject,eventdata,guidata(hObject)) Error while evaluating UIControl Callback.

If I do DICOM import with the patient ID selected, it does not ask me about the steering info and successfully reads in the images and structures however the RT plan information such as gantry angle, couch angle etc. is not read in. Below is what errors for this. (I was able to fix the visible color issue with the help of support).

==================================================================== importing ct-cube... creating info...Progress: 100.00 % reading slices...Progress: 100.00 %

z-coordinates taken from ImagePositionPatient

Interpolating CT cube...finished!

conversion of ct-Cube to Hounsfield units...finished!

Reading structures...Warning: Contour Breast is empty

In matRad_importDicomRtss (line 87) In matRad_importDicom (line 77) In matRad_importDicomGUI>import_button_Callback (line 330) In gui_mainfcn (line 95) In matRad_importDicomGUI (line 53) In matlab.graphics.internal.figfile.FigFile/read>@(hObject,eventdata)matRad_importDicomGUI('import_button_Callback',hObject,eventdata,guidata(hObject)) finished! creating cube for LungLt volume... creating cube for LungRt volume... creating cube for Lungs volume... creating cube for CTV volume... creating cube for PTV volume... creating cube for SpinalCord volume... creating cube for Breast volume... creating cube for Esophagus volume... creating cube for Heart volume... creating cube for NonTargetBody volume... creating cube for NonTargetLung volume... creating cube for Bones volume... creating cube for Rib volume... creating cube for Cord+5mm volume... creating cube for IGTVt volume... creating cube for BronchiLt volume... creating cube for PlanBody volume... creating cube for Body volume... creating cube for Table volume... creating cube for Skin volume... creating cube for T9 L volume... creating cube for T11 R volume... creating cube for T11 L volume... creating cube for T9 R volume... creating cube for L1 L volume... creating cube for T7 L volume... creating cube for T7 R volume... creating cube for L1 R volume... creating cube for L1 A volume... creating cube for T12 P volume... creating cube for T11 A volume... creating cube for T9 A volume... creating cube for T8 A volume... creating cube for Carina volume... finished!

importing ct-cube... creating info...Progress: 100.00 % reading slices...Progress: 100.00 %

z-coordinates taken from ImagePositionPatient

Interpolating CT cube...finished!

conversion of ct-Cube to Hounsfield units...finished!

Reading structures...Warning: Contour Breast is empty

In matRad_importDicomRtss (line 87) In matRad_importDicom (line 77) In matRad_importDicomGUI>import_button_Callback (line 330) In gui_mainfcn (line 95) In matRad_importDicomGUI (line 53) In matlab.graphics.internal.figfile.FigFile/read>@(hObject,eventdata)matRad_importDicomGUI('import_button_Callback',hObject,eventdata,guidata(hObject)) finished! creating cube for LungLt volume... creating cube for LungRt volume... creating cube for Lungs volume... creating cube for CTV volume... creating cube for PTV volume... creating cube for SpinalCord volume... creating cube for Breast volume... creating cube for Esophagus volume... creating cube for Heart volume... creating cube for NonTargetBody volume... creating cube for NonTargetLung volume... creating cube for Bones volume... creating cube for Rib volume... creating cube for Cord+5mm volume... creating cube for IGTVt volume... creating cube for BronchiLt volume... creating cube for PlanBody volume... creating cube for Body volume... creating cube for Table volume... creating cube for Skin volume... creating cube for T9 L volume... creating cube for T11 R volume... creating cube for T11 L volume... creating cube for T9 R volume... creating cube for L1 L volume... creating cube for T7 L volume... creating cube for T7 R volume... creating cube for L1 R volume... creating cube for L1 A volume... creating cube for T12 P volume... creating cube for T11 A volume... creating cube for T9 A volume... creating cube for T8 A volume... creating cube for Carina volume... finished! Reference to non-existent field 'visibleColor'.

Error in matRad_plotVoiContourSlice (line 48) colors(i,:) = cst{i,5}.visibleColor;

Error in matRadGUI>UpdatePlot (line 1051) AxesHandlesVOI = [AxesHandlesVOI matRad_plotVoiContourSlice(handles.axesFig,cst,ct,1,handles.VOIPlotFlag,plane,slice,[],'LineWidth',2)];

Error in matRadGUI>reloadGUI (line 371) UpdatePlot(handles)

Error in matRadGUI>btnRefresh_Callback (line 2666) handles = reloadGUI(hObject, handles, ct, cst);

Error in gui_mainfcn (line 95) feval(varargin{:});

Error in matRadGUI (line 81) gui_mainfcn(gui_State, varargin{:});

Error in matlab.graphics.internal.figfile.FigFile/read>@(hObject,eventdata)matRadGUI('btnRefresh_Callback',hObject,eventdata,guidata(hObject)) Error using matRadGUI>UpdatePlot (line 856) Error while evaluating UIControl Callback.

Reference to non-existent field 'visibleColor'.

Error in matRad_plotVoiContourSlice (line 48) colors(i,:) = cst{i,5}.visibleColor;

Error in matRadGUI>UpdatePlot (line 1051) AxesHandlesVOI = [AxesHandlesVOI matRad_plotVoiContourSlice(handles.axesFig,cst,ct,1,handles.VOIPlotFlag,plane,slice,[],'LineWidth',2)];

Error in matRadGUI>reloadGUI (line 371) UpdatePlot(handles)

Error in matRadGUI>btnRefresh_Callback (line 2666) handles = reloadGUI(hObject, handles, ct, cst);

Error in gui_mainfcn (line 95) feval(varargin{:});

Error in matRadGUI (line 81) gui_mainfcn(gui_State, varargin{:});

Error in matlab.graphics.internal.figfile.FigFile/read>@(hObject,eventdata)matRadGUI('btnRefresh_Callback',hObject,eventdata,guidata(hObject)) Error using matRadGUI>UpdatePlot (line 856) Error while evaluating UIControl Callback.

Reference to non-existent field 'visibleColor'.

Error in matRad_plotVoiContourSlice (line 48) colors(i,:) = cst{i,5}.visibleColor;

Error in matRadGUI>UpdatePlot (line 1051) AxesHandlesVOI = [AxesHandlesVOI matRad_plotVoiContourSlice(handles.axesFig,cst,ct,1,handles.VOIPlotFlag,plane,slice,[],'LineWidth',2)];

Error in matRadGUI>reloadGUI (line 371) UpdatePlot(handles)

Error in matRadGUI>btnLoadMat_Callback (line 539) handles = reloadGUI(hObject, handles, ct, cst);

Error in gui_mainfcn (line 95) feval(varargin{:});

Error in matRadGUI (line 81) gui_mainfcn(gui_State, varargin{:});

Error in matlab.graphics.internal.figfile.FigFile/read>@(hObject,eventdata)matRadGUI('btnLoadMat_Callback',hObject,eventdata,guidata(hObject)) Error while evaluating UIControl Callback.

If I try entering the plan info (gantry angle, couch angle etc.) manually and hit calculate influence mx I get the following error messages:

thumbnail_PastedGraphic-1

I was wondering if anyone else had any similar issues and might have an idea an idea on how to fix them.

wahln commented 4 years ago

I think the first message just means that we could not uniquely identify the dose cube that belongs to the pln via dicom uids. It may be that we miss some uid relation here, but usually this should not cause issues during the following import. The pln error is more difficult. When you import a plan via the GUI, the function matRad_importDicom is called. When an RTPlan is selected, this function will try to recreate the steering information of the plan. To do so it needs the base data for the machine. If you select the proton_Generic machine, the import will have wrong machine information as a reference (not the energies etc that you have in your machine etc) and crash. I guess that this behavior is not wanted in some cases. You can work around this error by commenting out the following lines in matRad_importDicom.m:

%% import stf
if isfield(files,'rtplan')
    if ~(cellfun(@isempty,files.rtplan(1,:)))
        if (strcmp(pln.radiationMode,'protons') || strcmp(pln.radiationMode,'carbon'))
            %% import steering file
            % pln output because bixelWidth is determined via the stf
            [stf, pln] = matRad_importDicomSteeringParticles(ct, pln, files.rtplan);
        elseif strcmp(pln.radiationMode, 'photons') && isfield(pln.propStf,'collimation')
            % return correct angles in pln 
            [stf, pln] = matRad_importDicomSteeringPhotons(pln);
        else
            warning('No support for DICOM import of steering information for this modality.');
        end
    end
end

I hope that this points you in the right direction, my experience with our dicom import for full-fledged proton plans is limited. What I can say is that in general, our GUI only models a very limited part of possible treatment planning workflows (GUIs are extremely resource-intensive to maintain).

wahln commented 4 years ago

Do you maybe have a dummy / phantom proton plan from eclipse in DICOM that you can share with us without patient data privacy issues? Then I could better analyze the errors.

bterracino commented 4 years ago

I did not try adjusting the code as you just sent, but I can test that.

Here is the data that I am working with. The CT series, structure, RT plan and dose DICOM files should all be there. Thank you so much for the help.

[https://r2.res.outlook.com/owa/prem/images/folder_16x16.png]pt14 testhttps://uflorida-my.sharepoint.com/:f:/g/personal/bterracino_ufl_edu/Evw_zeIE5vROjsg8oT0XrrEBYrr2Ik3QH7-K56AAZWFmhw?e=oOK1oB

Brandon Terracino SUNY Binghamton, 2015 Harpur College Of Arts & Sciences B.S. Physics

University of Florida, 2017 College of Biomedical Engineering M.S. Medical Physics


From: wahln notifications@github.com Sent: Friday, May 8, 2020 5:30 AM To: e0404/matRad matRad@noreply.github.com Cc: Terracino,Brandon T bterracino@ufl.edu; Author author@noreply.github.com Subject: Re: [e0404/matRad] Proton Dose calculation for DICOM RT plan from Eclipse (#416)

[External Email]

Do you maybe have a dummy / phantom proton plan from eclipse in DICOM that you can share with us without patient data privacy issues? Then I could better analyze the errors.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_e0404_matRad_issues_416-23issuecomment-2D625729374&d=DwMCaQ&c=sJ6xIWYx-zLMB3EPkvcnVg&r=n14VskTpPfDR--XeVp4wVZb5xTjzNKHawmLLFY10wjE&m=IGLOHMW_WmiMicAlEQgBIRZbsmTgygLkbaB5IG-kmpo&s=yS_JQtqvCyCuQSpVi6VKptQ8XMUgNyH8UodHAOZU0C8&e=, or unsubscribehttps://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_notifications_unsubscribe-2Dauth_ANZBPVAYPYBDAPSRUMNIKKLRQPGMTANCNFSM4M3S4QWQ&d=DwMCaQ&c=sJ6xIWYx-zLMB3EPkvcnVg&r=n14VskTpPfDR--XeVp4wVZb5xTjzNKHawmLLFY10wjE&m=IGLOHMW_WmiMicAlEQgBIRZbsmTgygLkbaB5IG-kmpo&s=hidkGsKrn_1PVBA3zPQaAiRPBBT-_ztElJkCEFfmJ2k&e=.

wahln commented 4 years ago

It seems like the data is incomplete.. I am missing some dicom slices? seems like there is a file size limit to the zip file?

bterracino commented 4 years ago

Hm not sure why that happened, sorry about that. I made a new zip file and link. One folder has only the CT images which should be about 80MB while the other folder has the plan, dose and structure file.

https://uflorida-my.sharepoint.com/:u:/g/personal/bterracino_ufl_edu/Ec3XyZsvEYlJvSvO482rqyABATLDVT4w_nFJ1hclxX7EFQ?e=I0uZeo

Brandon Terracino SUNY Binghamton, 2015 Harpur College Of Arts & Sciences B.S. Physics

University of Florida, 2017 College of Biomedical Engineering M.S. Medical Physics

On May 11, 2020, at 5:30 AM, wahln notifications@github.com wrote:

[External Email]

It seems like the data is incomplete.. I am missing some dicom slices? seems like there is a file size limit to the zip file?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_e0404_matRad_issues_416-23issuecomment-2D626587404&d=DwMCaQ&c=sJ6xIWYx-zLMB3EPkvcnVg&r=n14VskTpPfDR--XeVp4wVZb5xTjzNKHawmLLFY10wjE&m=9yAJ81R-Q73_kaQDJBNAEuQyPn6fBzIofx9py_hIo_w&s=XWgeoW5TwTE5AhozNkPMdDqto6bPal18BiPnC8WgqjI&e=, or unsubscribehttps://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_notifications_unsubscribe-2Dauth_ANZBPVARH5GI67U455TLZRTRQ7AUVANCNFSM4M3S4QWQ&d=DwMCaQ&c=sJ6xIWYx-zLMB3EPkvcnVg&r=n14VskTpPfDR--XeVp4wVZb5xTjzNKHawmLLFY10wjE&m=9yAJ81R-Q73_kaQDJBNAEuQyPn6fBzIofx9py_hIo_w&s=5p7yHkCkd8IIeXoMZ4zDGdcFxRIDVHuLeFLzxpeNopM&e=.

better0123 commented 4 years ago

Hello, I would like to ask if your problem has been solved and how?I had a similar problem, but mine was a photon.Did you make your own machine parameters?

bterracino commented 4 years ago

Hi,

I am still in contact with support over the problems. They had me send them the data I was working with. I had to manually enter the beam angle, couch angle and isocenter.

Sent from my iPhone

On May 11, 2020, at 7:46 PM, better0123 notifications@github.com wrote:

 [External Email]

Hello, I would like to ask if your problem has been solved and how?I had a similar problem, but mine was a photon.Did you make your own machine parameters?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_e0404_matRad_issues_416-23issuecomment-2D627024431&d=DwMCaQ&c=sJ6xIWYx-zLMB3EPkvcnVg&r=n14VskTpPfDR--XeVp4wVZb5xTjzNKHawmLLFY10wjE&m=FMTYWSbLYKUvlkii_VeMnapsNvp0_LixLhvgXli3KpE&s=i6KkrF-CfHYFQPJVxEVurLNlaaAJ0M200AX0rHNy6rg&e=, or unsubscribehttps://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_notifications_unsubscribe-2Dauth_ANZBPVF26OOGZGIDBMTJP7TRRCE47ANCNFSM4M3S4QWQ&d=DwMCaQ&c=sJ6xIWYx-zLMB3EPkvcnVg&r=n14VskTpPfDR--XeVp4wVZb5xTjzNKHawmLLFY10wjE&m=FMTYWSbLYKUvlkii_VeMnapsNvp0_LixLhvgXli3KpE&s=O_dW6in3db3-gVgisBOpll6_V4ZKTWh7wlSv0vavyYw&e=.

wahln commented 4 years ago

Maybe first let me clarify that we don't have the resources to "support" matRad as an end-user application. We develop matRad with the intent to provide a software toolkit usuable to the research community with reasonable scripting & programming effort on the user side. Especially the dicom import is subject to a vast amount of differing user data that we cannot ensure stability for every user. But we are happy to help in finding solutions by pointing in the right direction.

Now to the question: I looked at the data. With a little hacking I was able to import the data and create a plan. Here are my steps:

I managed to import the plan by replacing the line pln.machine = planInfo.BeamSequence.Item_1.TreatmentMachineName; with pln.machine = planInfo.(BeamParam).Item_1.TreatmentMachineName; in matRad_importDicomRTPlan which was indeed a bug.

The other thing I did was to comment out the above mentioned code section. Then matRad skips the stf import which is not directly possible since the machine . However, without the stf import the variables pln.propStf.bixelWidth will be set to NaN (should be a non-zero number setting the spot spacing, I set it manually to 5). Also, pln.machine will be 'GTR2' which does not exist (I then set it manually to 'Generic' from the command window).

The problem with the ray-tracing came from another thing done during the dicom import: matRad tries to determine targets from the dicom import via phrases in the name. Unfortunately, during import of your dataset it also sets NonTargetBody & NonTargetLung as structure type 'TARGET'. This is an issue since "NonTargetBody" covers the whole body and matRad then cannot determine the target geometry correctly during generation of the spot positions. The solution is to set NonTargetBody & NonTargetLung to the organ type 'OAR' (either in the cst from the command line or via GUI). After that I was able to generate stf, calculate dose and optimize a plan.

bterracino commented 4 years ago

Thank you so much for the help! I got it to work on my end as well.

Brandon Terracino SUNY Binghamton, 2015 Harpur College Of Arts & Sciences B.S. Physics

University of Florida, 2017 College of Biomedical Engineering M.S. Medical Physics

On May 12, 2020, at 5:18 AM, wahln notifications@github.com<mailto:notifications@github.com> wrote:

[External Email]

Maybe first let me clarify that we don't have the resources to "support" matRad as an end-user application. We develop matRad with the intent to provide a software toolkit usuable to the research community with reasonable scripting & programming effort on the user side. Especially the dicom import is subject to a vast amount of differing user data that we cannot ensure stability for every user. But we are happy to help in finding solutions by pointing in the right direction.

Now to the question: I looked at the data. With a little hacking I was able to import the data and create a plan. Here are my steps:

I managed to import the plan by replacing the line pln.machine = planInfo.BeamSequence.Item_1.TreatmentMachineName; with pln.machine = planInfo.(BeamParam).Item_1.TreatmentMachineName; in matRad_importDicomRTPlan which was indeed a bug.

The other thing I did was to comment out the above mentioned code section. Then matRad skips the stf import which is not directly possible since the machine . However, without the stf import the variables pln.propStf.bixelWidth will be set to NaN (should be a non-zero number setting the spot spacing, I set it manually to 5). Also, pln.machine will be 'GTR2' which does not exist (I then set it manually to 'Generic' from the command window).

The problem with the ray-tracing came from another thing done during the dicom import: matRad tries to determine targets from the dicom import via phrases in the name. Unfortunately, during import of your dataset it also sets NonTargetBody & NonTargetLung as structure type 'TARGET'. This is an issue since "NonTargetBody" covers the whole body and matRad then cannot determine the target geometry correctly during generation of the spot positions. The solution is to set NonTargetBody & NonTargetLung to the organ type 'OAR' (either in the cst from the command line or via GUI). After that I was able to generate stf, calculate dose and optimize a plan.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_e0404_matRad_issues_416-23issuecomment-2D627219715&d=DwMCaQ&c=sJ6xIWYx-zLMB3EPkvcnVg&r=n14VskTpPfDR--XeVp4wVZb5xTjzNKHawmLLFY10wjE&m=ZSqtRD12eMK78pFTcBufWBgXiC79qdxrmkqC2OaUjAs&s=z7HgOy7tJpq8HSReEXsLU7xW2sX1rWtGffuU3ns3igw&e=, or unsubscribehttps://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_notifications_unsubscribe-2Dauth_ANZBPVB34OC2663TKMSBG7TRREH6NANCNFSM4M3S4QWQ&d=DwMCaQ&c=sJ6xIWYx-zLMB3EPkvcnVg&r=n14VskTpPfDR--XeVp4wVZb5xTjzNKHawmLLFY10wjE&m=ZSqtRD12eMK78pFTcBufWBgXiC79qdxrmkqC2OaUjAs&s=lhScR3uewII2QNXsh7ggE8IKj29Xho93UA_NeebgmUM&e=.

yjq111 commented 4 years ago

Hello, I would like to ask where do you get the proton rtplan file?I am doing dose calculation and range verification in FLUKA based on CT.