HOW TO SAME THE RATIO

1 view (last 30 days)
mohd akmal masud
mohd akmal masud on 5 Jan 2021
Commented: KSSV on 5 Jan 2021
Hi all,
i have 60 image SPECT, and 203 image CT.
Dimension for SPECT is 103, and CT dimension is 256.
This coding below i develop for 3D.
But i got error at this ratio.
rats=size(RZ)./size( P(:,:,K) );
clear all
clc
warning off
P = zeros(103, 103, 60);
for K = 1 : 60
K_file=30+10*K;
petname = sprintf('I%d.dcm', K_file);
P(:,:,K) = dicomread(petname);
end
d=4;%first slice
Folder='ct';%input('***Please enter the CT/MRI data folder name : ','s');
aa=dir(num2str(Folder));
aa=struct2cell(aa);
Slice=size(aa);
Slice=Slice(2)-2;
f=1;ceil(Slice/300);% depands on PC capability 300 is optimum no of slice for this PC
c=round(Slice/f);%No of slices ...4yusoff
% clf
%RZ=zeros(round(400/f),round(500/f),round(c/f));
fprintf('\nReading images. Please wait...\n');
for a=d:1:Slice-1%Slice
clc
Percent=floor(a/(Slice-1)*100)
as=[ Folder '\I' num2str(a*10)];
[X, map]=dicomread([as]);
info = dicominfo([as]);
Y = dicomread(info);
RZ(:,:,Slice-a+3)=Y;%(dpnblkg,kanankiri)
end
RZ=double(RZ);
[N M L]=size(RZ);
rats=size(RZ)./size( P(:,:,K) );
[x,y,z]=meshgrid(rats(1):rats(1):M,rats(1):rats(2):N,rats(1):rats(3):L);
RZ=interp3(RZ,x,y,z);
ANYONE CAN HELP ME?
  5 Comments
mohd akmal masud
mohd akmal masud on 5 Jan 2021
because previous my dimension image for SPECT is 128, ant CT is 256.
Then my ratio like below
RZ=double(RZ);
[N M L]=size(RZ);
rats=size(RZ)./size( P(:,:,K) );
[x,y,z]=meshgrid(rats(1):rats(1):M,rats(1):rats(2):N,rats(1):rats(3):L);
RZ=interp3(RZ,x,y,z);
then its work
KSSV
KSSV on 5 Jan 2021
Have a look on imresize. With this you can get the images to the same dimension.

Sign in to comment.

Answers (0)

Community Treasure Hunt

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

Start Hunting!