[Insight-developers] denoising filter

Nicholas Tustison ntustison at gmail.com
Thu Dec 6 14:24:38 EST 2012


Thanks Kris and Brad for your responses.  Since it's easier to 
look at code, I thought I'd post the changes I had to make.

http://review.source.kitware.com/#/c/8833/

Kris, if I read the code correctly, it seems to me that the physical
weighting image shouldn't be affected at all by anisotropic voxels
in the input image.  Am I reading that right?  The size of the physical 
weighting image seems only affected by the patch radius with 
isotropic spacing equal to 1.  When I write that image to disk using
my patch, I get an isotropic weighting distance function.  Otherwise
I get a flat disk where the weighting in the z? direction seems to be
close to 0.  Before we get to the issue that both Brad and I are
having of the thrown exception, perhaps we can clarify this issue.  
Is that okay?

Thanks again for your help with this, Kris,

Nick






On Dec 6, 2012, at 1:08 PM, Bradley Lowekamp <blowekamp at mail.nih.gov> wrote:

> Nick,
> 
> I just ran into this problem too this morning. I am glad you looked into the problem further than I did.
> 
> I was wrapping it for SimpleITK. I was setting up the filter with the defaults matching:
> 
> http://review.source.kitware.com/#/c/8803/1/Code/BasicFilters/json/PatchBasedDenoisingImageFilter.json
> 
> And I was testing it with the following 3D image:
> 
> http://itk.org/gitweb?p=SimpleITKData.git;a=blob;f=Input/RA-Short.nrrd;h=fca085049470a826324a4f2c93af2fd65fbaed52;hb=HEAD
> 
> With the following meta information:
>  Size: [64, 64, 64]
>  Spacing: [0.755874, 0.755874, 0.755874]
>  Origin: [0.283453, 0.283453, 0.283453]
>  Direction: 
> 1 0 0
> 0 1 0
> 0 0 1
> 
> 
> I get the same error with the defaults as you did, when I run the filter with the defaults
> 
> And then if I change the patchRadius:
> 
> python: sitk.PatchBasedDenoising( img, patchRadius=8 )
> ---------------------------------------------------------------------------
> RuntimeError                              Traceback (most recent call last)
> 
> /home/blowekamp/src/SimpleITK/Testing/Data/Input/<ipython console> in <module>()
> 
> /home/blowekamp/build/SimpleITK/SimpleITK-build/Wrapping/SimpleITK.pyc in PatchBasedDenoising(*args, **kwargs)
>   5767         double fractionPixelsForSigmaUpdate=1.0) -> Image
>   5768     """
> -> 5769   return _SimpleITK.PatchBasedDenoising(*args, **kwargs)
>   5770 class MaximumProjectionImageFilter(_object):
>   5771     """
> 
> RuntimeError: Exception thrown in SimpleITK PatchBasedDenoising: /home/blowekamp/build/SimpleITK/ITK-prefix/include/ITK-4.3/itkPatchBasedDenoisingImageFilter.hxx:641:
> itk::ERROR: PatchBasedDenoisingImageFilter(0x3086ee0): Center pixel's weight (0.685381) must be equal to 1.0
> 
> Thanks,
> Brad
> 
> On Dec 6, 2012, at 12:07 PM, Nicholas Tustison <ntustison at gmail.com> wrote:
> 
>> Hi Kris,
>> 
>> Today I finally got a chance to look at your denoising work (I'm ashamed
>> that I was at Penn for with Suyash for some time but I never asked him 
>> about it).  Anyway, I have a couple questions and I was hoping you could
>> help me try to run your denoising work on some of my MRI.   I took the test 
>> that you wrote and modified it only so that I could use it as a stand-alone
>> program.  I also verified that my version worked with the test images.  
>> However, when I tried to use it on my image (stats below)
>> 
>> Image information
>> Size:          [256, 256, 20]
>> Origin:        [-232.879, -135.656, 240.706]
>> SpatialExtent: [498.047, 498.047, 190]
>> Center:        [16.1448, 113.368, 335.706]
>> Spacing:       [1.95312, 1.95312, 10]
>> Index:         [0, 0, 0]
>> Direction:     
>> 1 0 0
>> 0 1 0
>> 0 0 1
>> 
>> using the following parameters
>> 
>> patchRadius = 4 
>> noiseModel = gaussian 
>> fidelityWeight = 0.0 
>> numberOfIterations = 1 
>> sigmaMultiplicationFactor = 2
>> 
>> it gave me the following error
>> 
>> Line: 634
>> Description: itk::ERROR: PatchBasedDenoisingImageFilter(0x7fbffb0f5e10): Center pixel's weight (0) must be equal to 1.0 
>> 
>> After investigating this section of the code, I noticed that the physicalWeightsImage
>> (after writing it to an image file) consists of what looked like a weighted 2-D disc.  
>> Based on my reading of the comments, should this be more of a 3-D weighted sphere?  
>> If so, I made some changes in the code to actually get a weighted sphere thinking 
>> that might be solve the problem but I still got the same error.  However, if I increase
>> the radius to 8, it seems to get past that error without issue.  Is there a general rule
>> for determining a minimal radius for this filter?
>> 
>> Thanks for your help,
>> Nick
>> 
>> 
>> 
>> 
>> _______________________________________________
>> Powered by www.kitware.com
>> 
>> Visit other Kitware open-source projects at
>> http://www.kitware.com/opensource/opensource.html
>> 
>> Kitware offers ITK Training Courses, for more information visit:
>> http://kitware.com/products/protraining.php
>> 
>> Please keep messages on-topic and check the ITK FAQ at:
>> http://www.itk.org/Wiki/ITK_FAQ
>> 
>> Follow this link to subscribe/unsubscribe:
>> http://www.itk.org/mailman/listinfo/insight-developers
> 



More information about the Insight-developers mailing list