Drawing a single ROI and then using it on multiple images in 3D matrix
4 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Hello everyone,
I am relatively new to matlab, and I am currently working on a medical image segmentation of a multiple images stored in a 3D matrix. I was trying to draw a ROI on a first slice and then use that ROI for all other slices to implement segmentation algorithm on them. But, after multiple tries I did not come up with a solution. The best what I was able to do is to draw ROI on EVERY single slice but that is taking to much time. Is there any easier way I could do this? Perhaps there's a way to automate or semi-automate this process so I don't have to draw ROI at each slice? Somehow I think that there is a simple solution to this, but I just can not find it.
CT is my 3D matrix that contains images. My code for drawing ROI is:
for i = 1:size(CT,3)
figure; imshow(CT (:,:,i), []);
hFH = imfreehand();
binaryImage(:,:,i) = hFH.createMask;
xy = hFH.getPosition();
blackMaskedImage =CT;
blackMaskedImage(~binaryImage) = 1;
setPositionConstraintFcn(hFH,xy);
close ();
end
Thanks in advance.
0 Commenti
Risposte (2)
Image Analyst
il 7 Ott 2014
Maybe something like this (untested):
hFig = figure; % Bring up a new figure.
for k = 1 : size(CT, 3)
subplot(1, 3, 1);
cla;
imshow(CT(:,:,i), []);
drawnow;
if k == 1
hFH = imfreehand();
binaryImage = hFH.createMask;
subplot(1, 3, 2);
cla;
imshow(binaryImage);
% Enlarge figure to full screen.
set(gcf, 'Units', 'Normalized', 'OuterPosition', [0 0 1 1]);
drawnow;
% xy = hFH.getPosition(); % Unused
end
blackMaskedImage = CT(:,:,i) .* uint8(binaryImage);
subplot(1, 3, 3);
cla;
imshow(blackMaskedImage);
drawnow;
end
0 Commenti
Vedere anche
Categorie
Scopri di più su Computer Vision with Simulink in Help Center e File Exchange
Prodotti
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!