I read 3D volume whose size 240x240x155 and I want to read slice by slice and wants to apply feature extraction techniques on them How I can read one slice than other?
1 visualizzazione (ultimi 30 giorni)
Mostra commenti meno recenti
Javaid Iqbal
il 2 Giu 2018
Commentato: Javaid Iqbal
il 8 Giu 2018
Hello Please, may you help me to read the 3D volume in MATLAB?
v=niftiread('Brats17_2013_2_1_flair.nii.gz');
figure, imshow(v(:,:,85),[]);
%how to read slice#1 than slice#2 and so on
0 Commenti
Risposta accettata
Walter Roberson
il 2 Giu 2018
for slicenumber = 1 : size(v,3)
this_slice = v(:,:,slicenumber);
this_result = YourFeatureExtractionCallGoesHere(this_slice);
all_results{slicenumber} = this_result;
end
Sometimes other data structures would be more appropriate than a cell array: it depends on what data type is returned by YourFeatureExtractionCallGoesHere
3 Commenti
Walter Roberson
il 8 Giu 2018
Yes, but it is unlikely that would be efficient if you are still building the data structure.
If you have a cell array in which the entries are all the same size, then you can use something like
cat(3, all_results{:})
to get a 3 dimensional array of the component parts.
But if that was your aim, then better would be to just store them in 3D in the first place:
numslices = size(v,3);
for slicenumber = 1 : numslices
this_slice = v(:,:,slicenumber);
this_result = YourFeatureExtractionCallGoesHere(this_slice);
all_results(:,:,slicenumber) = this_result;
if slicenumber == 1 && numslices ~= 1
all_results(end,end,numslices) = 0;
end
end
The if logic there takes the 2d array all_results of unknown size and extends it to have numslices panes in an efficient way
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Basic Display in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!