Domanda

So I have a CT scan image. I want to display the ascending and descending aorta but nothing else. I have most of the code working, the only thing that I can't get is when it loops through the list of labels, it won't hold on the ascending to the figure, so I end with just the descending or to perhaps make more sense, it's only displaying one object when it should display 2.

%% set boundaries and get areas

%set boundaries and label objects
[B,L] = bwboundaries(AAB,'noholes');

%get the Filled Area of these objects
area = regionprops(L,'FilledArea');

%% display objects based on area

figure;
for k=1:size(area)

   if (area(k).FilledArea > 1500)
       imshow(L==(k));
       hold on;
   end
end

I have checked the area values and 1500 is a suitable amount the show the two.

AAB is the binary image I have created from the original scan.

Thanks in advance for any help

È stato utile?

Soluzione

imshow doesn't support holding, like a plot would. So it is just printing over the previous image.

If you only have two images, you can use imshowpair instead. Or assign a different color to each of your labels.

Or do something like:

mask=zeros(size(L));
figure;
for k=1:size(area)

   if (area(k).FilledArea > 1500)
       mask=mask+(L==(k));
   end
end

imshow(mask>0);
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top