how to change the image from axial to sagittal

Dear All
I have Image as you can download from link here (https://drive.google.com/file/d/1UWWDY07p4QJKOhkTj-CSe4tZcU8cjmeV/view?usp=sharing).
But when I evelaute my coding, the image show as axial view. Anyone know how to change it into sagittal view?
clc
clear all
close all
sz = [128 128 128];
fname = 'jaszak166_dew_w2.h00_it4.img';
fid = fopen(fname);
data = fread(fid,'*float'); % assuming uint
fclose(fid);
% this is blindly devectorized
% may still be transposed, but i can't tell due to symmetry
% note that data is binarized on a [0 1000] scale in uint16
% so if viewing in a denormalized manner, it'll just appear black
% normalize or rescale it as needed
data = reshape(data,sz);
imtool3D(data)

2 Comments

Hi @mohd akmal masud, the drive link is not accessible. Could you please share the image in the comments section instead?
Dear @Vinay, here you go https://drive.google.com/file/d/10EUsydCVzIYAaQMXOvzzg4K9L6nw6SLc/view?usp=sharing

Sign in to comment.

 Accepted Answer

imtool3D() is not a native Matlab function, but I imagine if you permute your data permute(data,[3,1,2]) so that its slices are sagittally aligned, it will display the way you wish.

6 Comments

I'm glad, but please Accept-click the answer to indicate so.
Dear @Matt J,
I tries to convert it into .dcm but failed.
clc
clear all
close all
sz = [128 128 128];
fname = 'nemay90_sca_w1.h00_it4.img';
fid = fopen(fname);
data = fread(fid,'*float'); % assuming uint
fclose(fid);
% this is blindly devectorized
% may still be transposed, but i can't tell due to symmetry
% note that data is binarized on a [0 1000] scale in uint16
% so if viewing in a denormalized manner, it'll just appear black
% normalize or rescale it as needed
data = reshape(data,sz);
data1 = im2uint16(data);
data2 = permute(data1,[3,1,2]);
dicomwrite(data2,'NEWDATA.dcm','CreateMode', 'copy');
ERROR
Error using dicom_copy_IOD>getIOD
Missing required attribute (0008,0016) "SOPClassUID"
Error in dicom_copy_IOD (line 26)
IOD_UID = getIOD(metadata, options, dictionary);
Error in dicomwrite>write_message (line 97)
[attrs, status] = dicom_copy_IOD(X, map, ...
Error in dicomwrite (line 28)
Dear @Matt J
the images can get https://drive.google.com/file/d/10EUsydCVzIYAaQMXOvzzg4K9L6nw6SLc/view?usp=sharing
Writing to dicom is a tricky thing, but also seems unnecessary for the purposes of your posted question. imtool3D doesn't need its input in DICOM form.

Sign in to comment.

More Answers (0)

Categories

Find more on Convert Image Type in Help Center and File Exchange

Products

Release

R2023a

Asked:

on 11 Oct 2024

Commented:

on 11 Oct 2024

Community Treasure Hunt

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

Start Hunting!