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

Dose comparison parts in RT Slicer #7380

Open
Y-kiumarsi opened this issue Nov 12, 2023 · 9 comments
Open

Dose comparison parts in RT Slicer #7380

Y-kiumarsi opened this issue Nov 12, 2023 · 9 comments

Comments

@Y-kiumarsi
Copy link

Y-kiumarsi commented Nov 12, 2023

Summary

How to fill the dose comparison parts in RT Slicer? I mean, how much should I place in Mask structure, Gamma volume and other parts?

When I use RT Slicer from dose comparison, after clicking on dose comparison, the software closes after a few seconds and does not work. I am sending you a picture as an attachment, after a few seconds the software closes. My reference dose was the output from MATLAB, which I somehow converted into dose format so that the software for dose measurement accepts it as the dose volume, and I compared it with the dose that I obtained from TPS and the rest of the parts according to the image I filled.

I don't know if there is a problem in filling the dose comparison fields or if it is another problem
Screenshot (17)

Environment

Operating system: windows 10
Slicer version: 5.4.0

@Y-kiumarsi
Copy link
Author

When I give the output of this MATLAB code to the 3D Slicer software in the dose comparison RT slicer module as a reference volume, this module does not work, which seems to be a problem with the file that I load from MATLAB as a reference volume: % Read an image
img = imread('2.tif.tif'); % replace with your actual image file

% Convert the image to double precision
img = double(img);

% Apply the formula to each pixel value
newImg = 0.000034img.^2 - 0.017730img + 2.146234;

% Save the output in the form of a DICOM file
dicomwrite(newImg, 'output1.dcm');

@cpinter
Copy link
Member

cpinter commented Nov 13, 2023

To reproduce the crash we will need the data. Can you provide it? Is it all anonymized? If not, then can you reproduce the crash with publically available data?

@cpinter
Copy link
Member

cpinter commented Nov 13, 2023

For reference

https://discourse.slicer.org/t/issue-with-dose-comparison/32398/3

https://discourse.slicer.org/t/issue-in-dose-comparison-in-rt-slicer/32734

https://discourse.slicer.org/t/dose-comparison-parts-in-rt-slicer/32735

@Y-kiumarsi please do not post so aggressively, everyone in the community provides support from their own free time out of trying to be nice. Thank you

@Y-kiumarsi
Copy link
Author

Y-kiumarsi commented Nov 13, 2023

I put the attached image in the code below in MATLAB and gave the output as a reference dose volume to RT Slicer:
% Read an image
img = imread('2.tif.tif'); % replace with your actual image file

% Convert the image to double precision
img = double(img);

% Apply the formula to each pixel value
newImg = 0.000034img.^2 - 0.017730img + 2.146234;

% Save the output in the form of a DICOM file
dicomwrite(newImg, 'output1.dcm');

and rt-dose sagittal planar of TPS as evaluated dose volume

1.2.840.114358.189250942729016.20230802182207.11058345633664_planar_sagittal.zip
output1.zip
2.tif.zip

Thank you for taking the time to help and accept my apologies for the previous posts

@cpinter
Copy link
Member

cpinter commented Nov 20, 2023

I do not have Matlab, please provide only DICOM or nrrd. Also, give us a detailed list of steps you took before you experience the crash to facilitate reproducing it. Thanks.

@lassoan
Copy link
Contributor

lassoan commented Nov 20, 2023

TIFF file format cannot store 3D data, as there is no standard way to store the image origin, spacing, and axis directions. Instead you can save your 3D array from Matlab into NRRD format using nrrdwrite.m. Make sure you set the IJK to LPS transform correctly (it specifies the image origin, spacing, and axis directions).

@Y-kiumarsi
Copy link
Author

Y-kiumarsi commented Nov 26, 2023

TIFF file format cannot store 3D data, as there is no standard way to store the image origin, spacing, and axis directions. Instead you can save your 3D array from Matlab into NRRD format using nrrdwrite.m. Make sure you set the IJK to LPS transform correctly (it specifies the image origin, spacing, and axis directions).

thank you
How should I use this code?
I entered this code into MATLAB, but I did not understand in which part of this code I should put my file and I encountered an error.

@Y-kiumarsi
Copy link
Author

Y-kiumarsi commented Nov 26, 2023

I do not have Matlab, please provide only DICOM or nrrd. Also, give us a detailed list of steps you took before you experience the crash to facilitate reproducing it. Thanks.

1.2.840.114358.189250942729016.20230814180808.15910414619830_planarcouch_sagittal.zip
output1.zip
These two files are the DICOM files that I upload in Dose Comparison
One is taken from TPS and the other is a Gaff Chromic film scan, which I converted to dose using the equation obtained from the film calibration, and I got the output of Dicom, and now I want to compare it with the Dicom file I got from TPS. 1.2.840.114358.189250942729016.20230814180808.15910414619830_planarcouch_sagittal is from TPS & output1 is from MATLAB. Thanks.

@cpinter
Copy link
Member

cpinter commented Dec 4, 2023

I looked at the data and I found various issues:

  • The two dose volumes are one slice each, and the Dose Comparison module is designed to work with 3D doses
  • The two images are not registered. They appear on different planes. Moreover, one contains non-image data such as ruler

So even if there was no crash, comparison would not be possible (see first point above). I could potentially fix the crash, but it wouldn't help your case. Since you use Matlab to begin with, I suggest using some Matlab-based gamma algorithm, for example this one: https://github.com/mwgeurts/gamma

For the record, this is the call stack for the crash:
image

It seems that there is an issue with converting the VTK image data to ITK format so that the gamma algorithm in Plastimatch can be run. The image whose conversion crashes is the non-RT one (modality: OT) in output1.zip above.

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

No branches or pull requests

3 participants