MATLAB Answers

0

how to save the cropped image in to list and add

Asked by andhavarapu lokesh on 9 Dec 2016
Latest activity Answered by KSSV
on 9 Dec 2016
i wanted the cropped image to save and then add all those area of the cropped image
{projectdir = 'E:\SHIVA BACKUP\THYROID\P1\newcodes\data1\13002';
%y = 72;
X = zeros(128, 128, 1, 72,'uint16');
% Read the series of images.
% for p=1
p=1;
thisfile = sprintf('IM_%d.dcm', p);
filename = fullfile( projectdir, thisfile );
imdata = dicomread(filename);
imsize = size(imdata);
if ~isequal( imsize, [128 128 1 72] )
fprintf('file is unexpected size %s instead of [128 128 1 72], skipping "%s"\n', mat2str(imsize), filename);
else
X(:, :, :, :,p) = imdata;
end
figure();
montage(X(:,:,:,:,p), [0 100])
a=zeros(128,128,72) ;
for i=1:18
a=getpix(X(:,:,:,i));%i have a function with getpix(grayscale) to crop the image
a.list();
% u=edge(a,'canny','both');
% v{i}=bwmorph(u,'skel',inf);
% %v=bwmorph(u,'skel',inf);
% figure()
% montage(a,[0 100])
end}
In an assignment A(:) = B, the number of elements in A and B must be the same.
Error in Untitled8 (line 22)
a(i)=getpix(X(:,:,:,i));

  0 Comments

Sign in to comment.

1 Answer

Answer by KSSV
on 9 Dec 2016

In
a(i)=getpix(X(:,:,:,i));
Check the size of getpix(X(:,:,:,i)) and assign it to a. Here you have considered a as vector but the output getpix(X(:,:,:,i)) is not a number, it seems to be a array/ matrix.
Read about debuger in matlab. It help you in understanding code a lot.

  0 Comments

Sign in to comment.