How to display some images and select one to Crop it

1 view (last 30 days)
Hello erveryone,
I need to display a directory with 300 dicom images, and one of them it is the one which I want to crop to work later in other function. I have created this function:
for z=1:size(directory)
archive = directory(z).name;
R3 = (dicomread(archive));
% cro=imcrop(R3);
I have included a 3 seconds pause to watch each image, but I don't know how to include the imcrop condition when I see the correct image to save this crop and get out of the function.
Could you help me?

Accepted Answer

Image Analyst
Image Analyst on 11 Apr 2015
Put this in your loop:
promptMessage = sprintf('Do you want to Crop this image,\nor Skip this image?');
titleBarCaption = 'Continue?';
button = questdlg(promptMessage, titleBarCaption, 'Crop', 'Skip', 'Skip');
if strcmpi(button, 'Crop')
croppedImage = imcrop(R3);
  1 Comment
Jose Andrés
Jose Andrés on 11 Apr 2015
Oh, thank you so much! That was exactly what I was looking for.
Thank you mate!

Sign in to comment.

More Answers (0)


Find more on Images in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!