MATLAB Answers

HOW TO SAME THE RATIO

조회 수: 37(최근 30일)
mohd akmal masud
mohd akmal masud 5 Jan 2021
댓글: KSSV 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
KSSV
KSSV 5 Jan 2021
Have a look on imresize. With this you can get the images to the same dimension.

댓글을 달려면 로그인하십시오.

답변(0개)

Community Treasure Hunt

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

Start Hunting!

Translated by