Why do I get distorded Sagittal and Coronal planes?

I use the imshow3dfull from the community (see https://uk.mathworks.com/matlabcentral/fileexchange/47463-imshow3dfull--3d-imshow-in-3-views -). I get distorded sagittal and coronal planes like in the pic I enclose. What do I do wrong? Anyone help please?

8 Comments

Jan
Jan on 11 May 2018
Edited: Jan on 12 May 2018
"From the community" is not a unique definition. Please post exactly, where this tool is coming from. Prefer to post a link. Then start with asking the author and post, what he or she has answered. Provide the inputs in addition.
[EDITED] See also the thread concerning the same problem: https://www.mathworks.com/matlabcentral/answers/400230-why-do-i-get-this-thin-line . Please post one thread per problem only. Thanks.
Yes Jan you are right. But this thread is different error than my previous one. Now I got normal size plane but distorted. Previously, I got only one slice, so they are different problems
Did you read the first paragraph of my comment? It is your interest to provide the details required to answer your question.
Actually now I get correct sagittal and coronal planes but reduced in size in comparison to axial. So axial plane is normal and sagittal and coronal are half of the windows size. How do I fix this and make them same size (256x256)? See attached.
You did not explain, what you have done so far. Then suggesting any changes is hard.
I use this function to make isotropic voxel size via interpolation. That's why I got correct outcome. But still don't know how to increase the image plane. Any suggestion? Must be embedded to the below function
function IsoImage = makeImIsoRGB( nonIsoImage, Voxel_size, dim, method )
%MAKEIMISO is used to make an isotropic image from a non-isotropic image
%using interpolation.
% IsoImage = makeImIso( nonIsoImage, Voxel_size, dim, method )
%
% nonIsoImage: original image (non-isotropic)
% Voxel_size: voxel dimension (1-by-3 array)
% dim: new dimension of the isotropic voxel (scalar) [default:
% Voxel_size(1)]
% method: interpolation method [default: 'nearest']
%
% IsoImage: output image (isotropic)
%
% Example:
% load mri
% Image = squeeze(D);
% isoImage = makeImIso(Image, [1,1,128/27]);
% isoImage = makeImIso(Image, [1,1,128/27], 2);
% isoImage = makeImIso(Image, [1,1,128/27], 0.5, 'cubic');
%
if nargin < 3
dim = Voxel_size(1);
method = 'nearest';
elseif nargin < 4
method = 'nearest';
end
imDimensions = size(nonIsoImage);
xRatio = double(Voxel_size(1)/dim);
yRatio = double(Voxel_size(2)/dim);
zRatio = double(Voxel_size(3)/dim);
[oX,oY,oZ] = meshgrid(0:imDimensions(2)-1, 0:imDimensions(1)-1, 0:imDimensions(3)-1);
oX = double(oX); oY = double(oY); oZ = double(oZ);
[iX,iY,iZ] = meshgrid(0:1/xRatio:imDimensions(2)-1, 0:1/yRatio:imDimensions(1)-1, 0:1/zRatio:imDimensions(3)-1);
iX = double(iX); iY = double(iY); iZ = double(iZ);
IsoImage = [];
if numel(imDimensions) > 3
for ch = 1:imDimensions(4)
IsoImage = cat(4, IsoImage, interp3(oX, oY, oZ, double(nonIsoImage(:,:,:,ch)), iX, iY, iZ, method));
end
else
IsoImage = interp3(oX, oY, oZ, double(nonIsoImage), iX, iY, iZ, method);
end
if strcmpi(class(nonIsoImage),'uint8')
IsoImage = uint8(IsoImage);
elseif strcmpi(class(nonIsoImage),'uint16')
IsoImage = uint16(IsoImage);
elseif strcmpi(class(nonIsoImage),'uint32')
IsoImage = uint32(IsoImage);
elseif strcmpi(class(nonIsoImage),'uint64')
IsoImage = uint64(IsoImage);
elseif strcmpi(class(nonIsoImage),'int8')
IsoImage = int8(IsoImage);
elseif strcmpi(class(nonIsoImage),'int16')
IsoImage = int16(IsoImage);
elseif strcmpi(class(nonIsoImage),'int32')
IsoImage = int32(IsoImage);
elseif strcmpi(class(nonIsoImage),'int64')
IsoImage = int64(IsoImage);
elseif islogical(nonIsoImage)
IsoImage = logical(IsoImage);
end
end
I still do not know where you want to "increase the image plane". What exactly is the "image plane"? Do you want to interpolate the data or to increase the size on the screen? Maybe all you want is to change the Voxel_size?
By the way, the last part of your code can be simplified:
IsoImage = cast(IsoImage, class(nonIsonImage));
This is much easier and less prone to typos than a bunch of almost equal IF branches.
Dear Jan Can you please indicate me the line that can be simplified. The truth is that I get an error "OUT of MEMORY", whenever I call this function by using 0.5, 'cubic'. It seems is too large for Matlab to calculate.
The image plane size is determined by the z axis on how many slices I will call. For instance if you put [1,1,2] it will be just two slices (very thin) but if you call [1,1,15] it will be the whole plane since 15 are all slices

Sign in to comment.

Answers (0)

Categories

Asked:

on 11 May 2018

Community Treasure Hunt

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

Start Hunting!