[Insight-users] Gaussian of masked images

Luis Ibanez luis.ibanez at kitware.com
Tue Jul 6 21:26:37 EDT 2004



Hi Robert,


Can we quote this in our next developers meeting:   :-)

      " ...and my supervisor would wonder
           what the heck I was doing...    "


--


Robert, Kai


One option that is easy to implement is to modify the
MedianImageFilter. As you may know, the repeated application
of a median filter produces effects very similar to those
of anisotropic diffusion filters.

If you take the file in

   Insight/Code/BasicFilters/itkMedianImageFilter.txx

and modify lines 147-150

       for (i = 0; i < neighborhoodSize; ++i)
         {
         pixels.push_back( bit.GetPixel(i) );
         }

to exclude the pixels that do not pass your condition

       for (i = 0; i < neighborhoodSize; ++i)
         {
         if( mask->GetPixel( bit.GetNeighborhoodIndex(i) > 0 ) )
	  {
           pixels.push_back( bit.GetPixel(i) );
           }
         }



Where mask will be a second input to this filter, containing
a binary mask of the regions that you want to smooth.


Please let us know if you find useful such an implementation
in which case we will create a new filter with this option.


    Thanks


      Luis


---------------------
Atwood, Robert C wrote:

> I could really use this as well. The idea would be to reduce noise, only
> in the volume that is already determined to be a certain phase  by some
> other method, but leave the other phase alone, and especially not
> diffuse some of the other phase's gray scale into the first phase.
> 
> I can do this in my own code but it would be a steep learning curve to
> do it in itk-compatible style (and my supervisor would wonder what the
> heck I was doing)
> 
> For an "average" filter it goes something like this:
> 
> 
> neighbour_count = 0;
> total=0.0;
> if (voxel_greyscale <= threshold)/* this could be another condition such
> as : if (voxel_bitmask == 1 ) */
> {   
>     for [[all neighbours]] 
>     {
>        if (neigbour_greyscale <= threshold) /* this could be another
> condition such as : if (neighbour_bitmask == 1 ) */
>        { 
>           total += neighbour_greyscale;
>           neighbour_count++;
>        }
>    }
> new_voxel_greyscale = total/neigbour_count; /* put average into the
> voxel value */
> }
> 
> 
> Robert
>  
> 
> -----Original Message-----
> From: insight-users-bounces at itk.org
> [mailto:insight-users-bounces at itk.org] On Behalf Of Luis Ibanez
> Sent: 02 July 2004 22:35
> To: Kai Li
> Cc: insight-users at itk.org
> Subject: Re: [Insight-users] Gaussian of masked images
> 
> 
> 
> Hi Kai,
> 
> Do you want to exclude some pixels from being input to the Gaussian ?
> 
> or to you want to exclude some pixels from receiving the result of the
> Gaussian computation ?
> 
> The first one may not be a very formal operation...
> 
> What is the purpose of excluding those pixels ?
> 
> 
> Please let us know,
> 
> 
>     Thanks
> 
> 
>      Luis
> 
> 
> -------------
> Kai Li wrote:
> 
> 
>>Hi Luis,
>>   Thanks for your information, but what I exactly want is a filter 
>>for "masked" image. This may looks weird you. What I meant is that 
>>some pixels in a, say, grey image do not take part in the computation 
>>of the Gaussian.
>>
>>Thanks,
>>Kai
>>
>>On Fri, 2 Jul 2004, Luis Ibanez wrote:
>>
>>
>>
>>>Hi Kai,
>>>
>>>If you are using large Gaussians you will find more
>>>efficient to use the LaplacianRecursiveGaussian filter
>>>
>>>http://www.itk.org/Insight/Doxygen/html/classitk_1_1LaplacianRecursive
>>>GaussianImageFilter.html
>>>
>>>This filter internally uses IIR filters and therefore
>>>its computation time is independent of the size of your sigma.
>>>
>>>You will find examples on the use of this filter in the
>>>files
>>>
>>>
>>>  Insight/Examples/Filtering/
>>>       LaplacianRecursiveGaussianImageFilter1.cxx
>>>       LaplacianRecursiveGaussianImageFilter2.cxx
>>>       ScaleSpaceGenerator2D.cxx
>>>
>>>
>>>
>>>
>>>  Regards,
>>>
>>>
>>>    Luis
>>>
>>>
>>>
>>>-------------
>>>Kai Li wrote:
>>>
>>>
>>>
>>>>Hi,
>>>> I'm in a situation where Laplacian of Gaussian(LoG) of masked 
>>>>images has to be computed. I'm wondering if ITK has already provided 
>>>>something to archieve this.
>>>>
>>>> The method that I can come up with at this point is to use a 
>>>>Difference-Of-Gaussian operator that can compute the Gaussian 
>>>>derivatives for each pixel and mask the kernel of the operator 
>>>>dynamically for each pixel. This method seems OK but not efficient 
>>>>for the computation in large scale(sigma).
>>>>
>>>> Any suggestion is highly appreciated.
>>>>
>>>>Kai
>>>>_______________________________________________
>>>>Insight-users mailing list
>>>>Insight-users at itk.org 
>>>>http://www.itk.org/mailman/listinfo/insight-users
>>>>
>>>
>>>
>>>
>>_______________________________________________
>>Insight-users mailing list
>>Insight-users at itk.org 
>>http://www.itk.org/mailman/listinfo/insight-users
>>
> 
> 
> 
> 
> _______________________________________________
> Insight-users mailing list
> Insight-users at itk.org http://www.itk.org/mailman/listinfo/insight-users
> _______________________________________________
> Insight-users mailing list
> Insight-users at itk.org
> http://www.itk.org/mailman/listinfo/insight-users
> 





More information about the Insight-users mailing list