[Insight-users] Find largest connected object in a Volume

Miller, James V (Research) millerjv at crd . ge . com
Tue, 1 Jul 2003 11:33:11 -0400


This message is in MIME format. Since your mail reader does not understand
this format, some or all of this message may not be legible.

------_=_NextPart_001_01C33FE5.17316CF0
Content-Type: text/plain;
	charset="iso-8859-1"

I just added a new filter to the ITK repository that relabels an image. The
input would the output of any segmentation algorithm that creates a label
map.  The ConnectedComponentImageFilter would be one such filter.  Watershed
would another, etc.  The filter is called RelabelComponentImageFilter and it
changes the labels in the image such that label 1 is assigned to the largest
object, label 2 is the next largest object, etc.  Any single object can be
extracted using BinaryThresholdImageFilter by setting the LowerThreshold and
the UpperThreshold to the same value.  In fact, any group of objects can be
extracted using BinaryThresholdImageFilter by having the LowerThreshold and
UpperThreshold span a group range (the ThresholdImageFilter can be used to
extract a range of objects without changing their labels again).
 
So using the RelabelComponentImageFilter in conjuction with a threshold
filter you can extract the largest object, the second largest object, or the
k largest objects.
 
Size is defined by area/volume/number of pixels, etc.
 
After the filter executes, you can query the number of objects, and the size
of each object.
 
Jim
 
 

-----Original Message-----
From: Miller, James V (Research) [mailto:millerjv at crd . ge . com] 
Sent: Friday, June 27, 2003 1:34 PM
To: 'cspl'; insight-users at itk . org
Subject: RE: [Insight-users] Find largest connected object in a Volume


In Code/BasicFilters there are two classes ConnectedComponentImageFilter and

HardConnectedComponentImageFilter.  The former is a rewrite of the latter to
use more of the ITK infrastructure. The latter may be removed soon.  
 
The ConnectedComponentImageFilter will use 6-connectivity in a volume to
label the objects in the volume.  Each connected object will have a unique
label.
 
However, this does not extract the largest connected object.  You would need
a separate filter (that does not exist yet) to scan through the label map
and extract the largest object.  As Luis suggested, you could a histogram of
the label map to determine which object is the "largest".
 
 

-----Original Message-----
From: cspl [mailto:affable at hd2 . dot . net . in]
Sent: Friday, June 27, 2003 2:19 AM
To: insight-users at itk . org
Subject: [Insight-users] Find largest connected object in a Volume


Hi Luis and all,
   I am in need of help on connectivity filter. Let me explain my
requirment.
   I have a volume of some slices. I have to find the largest object in the
entire volume. Initiallly i will threshold the image so that it will in
binary format. Then i have to use 6-connectivity of find the largest object
in the volume. The largest object should be labeled 1. Is there any filter
which solves my problem. I should use 6-connectivity. Please do suggest me
if there are other alternatives too.
   
   Please help me in this regard.
 
   Thanks in advance.
 
-Regards,
  Sateesh.


------_=_NextPart_001_01C33FE5.17316CF0
Content-Type: text/html;
	charset="iso-8859-1"

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">


<META content="MSHTML 6.00.2800.1141" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#ffffff>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN class=225062615-01072003>I just 
added a new filter to the ITK repository that relabels an image. The input would 
the output of any segmentation algorithm that creates a label map.&nbsp; The 
ConnectedComponentImageFilter would be one such filter.&nbsp; Watershed would 
another, etc.&nbsp; The filter is called RelabelComponentImageFilter and it 
changes the labels in the image such that label 1 is assigned to the largest 
object, label 2 is the next largest object, etc.&nbsp; Any single object can be 
extracted using BinaryThresholdImageFilter by setting the LowerThreshold and the 
UpperThreshold to the same value.&nbsp; In fact, any group of objects can be 
extracted using BinaryThresholdImageFilter by having the LowerThreshold and 
UpperThreshold span a group range (the ThresholdImageFilter can be used to 
extract a range of objects without changing their labels 
again).</SPAN></FONT></DIV>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN 
class=225062615-01072003></SPAN></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN class=225062615-01072003>So 
using the RelabelComponentImageFilter in conjuction with a threshold filter you 
can extract the largest object, the second largest object, or the k largest 
objects.</SPAN></FONT></DIV>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN 
class=225062615-01072003></SPAN></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN class=225062615-01072003>Size 
is defined by area/volume/number of pixels, etc.</SPAN></FONT></DIV>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN 
class=225062615-01072003></SPAN></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN class=225062615-01072003>After 
the filter executes, you can query the number of objects, and the size of each 
object.</SPAN></FONT></DIV>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN 
class=225062615-01072003></SPAN></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN 
class=225062615-01072003>Jim</SPAN></FONT></DIV>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN 
class=225062615-01072003></SPAN></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN 
class=225062615-01072003></SPAN></FONT>&nbsp;</DIV>
<BLOCKQUOTE dir=ltr 
style="PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #0000ff 2px solid; MARGIN-RIGHT: 0px">
  <DIV class=OutlookMessageHeader dir=ltr align=left><FONT face=Tahoma 
  size=2>-----Original Message-----<BR><B>From:</B> Miller, James V (Research) 
  [mailto:millerjv at crd . ge . com]<SPAN class=225062615-01072003><FONT face=Arial 
  color=#0000ff>&nbsp;</FONT></SPAN><BR><B>Sent:</B> Friday, June 27, 2003 1:34 
  PM<BR><B>To:</B> 'cspl'; insight-users at itk . org<BR><B>Subject:</B> RE: 
  [Insight-users] Find largest connected object in a Volume<BR><BR></FONT></DIV>
  <DIV><SPAN class=538382917-27062003><FONT face=Arial color=#0000ff size=2>In 
  Code/BasicFilters there are two classes ConnectedComponentImageFilter and 
  </FONT></SPAN></DIV>
  <DIV><SPAN class=538382917-27062003><FONT face=Arial color=#0000ff 
  size=2>HardConnectedComponentImageFilter.&nbsp; The former is a rewrite of the 
  latter to use more of the ITK infrastructure. The latter may be removed 
  soon.&nbsp; </FONT></SPAN></DIV>
  <DIV><SPAN class=538382917-27062003><FONT face=Arial color=#0000ff 
  size=2></FONT></SPAN>&nbsp;</DIV>
  <DIV><SPAN class=538382917-27062003><FONT face=Arial color=#0000ff size=2>The 
  ConnectedComponentImageFilter will use 6-connectivity in a volume to label the 
  objects in the volume.&nbsp; Each connected object will have a unique 
  label.</FONT></SPAN></DIV>
  <DIV><SPAN class=538382917-27062003><FONT face=Arial color=#0000ff 
  size=2></FONT></SPAN>&nbsp;</DIV>
  <DIV><SPAN class=538382917-27062003><FONT face=Arial color=#0000ff 
  size=2>However, this does not extract the largest connected object.&nbsp; You 
  would need a separate filter (that does not exist yet) to scan through the 
  label map and extract the largest object.&nbsp; As Luis suggested, you could a 
  histogram of the label map to determine which object is the 
  "largest".</FONT></SPAN></DIV>
  <DIV><SPAN class=538382917-27062003><FONT face=Arial color=#0000ff 
  size=2></FONT></SPAN>&nbsp;</DIV>
  <DIV><SPAN class=538382917-27062003><FONT face=Arial color=#0000ff 
  size=2></FONT></SPAN>&nbsp;</DIV>
  <BLOCKQUOTE dir=ltr 
  style="PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #0000ff 2px solid; MARGIN-RIGHT: 0px">
    <DIV class=OutlookMessageHeader dir=ltr align=left><FONT face=Tahoma 
    size=2>-----Original Message-----<BR><B>From:</B> cspl 
    [mailto:affable at hd2 . dot . net . in]<BR><B>Sent:</B> Friday, June 27, 2003 2:19 
    AM<BR><B>To:</B> insight-users at itk . org<BR><B>Subject:</B> [Insight-users] 
    Find largest connected object in a Volume<BR><BR></FONT></DIV>
    <DIV><FONT face=Arial size=2>Hi Luis and all,<BR>&nbsp;&nbsp; I am&nbsp;in 
    need of help on connectivity filter. Let me explain my 
    requirment.<BR>&nbsp;&nbsp; I have a volume of some slices. I have to find 
    the largest object in the entire volume. Initiallly i will threshold the 
    image so that it will in binary format. Then i have to use 6-connectivity of 
    find the largest object in the volume. The largest object should be labeled 
    1. Is there any filter which solves my problem. I should use 
    6-connectivity.&nbsp;Please do suggest me&nbsp;if there are&nbsp;other 
    alternatives&nbsp;too.<BR>&nbsp;&nbsp;&nbsp;<BR>&nbsp;&nbsp; Please help me 
    in this regard.</FONT></DIV>
    <DIV>&nbsp;</DIV>
    <DIV><FONT face=Arial size=2>&nbsp;&nbsp; Thanks in advance.</FONT></DIV>
    <DIV>&nbsp;</DIV>
    <DIV><FONT face=Arial size=2>-Regards,<BR>&nbsp; 
  Sateesh.</FONT></DIV></BLOCKQUOTE></BLOCKQUOTE></BODY></HTML>

------_=_NextPart_001_01C33FE5.17316CF0--