[Insight-developers] Compile error with UsePhysicalSpace in BinaryFunctorImageFilter

Gaëtan Lehmann gaetan.lehmann at jouy.inra.fr
Thu Jun 2 11:19:45 EDT 2011


Le 2 juin 11 à 16:52, Williams, Norman K a écrit :

> I don't see the need to use ResampleImageFilter.  How is using an
> Interpolator in the filter different from calling ResampleImageFilter?
> Doesn't it just use an Interpolator internally?
>

The difference is that BinaryFunctorImageFilter doesn't need to use  
any Interpolator internally.
This allow to:

- not add an extra dependency in the ITK-ImageFilterBase module ;
- keep BinaryFunctoImageFilter able to build with any pixel types.

Gaëtan



>
> On 6/2/11 9:43 AM, "Gaëtan Lehmann" <gaetan.lehmann at jouy.inra.fr>  
> wrote:
>
>>
>> Le 2 juin 11 à 15:02, Luis Ibanez a écrit :
>>
>>> Kent,
>>>
>>> I think that we should back up the changes to the
>>> BinaryFunctorImageFunctor and instead create a
>>> helper filter that can do the equivalent resampling
>>> on demand.
>>>
>>> Looking back at the recent changes in the Binary
>>> FunctorImageFilter, what we did, was to put an
>>> simplified version of the ResampleImageFilter
>>> inside of the BinaryFunctor ImageFilter, to deal
>>> with something that the ResampleImageFitler
>>> can do from the outside.
>>>
>>
>> Kent's feature don't need to allocate a new image like
>> ResampleImageFilter would do.
>> And of course it doesn't require the usage of an additional filter.
>>
>>> We can back up those changes, and instead
>>> create a filter that will use the Resample image
>>> filter to produce the chunks needed by the
>>> BinaryFunctor image filter *from the outside*.
>>>
>>> I'll be happy to provide such filter.
>>>
>>
>> I agree that a check for the correct space position in
>> BinaryFunctorImageFilter and that new filter would be a better way to
>> fix that use case, even if it requires more memory and the usage of  
>> an
>> additional filter.
>>
>> The check is a backward compatibility issue which will be seen at
>> runtime only though.
>>
>> Gaëtan
>>
>>
>>
>>>
>>>    Luis
>>>
>>>
>>> --------------------------------------------------------------
>>> 2011/6/2 Gaëtan Lehmann <gaetan.lehmann at jouy.inra.fr>:
>>>>
>>>> Kent,
>>>>
>>>> There is another problem: the interpolators are in another module
>>>> which is
>>>> not required by ITK-ImageFilterBase where those filters are.
>>>> I'm not sure that's a good idea to add that dependency.
>>>>
>>>> Luis, Xiaoxiao, what do you think?
>>>>
>>>> The other problem is that I'm still not sure that
>>>> BinaryFunctorImageFilter
>>>> is still able to build with any pixel type as it was before,
>>>> because the
>>>> interpolators may have some assumptions on the pixel type that
>>>> BinaryFunctorImageFilter doesn't have.
>>>> For example I think it was possible to make
>>>> BinaryFunctorImageFilter compile
>>>> with itk::Image< std::list< int >, 3 > as image type - is it still
>>>> possible?
>>>> I think that feature is important enough to tolerate some loss in
>>>> possible
>>>> pixel types, but something must be done about backward  
>>>> compatibility.
>>>>
>>>> Gaëtan
>>>>
>>>>
>>>>
>>>> Le 1 juin 11 à 22:18, Williams, Norman K a écrit :
>>>>
>>>>> Yes, implementing GenerateInputRequestedRegion does the trick. New
>>>>> patch
>>>>> pushed.
>>>>>
>>>>>
>>>>> The test passes now without exceptions.  The one irksome issue is
>>>>> when
>>>>> adding (or subtracting or whatever) images where the interpolated
>>>>> image is
>>>>> smaller. The point derived from Input1's index is reported outside
>>>>> the
>>>>> smaller Input2 image by the interpolater, on edge voxels.  I'm
>>>>> sure this
>>>>> has to do with the voxel centers not lining up.
>>>>>
>>>>> I'm not sure exactly what to do about that or whether I need to do
>>>>> anything ;-)
>>>>>
>>>>> On 6/1/11 1:46 PM, "Gaëtan Lehmann" <gaetan.lehmann at jouy.inra.fr>
>>>>> wrote:
>>>>>
>>>>>>
>>>>>> Kent,
>>>>>>
>>>>>> Thanks for pushing the change to gerrit. I've updated it with a
>>>>>> small
>>>>>> fix for DivideImageFilter. It builds now.
>>>>>>
>>>>>> For the requested region, I think you should reimplement
>>>>>> GenerateInputRequestedRegion() and request the largest possible
>>>>>> region
>>>>>> of the 2nd (and 3rd) inputs if UsePhysicalSpace is true and the
>>>>>> origin, orientation and spacing are not matching the first input.
>>>>>>
>>>>>> Regards,
>>>>>>
>>>>>> Gaëtan
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>> Le 1 juin 11 à 19:36, Gaëtan Lehmann a écrit :
>>>>>>
>>>>>>>
>>>>>>> Le 1 juin 11 à 18:52, Williams, Norman K a écrit :
>>>>>>>
>>>>>>>> I have a fix for this, but I have larger problems with these
>>>>>>>> filters, as
>>>>>>>> detailed in my last message to the ITK list.
>>>>>>>>
>>>>>>>>
>>>>>>>> The problem being, once I correct bugs in the test, the filters
>>>>>>>> start
>>>>>>>> failing.  My changes to the filters, as written, will fail
>>>>>>>> because
>>>>>>>> of size
>>>>>>>> mismatches in the input images. This, unfortunately is one of  
>>>>>>>> the
>>>>>>>> things
>>>>>>>> my changes were explicitly supposed to support!
>>>>>>>
>>>>>>> Please push your changes to gerrit so we can look at this last
>>>>>>> problem.
>>>>>>>
>>>>>>> Gaëtan
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>>
>>>>>>>> On 5/31/11 3:25 PM, "Gaëtan Lehmann"
>>>>>>>> <gaetan.lehmann at jouy.inra.fr>
>>>>>>>> wrote:
>>>>>>>>
>>>>>>>>>
>>>>>>>>> Hi Kent,
>>>>>>>>>
>>>>>>>>> I get a compilation error in WrapITK with your recent  
>>>>>>>>> changes in
>>>>>>>>> BinaryFunctorImageFilter and complex pixel types - see the
>>>>>>>>> error at
>>>>>>>>> the end of the message.
>>>>>>>>> I'm not so sure, but I think the problem comes from the lack  
>>>>>>>>> of
>>>>>>>>> casting from the output type of the interpolator to the pixel
>>>>>>>>> type
>>>>>>>>> of
>>>>>>>>> the second input. Or maybe the output of the interpolator is
>>>>>>>>> not of
>>>>>>>>> the right type?
>>>>>>>>> BTW, is it possible to make the interpolator work with any
>>>>>>>>> kind of
>>>>>>>>> pixel? The interpolator may do some assumptions on the pixel
>>>>>>>>> types
>>>>>>>>> which are not done in BinaryFunctorImageFilter...
>>>>>>>>>
>>>>>>>>> Regards,
>>>>>>>>>
>>>>>>>>> Gaëtan
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> In file included from /home/glehmann/src/ITK/Modules/ 
>>>>>>>>> Filtering/
>>>>>>>>> ImageFilterBase/include/itkBinaryFunctorImageFilter.h:267,
>>>>>>>>>             from /home/glehmann/src/ITK/Modules/Filtering/
>>>>>>>>> ImageCompare/include/itkAbsoluteValueDifferenceImageFilter.h: 
>>>>>>>>> 22,
>>>>>>>>>             from /home/glehmann/src/ITK/build/Wrapping/ 
>>>>>>>>> WrapITK/
>>>>>>>>> Typedefs/PixelMathExplicit.h:38,
>>>>>>>>>             from /home/glehmann/src/ITK/build/Wrapping/ 
>>>>>>>>> WrapITK/
>>>>>>>>> Libraries/PixelMath/itkMultiplyImageFilterExplicit.cxx:3:
>>>>>>>>> /home/glehmann/src/ITK/Modules/Filtering/ImageFilterBase/
>>>>>>>>> include/
>>>>>>>>> itkBinaryFunctorImageFilter.txx: In member function 'void
>>>>>>>>> itk::BinaryFunctorImageFilter<TInputImage1, TInputImage2,
>>>>>>>>> TOutputImage, TFunction>::ThreadedGenerateData(const typename
>>>>>>>>> TOutputImage::RegionType&, int) [with TInputImage1 =
>>>>>>>>> itk::Image<std::complex<float>, 3u>, TInputImage2 =
>>>>>>>>> itk::Image<std::complex<float>, 3u>, TOutputImage =
>>>>>>>>> itk::Image<std::complex<float>, 3u>, TFunction =
>>>>>>>>> itk::Functor::Mult<std::complex<float>, std::complex<float>,
>>>>>>>>> std::complex<float> >]':
>>>>>>>>> /home/glehmann/src/ITK/build/Wrapping/WrapITK/Libraries/
>>>>>>>>> PixelMath/
>>>>>>>>> itkMultiplyImageFilterExplicit.cxx:21:   instantiated from  
>>>>>>>>> here
>>>>>>>>> /home/glehmann/src/ITK/Modules/Filtering/ImageFilterBase/
>>>>>>>>> include/
>>>>>>>>> itkBinaryFunctorImageFilter.txx:302: error: no match for  
>>>>>>>>> call to
>>>>>>>>> '(itk::Functor::Mult<std::complex<float>, std::complex<float>,
>>>>>>>>> std::complex<float> >) (std::complex<float>,
>>>>>>>>> std::complex<double>&)'
>>>>>>>>> /home/glehmann/src/ITK/Modules/Filtering/ImageIntensity/ 
>>>>>>>>> include/
>>>>>>>>> itkMultiplyImageFilter.h:58: note: candidates are: TOutput
>>>>>>>>> itk::Functor::Mult<TInput1, TInput2, TOutput>::operator() 
>>>>>>>>> (const
>>>>>>>>> TInput1&, const TInput2&) const [with TInput1 =
>>>>>>>>> std::complex<float>,
>>>>>>>>> TInput2 = std::complex<float>, TOutput = std::complex<float>]
>>>>>>>>> /home/glehmann/src/ITK/Modules/Filtering/ImageFilterBase/
>>>>>>>>> include/
>>>>>>>>> itkBinaryFunctorImageFilter.txx: In member function 'void
>>>>>>>>> itk::BinaryFunctorImageFilter<TInputImage1, TInputImage2,
>>>>>>>>> TOutputImage, TFunction>::ThreadedGenerateData(const typename
>>>>>>>>> TOutputImage::RegionType&, int) [with TInputImage1 =
>>>>>>>>> itk::Image<std::complex<float>, 2u>, TInputImage2 =
>>>>>>>>> itk::Image<std::complex<float>, 2u>, TOutputImage =
>>>>>>>>> itk::Image<std::complex<float>, 2u>, TFunction =
>>>>>>>>> itk::Functor::Mult<std::complex<float>, std::complex<float>,
>>>>>>>>> std::complex<float> >]':
>>>>>>>>> /home/glehmann/src/ITK/build/Wrapping/WrapITK/Libraries/
>>>>>>>>> PixelMath/
>>>>>>>>> itkMultiplyImageFilterExplicit.cxx:21:   instantiated from  
>>>>>>>>> here
>>>>>>>>> /home/glehmann/src/ITK/Modules/Filtering/ImageFilterBase/
>>>>>>>>> include/
>>>>>>>>> itkBinaryFunctorImageFilter.txx:302: error: no match for  
>>>>>>>>> call to
>>>>>>>>> '(itk::Functor::Mult<std::complex<float>, std::complex<float>,
>>>>>>>>> std::complex<float> >) (std::complex<float>,
>>>>>>>>> std::complex<double>&)'
>>>>>>>>> /home/glehmann/src/ITK/Modules/Filtering/ImageIntensity/ 
>>>>>>>>> include/
>>>>>>>>> itkMultiplyImageFilter.h:58: note: candidates are: TOutput
>>>>>>>>> itk::Functor::Mult<TInput1, TInput2, TOutput>::operator() 
>>>>>>>>> (const
>>>>>>>>> TInput1&, const TInput2&) const [with TInput1 =
>>>>>>>>> std::complex<float>,
>>>>>>>>> TInput2 = std::complex<float>, TOutput = std::complex<float>]
>>>>>>>>> make[2]: *** [Wrapping/WrapITK/Libraries/PixelMath/CMakeFiles/
>>>>>>>>> PixelMathExplicit.dir/itkMultiplyImageFilterExplicit.cxx.o]
>>>>>>>>> Error 1
>>>>>>>>> make[1]: *** [Wrapping/WrapITK/Libraries/PixelMath/CMakeFiles/
>>>>>>>>> PixelMathExplicit.dir/all] Error 2
>>>>>>>>> make[1]: *** Waiting for unfinished jobs....
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> --
>>>>>>>>> Gaëtan Lehmann
>>>>>>>>> Biologie du Développement et de la Reproduction
>>>>>>>>> INRA de Jouy-en-Josas (France)
>>>>>>>>> tel: +33 1 34 65 29 66    fax: 01 34 65 29 09
>>>>>>>>> http://voxel.jouy.inra.fr  http://www.itk.org
>>>>>>>>> http://www.mandriva.org  http://www.bepo.fr
>>>>>>>>>
>>>>>>>>> _______________________________________________
>>>>>>>>> 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.html
>>>>>>>>>
>>>>>>>>> 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
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> ________________________________
>>>>>>>> Notice: This UI Health Care e-mail (including attachments) is
>>>>>>>> covered by the Electronic Communications Privacy Act, 18 U.S.C.
>>>>>>>> 2510-2521, is confidential and may be legally privileged.  If  
>>>>>>>> you
>>>>>>>> are not the intended recipient, you are hereby notified that  
>>>>>>>> any
>>>>>>>> retention, dissemination, distribution, or copying of this
>>>>>>>> communication is strictly prohibited.  Please reply to the  
>>>>>>>> sender
>>>>>>>> that you have received the message in error, then delete it.
>>>>>>>> Thank
>>>>>>>> you.
>>>>>>>> ________________________________
>>>>>>>
>>>>>>> --
>>>>>>> Gaëtan Lehmann
>>>>>>> Biologie du Développement et de la Reproduction
>>>>>>> INRA de Jouy-en-Josas (France)
>>>>>>> tel: +33 1 34 65 29 66    fax: 01 34 65 29 09
>>>>>>> http://voxel.jouy.inra.fr  http://www.itk.org
>>>>>>> http://www.mandriva.org  http://www.bepo.fr
>>>>>>>
>>>>>>> _______________________________________________
>>>>>>> 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.html
>>>>>>>
>>>>>>> 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
>>>>>>
>>>>>> --
>>>>>> Gaëtan Lehmann
>>>>>> Biologie du Développement et de la Reproduction
>>>>>> INRA de Jouy-en-Josas (France)
>>>>>> tel: +33 1 34 65 29 66    fax: 01 34 65 29 09
>>>>>> http://voxel.jouy.inra.fr  http://www.itk.org
>>>>>> http://www.mandriva.org  http://www.bepo.fr
>>>>>>
>>>>>
>>>>>
>>>>>
>>>>> ________________________________
>>>>> Notice: This UI Health Care e-mail (including attachments) is
>>>>> covered by
>>>>> the Electronic Communications Privacy Act, 18 U.S.C. 2510-2521, is
>>>>> confidential and may be legally privileged.  If you are not the
>>>>> intended
>>>>> recipient, you are hereby notified that any retention,
>>>>> dissemination,
>>>>> distribution, or copying of this communication is strictly
>>>>> prohibited.
>>>>> Please reply to the sender that you have received the message in
>>>>> error,
>>>>> then delete it.  Thank you.
>>>>> ________________________________
>>>>
>>>> --
>>>> Gaëtan Lehmann
>>>> Biologie du Développement et de la Reproduction
>>>> INRA de Jouy-en-Josas (France)
>>>> tel: +33 1 34 65 29 66    fax: 01 34 65 29 09
>>>> http://voxel.jouy.inra.fr  http://www.itk.org
>>>> http://www.mandriva.org  http://www.bepo.fr
>>>>
>>>>
>>
>> --
>> Gaëtan Lehmann
>> Biologie du Développement et de la Reproduction
>> INRA de Jouy-en-Josas (France)
>> tel: +33 1 34 65 29 66    fax: 01 34 65 29 09
>> http://voxel.jouy.inra.fr  http://www.itk.org
>> http://www.mandriva.org  http://www.bepo.fr
>>
>
>
>
> ________________________________
> Notice: This UI Health Care e-mail (including attachments) is  
> covered by the Electronic Communications Privacy Act, 18 U.S.C.  
> 2510-2521, is confidential and may be legally privileged.  If you  
> are not the intended recipient, you are hereby notified that any  
> retention, dissemination, distribution, or copying of this  
> communication is strictly prohibited.  Please reply to the sender  
> that you have received the message in error, then delete it.  Thank  
> you.
> ________________________________
> _______________________________________________
> 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.html
>
> 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

-- 
Gaëtan Lehmann
Biologie du Développement et de la Reproduction
INRA de Jouy-en-Josas (France)
tel: +33 1 34 65 29 66    fax: 01 34 65 29 09
http://voxel.jouy.inra.fr  http://www.itk.org
http://www.mandriva.org  http://www.bepo.fr

-------------- next part --------------
A non-text attachment was scrubbed...
Name: PGP.sig
Type: application/pgp-signature
Size: 203 bytes
Desc: Ceci est une signature ?lectronique PGP
URL: <http://www.itk.org/mailman/private/insight-developers/attachments/20110602/cf3c6acb/attachment.pgp>


More information about the Insight-developers mailing list