-1

I have a CT lung 3d volume, I am using matlab to extract nodules and classify it ... I need to eliminate "delete" the air ways from the volume, in order to minimize suspected nodules, there is a connected component function in matlab but it works only with 2d images .. Hence I need a 3d connected component function, the largest connected component in the lung will be the airways, if I handled it I will be able to delete it from my volume, In brief, I need to detect the largest connected component in the volume

Ahmed Hassaan
  • 99
  • 1
  • 12
  • Are you saying you want to use "imclose" but in 3D? – DomDev May 06 '16 at 15:59
  • I need to detect the largest connected component in the 3D – Ahmed Hassaan May 06 '16 at 17:22
  • Please reformulate your question to make it clearer and easier to understand. – DomDev May 06 '16 at 18:07
  • The [documentation](http://www.mathworks.com/help/images/ref/bwconncomp.html) says "`bwconncomp` uses a default connectivity of 8 for two dimensions, 26 for three dimensions". So, if you're having trouble using the `bwconncomp` function in 3 dimensions then we probably need to see some code to figure out what's wrong. – beaker May 12 '16 at 02:04

1 Answers1

0

The matlab function bwareaopen allows to remove the groups of pixels that are smaller than the number you specify, and it works in 3D. It works with binary images, with the image pixels having a value "1" or "true", and background pixels having a value "0" or "false". Therefore, if there is a group of pixels of value "1" that contains less than a number "P" of pixel, it will be removed.

In your case, I think you want to remove the empty space, which means you simply have to inverse the image before and after using this function. An example is presented below:

% Remove white regions with less than 10 pixel
my3DimageNEW = bwareaopen(my3Dimage, 10);

% Remove black regions with less than 10 pixel
my3DimageNEW = ~bwareaopen(~my3Dimage, 10);
DomDev
  • 540
  • 2
  • 12
  • Thank you but first I need to know which is the largest connected component in the image in order to remove it, .. in 2d there is a function called "bwconncomp(BW , 1)" which returns with the largest connected component in the 2D, but in 3D it does not work – Ahmed Hassaan May 06 '16 at 18:16
  • Check the function "bwlabeln" in matlab. It allows to associate a number to each group of connected pixels. BW = cat(3, [1 1 0; 0 0 0; 1 0 0],... [0 1 0; 0 0 0; 0 1 0],... [0 1 1; 0 0 0; 0 0 1]); BWlabeled = bwlabeln(BW); – DomDev May 06 '16 at 18:22
  • Once you have that, each pixel will have a value of 1, 2, 3... associated. You can loop to manually extract the number of pixels in each region, or you can use "regionprops(BWlabeled, 'area')" to get the area of all regions. – DomDev May 06 '16 at 18:26
  • I am still trying but it will be great if you can provide the code, really thank you – Ahmed Hassaan May 10 '16 at 20:28