How to guide bwconncomp to specific region of image?

2 visualizaciones (últimos 30 días)
Knut Skaug
Knut Skaug el 18 de Jul. de 2021
Editada: Matt J el 20 de Jul. de 2021
Hello,
I am new to image processing and have been trying to use bwconncomp() to identify components in images.
In my image there is a background which is set to zero or NaN. The area of interest is a circle where there are different values signifying specific regions of that circle that have more or less of some quantity. The image is similar to a topoplot https://www.google.com/search?client=firefox-b-d&q=topoplot
How can I guide bwconncomp() to only look for components inside the area of interest? My issue is that bwconncomp identifies more or less, the entire circle as one large component relative to the background.
  1 comentario
Rik
Rik el 18 de Jul. de 2021
Have you tried setting all pixels outside of the circle (and the circle itself) to false?

Iniciar sesión para comentar.

Respuesta aceptada

Image Analyst
Image Analyst el 19 de Jul. de 2021
I don't know what the different components are? The blue/purple regions? The colored region is just a continuum of colors smoothly varying and I don't know what would be a component in them. What do you want as a component? Not the circle you've told us. So what/where are the components? Can you outline each individual component in red and repost it?

Más respuestas (3)

Matt J
Matt J el 20 de Jul. de 2021
Editada: Matt J el 20 de Jul. de 2021
If you have a binary circleMask of the circular region, you can use bwlmaskpropfiltn (Download) to eliminate all objects in a label map L that arenot completely contained in the circle
Lmasked= bwlmaskpropfiltn(L,circleMask,'AreaRelSelf',[1,inf]) ;

Image Analyst
Image Analyst el 18 de Jul. de 2021
Editada: Image Analyst el 18 de Jul. de 2021
Make a mask of the circle and use it to erase everything outside of the circle, then call bwconncomp() To maks a circle mask, see the FAQ:
Or you can threshold your original image.
then use it to mask your binary image
binaryImage(~circleMask) = false; % Erase outside circle.
cc = bwconncomp(binaryImage);
Attach your image if you need more help.
See my image segmentation tutorial
  2 comentarios
Knut Skaug
Knut Skaug el 19 de Jul. de 2021
Thank you for your response - also, interesting website. I'll check out the tutorial.
The thresholding is done by setting all values inside the circle which falls below the threshold to zero. It is done by through non-parametric permutation testing - clustering.
So, the input to bwconncomp has zeros designating the background - and zeros designating the below-threshold-areas. What should be left are regions above the threshold. From a lot of visualizing at many iterations through the permutation, I do think the transitions from 0 (nothing) to some value >0, are too gradual or, not 'edgy' enough. These are too smooth in too permutations. Even using a mask, the bwconncomp still identifies the above threshold values as one or sometimes two clusters, or if the transitions between >0 values are too smooth, one cluster which is the background relative to the >0 values. It would be good to have something like a spotlight input to bwconncomp - have it start at some index.
Image Analyst
Image Analyst el 19 de Jul. de 2021
Sure, I'll help if you let me. Attach your image if you need more help.
You can try a closing with imclose() to merge nearby blobs together into a single blob.

Iniciar sesión para comentar.


Knut Skaug
Knut Skaug el 19 de Jul. de 2021
Thank you.
If I could, I would make an image out of the matrix used for plotting in matlab, however, the attached image is the only solution for now unfortunately. The first is imagesc(matrix) the second is an example of a topoplot of the same matrix. The axis are flipped between the images, but one can see what the challenge is, more easily in the imagesc visualization.

Categorías

Más información sobre 3-D Volumetric Image Processing en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by