e0404 / matRad

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

Independent dose calculation in carbon therapy #753

Closed ni484call5 closed 3 months ago

ni484call5 commented 4 months ago

Hello,

I'm trying to import log file, recorded by nozzle while beam on in carbon therapy, to matRad and recalculating dose in TG119 phantom. The dose calculated from log file by matRad will be compared with origin treatment planning by the method of 2 dimension gamma index. For the purpose mentioned above, I've built base data for specific machine matching machine.data.Z, depth, sigma etc with log file. And next, I guess i should convert log file to stf and use matRad_calcDoseDirect.m. While I can't figure out how to do that? Or you will suggest me to do that by importing log file through matRad_importDicom.m?

regards, nicholas

wahln commented 4 months ago

You are on the right track.

Happy to help you with this along the way if you encounter obstacles or wonder about a specific thing / variable from the log-file to correctly set-up in the stf.

github-actions[bot] commented 3 months ago

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.

ni484call5 commented 3 months ago

Thanks your reply.

As your first suggestion, I replace value, spot position and mu, in plan with the one recorded in log file. Then, import the modified RT plan into .mat file with the import function in matRadGUI and calculating dose with the .mat file. The process works well.

Next step, In order to increase app efficiency and save time, I try to import only original RTPlan and CT, no RTStruct, into matRad by dicom import function in matRadGUI. The .mat file is created well. Then, using matRad_calcDoseDirect.m with it, the .mat file,

  1. In the first case, an patient RT plan, the dose distribution shown on matRad is broken. Pasted image 20240807210035

  2. In the second case, an 10*10*10 uniform 2Gy physical dose deposited in water tank, the error shows up

    
    Warning: ray does not hit patient. Trying to fix afterwards... 
    Error using matRad_computeSSD>matRad_closestNeighbourSSD (line 100)
    Could not fix SSD calculation.

Error in matRad_computeSSD (line 77) stf(i).ray(j).SSD = matRad_closestNeighbourSSD(rayPos_bev, SSD, rayPos_bev(j,:));

Error in matRad_calcDoseInit (line 148) stf = matRad_computeSSD(stf,ct);

Error in matRad_calcParticleDose (line 39) matRad_calcDoseInit;

Error in matRad_calcDoseDirect (line 74) dij = matRad_calcParticleDose(ct,stf,pln,cst,calcDoseDirect);

Error in nL_excutePlan (line 12)



I'll try to figure out the importance of RTStruct in the process mentioned above and the possibility to skip it while import RTPlan and calculate dose.

regards,
nicholas
wahln commented 3 months ago

matRad uses the contours to internally figure out where to calculate results. I would suggest to at least have a contour for the whole patient body and a target contour. I've never seen the behavior you observe in your dose distribution, but it can be very well related to missing contours. Also rays missing the patient can be related to that.

Also I suggest to run your stuff with our current "dev" branch.