I have 4 files. An mha file of the original CT scan, an mha file of the annotated CT scan, and its respective mat file. Both mat files have the of size 512 x 512 x 38. If you open SG.mha on 3DSlicer, you will see the annotation of tumor as you go through all the slices. I want to create a script where it goes through all the SG.mat slices, finds the slices that have the tumor in it, correspond it to the CT.mat, and then only look at the area of interest (the tumor).
*I uploaded the Annotated scans, but I am unable to upload the CT scans even after compressing the file.

1 Kommentar

For example, I have multiple slices that look like this. The tumor is in white.

Melden Sie sich an, um zu kommentieren.

 Akzeptierte Antwort

darova
darova am 1 Apr. 2020
Use find and sum
find(sum(sum(SG,1),2)) % number of nonzero slices

6 Kommentare

This does give me a range of slice! Thank you! But what does (sum(sum(SG,1),2) mean/do and how what do the numbers, ,1),2) mean?
darova
darova am 1 Apr. 2020
It sums rows and then columns. Only 3d dimension remains. find finds nonzero values (their indices)
So that's how we get only the slides which contains the frame!!! Thank you so much! I am new to MATLAB so I have another question. I want the slides that I got from find(sum(sum(SG,1),2)) and look at these slides in CT.mat. How do I do this?
First load CT.mat to your MATLAB
ix = find(sum(sum(SG,1),2)); % get indices
CTSG = CT(:,:,ix); % get appropriate slices (3d dimension)
Thank you!
darova
darova am 1 Apr. 2020
happy to help!

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by