Error in im2 (line 39) imshow(ImgSg);
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
ImgAx = siz_img;
if verLessThan('matlab', '8')
ImgSg = flipdim(permute(siz_img, [3 1 2 4]),1); % Sagittal view image
ImgCr = flipdim(permute(siz_img, [3 2 1 4]),1); % Coronal view image
else
ImgSg = flip(permute(siz_img, [3 1 2 4]),1); % Sagittal view image
ImgCr = flip(permute(siz_img, [3 2 1 4]),1); % Coronal view image
end
figure
imshow(ImgSg);
figure
imshow(ImgCr);
Why is this error?
4 Kommentare
Geoff Hayes
am 5 Dez. 2017
Stelios - having the full code does not necessarily help as it is the dicom images that may be needed to solve this problem.... Without them, I still won't be able to determine the dimensions or data type of siz_img...
Antworten (1)
Walter Roberson
am 5 Dez. 2017
siz_img is a row vector of dimensions of image Z01 . The assignment ct3d(:,:,1) = img would not work if img was more than 2D, so siz_img is a row vector of length 2. When you permute(siz_img, [3 1 2 4]) then the second dimension would move to the third dimension, so the output would be 1 x 1 x length(siz_img) = 1 x 1 x 2. You then try to imshow() that 1 x 1 x 2, which fails because imshow() can only handle arrays that are either 2D or 3D with the third dimension being length 3.
It would probably make more sense to be permuting the ct3d instead. However, when you do so, unless the original image just happened to be 3 pixels wide, you are going to encounter the same problem with imshow()
The only built-in MATLAB function for displaying volumes is the R2017a and later volumeViewer()
0 Kommentare
Siehe auch
Kategorien
Mehr zu DICOM Format finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!