[ITK-users] [ITK] error using Richard-Lucy deconvolution

Matt McCormick matt.mccormick at kitware.com
Fri Sep 30 10:31:48 EDT 2016


Hi Francisco,

Thanks for the feedback. I have updated the patch to also check
Spacing and Direction in the new test.

Thanks,
Matt

On Fri, Sep 30, 2016 at 5:01 AM, Francisco Oliveira
<francisco.oliveira at fe.up.pt> wrote:
> Hi Matt,
> I don't know if you are aware that a similar problem happens when the input image does not have spacing equal to 1 mm and the direction matrix equals to identity matrix. Besides, even that you set the origin, spacing and direction of the kernel equal to the input image the same error occurs because the origin, spacing and direction of the kernel is not updated.
>
> The implementation of this part of the filter should be equal to the other iterative deconvolution filters, like the itkLandweberDeconvolutionImageFilter.
>
> Thanks,
> Francisco
>
>
> -----Mensagem original-----
> De: Matt McCormick [mailto:matt.mccormick at kitware.com]
> Enviada: quinta-feira, 29 de setembro de 2016 22:47
> Para: Francisco Oliveira
> Cc: Lowekamp, Bradley (NIH/NLM/LHC) [C]; Cory Quammen; ITK
> Assunto: Re: [ITK] [ITK-users] error using Richard-Lucy deconvolution
>
> Hi Francisco,
>
> I think you found a bug -- the kernel should not require the same Origin as the input image.  Please review this patch:
>
>   http://review.source.kitware.com/#/c/21598/
>
> Thanks,
> Matt
>
> On Fri, Sep 9, 2016 at 10:25 AM, Francisco Oliveira <francisco.oliveira at fe.up.pt> wrote:
>> Thanks Brad, your suggestion solved my problem.
>> First we need forcing the input image to have spacing=[1, 1, 1], origin=[0, 0, 0] and the direction equals to identity matrix. Then we can apply the filter and after we set back the original spacing, origin and directions to the deconvoluted image (of course we need to save them before).
>>
>> Francisco
>>
>>
>> -----Mensagem original-----
>> De: Lowekamp, Bradley (NIH/NLM/LHC) [C]
>> [mailto:blowekamp at mail.nih.gov]
>> Enviada: sexta-feira, 9 de setembro de 2016 13:56
>> Para: Francisco Oliveira; Cory Quammen
>> Cc: Matt McCormick; ITK
>> Assunto: Re: [ITK-users] error using Richard-Lucy deconvolution
>>
>> Hello,
>>
>> I was able to reproduce your problem in SimpleITK:
>>
>> In [1]: import SimpleITK as sitk
>>
>> In [2]: img =
>> sitk.ReadImage("/scratch/blowekamp/build/itkSimpleFilters/ExternalData
>> /test/Input/DSA.png")
>>
>> In [3]: img = sitk.VectorIndexSelectionCast(img, 0, sitk.sitkFloat32)
>>
>> In [4]: k = sitk.Image(11,11, sitk.sitkFloat32)
>>
>> In [5]: k[5,4]=.01; k[5,5]=1
>>
>> In [6]: out = sitk.RichardsonLucyDeconvolution(img,k)
>>
>> —————————
>> NOTE: OK with both origins of 0
>> —————————
>>
>>
>> In [7]: sitk.Show(out)
>>
>>
>> In [9]: img.SetOrigin([10,10])
>>
>> In [10]: out = sitk.RichardsonLucyDeconvolution(img,k)
>> ---------------------------------------------------------------------------
>> RuntimeError                              Traceback (most recent call last)
>> <ipython-input-10-05ff2abccb8c> in <module>()
>> ----> 1 out = sitk.RichardsonLucyDeconvolution(img,k)
>>
>> /home/blowekamp/.virtualenvs/sitk-test/lib/python2.7/site-packages/SimpleITK/SimpleITK.pyc in RichardsonLucyDeconvolution(*args, **kwargs)
>>   57544
>>   57545     """
>>> 57546     return _SimpleITK.RichardsonLucyDeconvolution(*args, **kwargs)
>>   57547 class STAPLEImageFilter(ImageFilter_3):
>>   57548     """
>>
>> RuntimeError: Exception thrown in SimpleITK RichardsonLucyDeconvolution: /tmp/SimpleITK-build/ITK-prefix/include/ITK-4.10/itkImageToImageFilter.hxx:250:
>> itk::ERROR: DivideOrZeroOutImageFilter(0x4085740): Inputs do not occupy the same physical space!
>> InputImage Origin: [1.0000000e+01, 1.0000000e+01], InputImage_1 Origin: [0.0000000e+00, 0.0000000e+00]
>>         Tolerance: 1.0000000e-06
>>
>> In [11]: out = sitk.WienerDeconvolution(img,k)
>>
>> In [12]: out = sitk.TikhonovDeconvolution(img,k)
>>
>>
>>
>>
>> You should be  able to set with images to the same origin to bypass this exception.
>>
>>
>> I am not sure if this filter is suppose to require that both images have the same grids or not. If it does, the check should happen earlier on in the VerifyInputInformation method.
>>
>> But as other Deconvolution filters I tested in SimpleITK seem to expect different origins, I think it may be a bug in this filter.
>>
>> Brad
>>
>>> On Sep 9, 2016, at 3:42 AM, Francisco Oliveira <francisco.oliveira at fe.up.pt> wrote:
>>>
>>> Hi Matt,
>>> I already tried that and it didn't work. Independently the kernel image I use the error is the same and the origin and spacing are always the same [0, 0, 0] and [1, 1, 1], respectively.
>>>
>>> Francisco
>>>
>>> -----Mensagem original-----
>>> De: Matt McCormick [mailto:matt.mccormick at kitware.com]
>>> Enviada: quinta-feira, 8 de setembro de 2016 19:22
>>> Para: Francisco
>>> Cc: insight-users at itk.org
>>> Assunto: Re: [ITK-users] error using Richard-Lucy deconvolution
>>>
>>> Hi Francisco,
>>>
>>> As the error message indicates, the filter requires both inputs to have the same "information", i.e. Origin and Spacing, since it assumes that they occupy the same domain in physical space.
>>>
>>> HTH,
>>> Matt
>>>
>>> On Thu, Sep 8, 2016 at 12:46 PM, Francisco <francisco.oliveira at fe.up.pt> wrote:
>>>> Hi all,
>>>> I'm trying to use itkRichardLucyDeconvolutionImageFilter but I have
>>>> always the following error independently of the size, origin,
>>>> spacing, ... of the input image and the kernel image. If I use other
>>>> deconvolution filter (for instance
>>>> itkLandweberDeconvolutionImageFilter) it works perfectly. I´m using the code example available in the ITK. I'm using itk-4.4.0 and VS2008.
>>>>
>>>> itk::ExceptionObject (0185E9CC)
>>>> Location: "unknown"
>>>> File:
>>>> c:\libraries\itk-4.4.0\source\modules\core\common\include\itkImageTo
>>>> I
>>>> m
>>>> ageF
>>>> ilter.hxx
>>>> Line: 247
>>>> Description: itk::ERROR: DivideOrZeroOutImageFilter(03631DB0):
>>>> Inputs do not occupy the same physical space!
>>>> InputImage Origin: [-2.8658594e+002, -2.1658594e+002,
>>>> 9.9893402e+002],
>>>> InputImage_1 Origin: [0.0000000e+000, 0.0000000e+000, 0.0000000e+000]
>>>>        Tolerance: 4.0000000e-006
>>>> InputImage Spacing: [4.0000000e+000, 4.0000000e+000,
>>>> 4.0000000e+000],
>>>> InputImage_1 Spacing: [1.0000000e+000, 1.0000000e+000, 1.0000000e+000]
>>>>        Tolerance: 4.0000000e-006
>>>>
>>>>
>>>>
>>>>
>>>> --
>>>> View this message in context:
>>>> http://itk-insight-users.2283740.n2.nabble.com/error-using-Richard-L
>>>> u c y-deconvolution-tp7589179.html Sent from the ITK Insight Users
>>>> mailing list archive at Nabble.com.
>>>> _____________________________________
>>>> 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://www.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://public.kitware.com/mailman/listinfo/insight-users
>>>
>>> -----
>>> Não foram detetados vírus nesta  mensagem.
>>> Verificado por AVG - www.avg.com
>>> Versão: 2016.0.7752 / Base de dados de Vírus: 4649/12974 - Data de
>>> Lançamento: 09/08/16
>>>
>>> _____________________________________
>>> 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://www.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://public.kitware.com/mailman/listinfo/insight-users
>>
>>
>> -----
>> Não foram detetados vírus nesta  mensagem.
>> Verificado por AVG - www.avg.com
>> Versão: 2016.0.7752 / Base de dados de Vírus: 4649/12974 - Data de
>> Lançamento: 09/08/16
>>
>> _____________________________________
>> 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://www.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://public.kitware.com/mailman/listinfo/insight-users
>> _______________________________________________
>> Community mailing list
>> Community at itk.org
>> http://public.kitware.com/mailman/listinfo/community
>
> -----
> Não foram detetados vírus nesta  mensagem.
> Verificado por AVG - www.avg.com
> Versão: 2016.0.7797 / Base de dados de Vírus: 4656/13115 - Data de Lançamento: 09/29/16
>


More information about the Insight-users mailing list