Do someone know how to crop the image in matlab but the crop image result should be square?? so , width and height should be the same size.. thank you..
im=dicomread('078tm.L.dcm');
A=double(im);
B = A/max(A(:));
crop= imcrop(B);
[w h]=size(crop);
if w~=h
sizew=w;
sizeh=h;
if sizew > sizeh || sizeh < sizew
w=sizew-sizeh
else
h=sizeh-sizew
end
end
crop2= imcrop(B,[crop(1) crop(2) w h]);
dicomwrite(crop2, 'a.dcm');
i don't think is right , because i dont know how to get the position image crop.