[Insight-users] 2. Selective FloodFilling and Region Growing

Miller, James V (Research) millerjv at crd.ge.com
Wed, 21 Apr 2004 09:25:07 -0400


I imagine an image function operating on two images written such that 
if the "mask" image is off, it would not evaluate the input image.

template <class TInputImage, class TMaskImage, class TCoordRep>
bool
MaskedBinaryThresholdImageFunction<TInputImage,TMaskImage,TCoordRep>
::EvaluateAtIndex(const IndexType& index) const
{
	if ( !m_Mask || (m_Mask->GetPixel(index) < m_MaskThreshold) )
        {
	  return false;
        }
	else
	  {
    	  PixelType value = m_Image->GetPixel(index);
        return ( m_Lower <= value && value <= m_Upper);
        }
}

Wouldn't this have the efficiency you are looking for?

We will still need to modify the ConnectedThreshold,
IsolateConnectedThreshold, NeighborhoodConnectedThreshold, and
ConfidenceConnectedThreshold filters to take the additional mask input and
mask threshold (and switch between using a
BinaryThresholdImageFunction and MaskedBinaryThresholdImageFunction
depending
on whether the mask input is set) but the iterator code would not have to
change.





-----Original Message-----
From: salah [mailto:salah at gris.uni-tuebingen.de]
Sent: Wednesday, April 21, 2004 8:52 AM
To: Miller, James V (Research)
Cc: Luis Ibanez (E-Mail)
Subject: AW: [Insight-users] 2. Selective FloodFilling and Region
Growing


Hello Jim,

Thanks for the reaction! 

> Do we need separate iterator classes to perform these 
> operations? It looks
> like what you are trying to accomplish is the original intent of the 
> ImageFunctionConditionalIterators (walk one image based on 
> information 
> from (possible a different) image). The difference here is 
> that you may 
> want to walk an output image based on information from two image (an 
> input image and a mask image).

What I really intended is to stop the FloodFilling iterators from traversing
regions that I do not need. 

> Can we use an ImageFunction that operates on two images (one being 
> a mask) instead? 
> 
> This will keep the iterator code consistent.

Yes, you are probably right. The same task will be accomplished but (I
think)
not with that same efficiency. When you use "an ImageFunction that operates
on 
two images", you will have to evaluate the function at each pixel/voxel,
possibly 
returning a specific value at the OFF-pixels in the mask. 
My objective is to avoid traversing (and hence function evaluation at) un
some image 
regions. 
 
Best wishes,
Zein 





////////////////////////////////////////////////////////////////////////////
///////////////
> Jim
> 
> -----Original Message-----
> From: salah [mailto:salah at gris.uni-tuebingen.de]
> Sent: Monday, April 19, 2004 10:53 AM
> To: ITK Users (E-Mail)
> Subject: [Insight-users] 2. Selective FloodFilling and Region Growing
> 
> 
> 
> > Hello Luis,
> > 
> > Here is my version of the FloodFilling filters. They are modified to
> perform selective growing by accepting 
> two new Inputs:
> >     1. mask image 
> >     2. threshold  
> > 
> where pixels in the input image will not be considered if the 
> corresponding
> pixels in the "mask image" are 
> less than "threshold".
> 
> In my application, I modified the ConnectedThresholdImageFilter and
> ConfidenceConnectedImageFilter to use 
> this version.
> 
> > The attached files are renamed by adding the prefix 'S' 
> (Selective). The
> filters are now templated also over the 
> > feature image (Mask). As with the selective morph. filters, the two
> functions
> > 
>    SetMaskImage( maskImage ) 
> >    SetThreshold( threshold )
> > 
> are used to define the new inputs. 
> 
> note: if any (or both) of these inputs is not given, the 
> filters will behave
> just like the normal ones. 
> 
> > I hope this may help somebody!
> > 
> > Best Regards,
> > 
> > Zein
> > 
> > >  <<SelectiveFF_RG.zip>> 
> > 
> > 
> 
>