[Insight-users] Addition of two DeformationFields

Monica Lumbardi monica_lumbardi at yahoo.com
Fri Aug 13 04:54:35 EDT 2004


Hi Luis, 
Thanks for you advices. I've tried the AddImageFilter, but it doesn't work for Vector images.
 
Here is my code:
 
typedef itk::Vector<float,3> vectortype; 
typedef itk::Image<vectortype, 3> deformationFieldType; 

typedef itk::AddImageFilter <deformationFieldType, deformationFieldType, deformationFieldType> addtype; 

addtype::Pointer addFilter = addtype::New(); 

 
And when I compile, I get the following errors:
 
C:\ITK\itk\Code\BasicFilters\itkAddImageFilter.h(66): error C2440: 'initializing' : cannot convert from 'const itk::Image<TPixel,VImageDimension>::PixelType' to 'const itk::Functor::Add2<TInput1,TInput2,TOutput>::AccumulatorType'
        with
        [
            TPixel=VectorType,
            VImageDimension=3
        ]
        and
        [
            TInput1=itk::Image<VectorType,3>::PixelType,
            TInput2=itk::Image<VectorType,3>::PixelType,
            TOutput=itk::Image<VectorType,3>::PixelType
        ]
C:\ITK\itk\Code\BasicFilters\itkAddImageFilter.h(67): error C2784: 'vnl_matrix<T> operator +(const vnl_diag_matrix<T> &,const vnl_matrix<T> &)' : could not deduce template argument for 'const vnl_diag_matrix<T> &' from 'const itk::Functor::Add2<TInput1,TInput2,TOutput>::AccumulatorType'
        with
        [
            TInput1=itk::Image<VectorType,3>::PixelType,
            TInput2=itk::Image<VectorType,3>::PixelType,
            TOutput=itk::Image<VectorType,3>::PixelType
        ]
C:\ITK\itk\Code\BasicFilters\itkAddImageFilter.h(67): error C2784: 'vnl_matrix<T> operator +(const vnl_matrix<T> &,const vnl_diag_matrix<T> &)' : could not deduce template argument for 'const vnl_matrix<T> &' from 'const itk::Functor::Add2<TInput1,TInput2,TOutput>::AccumulatorType'
        with
        [
            TInput1=itk::Image<VectorType,3>::PixelType,
            TInput2=itk::Image<VectorType,3>::PixelType,
            TOutput=itk::Image<VectorType,3>::PixelType
        ]
C:\ITK\itk\Code\BasicFilters\itkAddImageFilter.h(67): error C2784: 'vnl_diag_matrix<T> operator +(const vnl_diag_matrix<T> &,const vnl_diag_matrix<T> &)' : could not deduce template argument for 'const vnl_diag_matrix<T> &' from 'const itk::Functor::Add2<TInput1,TInput2,TOutput>::AccumulatorType'
        with
        [
            TInput1=itk::Image<VectorType,3>::PixelType,
            TInput2=itk::Image<VectorType,3>::PixelType,
            TOutput=itk::Image<VectorType,3>::PixelType
        ]
        C:\ITK\itk\Utilities\vxl\core\vnl\vnl_diag_matrix.h(236) : see declaration of 'operator`+''
C:\ITK\itk\Code\BasicFilters\itkAddImageFilter.h(67): error C2784: 'vnl_matrix<T> operator +(const vnl_matrix<T> &,const vnl_matrix_fixed<T,M,N> &)' : could not deduce template argument for 'const vnl_matrix<T> &' from 'const itk::Functor::Add2<TInput1,TInput2,TOutput>::AccumulatorType'
        with
        [
            TInput1=itk::Image<VectorType,3>::PixelType,
            TInput2=itk::Image<VectorType,3>::PixelType,
            TOutput=itk::Image<VectorType,3>::PixelType
        ]
        C:\ITK\itk\Utilities\vxl\core\vnl\vnl_matrix_fixed.h(804) : see declaration of 'operator`+''
C:\ITK\itk\Code\BasicFilters\itkAddImageFilter.h(67): error C2784: 'vnl_matrix<T> operator +(const vnl_matrix_fixed<T,M,N> &,const vnl_matrix<T> &)' : could not deduce template argument for 'const vnl_matrix_fixed<T,M,N> &' from 'const itk::Functor::Add2<TInput1,TInput2,TOutput>::AccumulatorType'
        with
        [
            TInput1=itk::Image<VectorType,3>::PixelType,
            TInput2=itk::Image<VectorType,3>::PixelType,
            TOutput=itk::Image<VectorType,3>::PixelType
        ]
        C:\ITK\itk\Utilities\vxl\core\vnl\vnl_matrix_fixed.h(798) : see declaration of 'operator`+''
C:\ITK\itk\Code\BasicFilters\itkAddImageFilter.h(67): error C2784: 'vnl_matrix_fixed<T,M,N> operator +(T,const vnl_matrix_fixed<T,M,N> &)' : could not deduce template argument for 'const vnl_matrix_fixed<T,M,N> &' from 'const itk::Image<TPixel,VImageDimension>::PixelType'
        with
        [
            TPixel=VectorType,
            VImageDimension=3
        ]
        C:\ITK\itk\Utilities\vxl\core\vnl\vnl_matrix_fixed.h(646) : see declaration of 'operator`+''
C:\ITK\itk\Code\BasicFilters\itkAddImageFilter.h(67): error C2784: 'vnl_matrix_fixed<T,M,N> operator +(T,const vnl_matrix_fixed<T,M,N> &)' : could not deduce template argument for 'const vnl_matrix_fixed<T,M,N> &' from 'const itk::Image<TPixel,VImageDimension>::PixelType'
        with
        [
            TPixel=VectorType,
            VImageDimension=3
        ]
        C:\ITK\itk\Utilities\vxl\core\vnl\vnl_matrix_fixed.h(646) : see declaration of 'operator`+''
C:\ITK\itk\Code\BasicFilters\itkAddImageFilter.h(67): error C2784: 'vnl_matrix_fixed<T,M,N> operator +(const vnl_matrix_fixed<T,M,N> &,T)' : could not deduce template argument for 'const vnl_matrix_fixed<T,M,N> &' from 'const itk::Functor::Add2<TInput1,TInput2,TOutput>::AccumulatorType'
        with
        [
            TInput1=itk::Image<VectorType,3>::PixelType,
            TInput2=itk::Image<VectorType,3>::PixelType,
            TOutput=itk::Image<VectorType,3>::PixelType
        ]
        C:\ITK\itk\Utilities\vxl\core\vnl\vnl_matrix_fixed.h(637) : see declaration of 'operator`+''
C:\ITK\itk\Code\BasicFilters\itkAddImageFilter.h(67): error C2784: 'vnl_matrix_fixed<T,M,N> operator +(const vnl_matrix_fixed<T,M,N> &,const vnl_matrix_fixed<T,M,N> &)' : could not deduce template argument for 'const vnl_matrix_fixed<T,M,N> &' from 'const itk::Functor::Add2<TInput1,TInput2,TOutput>::AccumulatorType'
        with
        [
            TInput1=itk::Image<VectorType,3>::PixelType,
            TInput2=itk::Image<VectorType,3>::PixelType,
            TOutput=itk::Image<VectorType,3>::PixelType
        ]
        C:\ITK\itk\Utilities\vxl\core\vnl\vnl_matrix_fixed.h(628) : see declaration of 'operator`+''
C:\ITK\itk\Code\BasicFilters\itkAddImageFilter.h(67): error C2784: 'vnl_vector<T> operator +(const vnl_vector<T> &,const vnl_vector_fixed<T,n> &)' : could not deduce template argument for 'const vnl_vector<T> &' from 'const itk::Functor::Add2<TInput1,TInput2,TOutput>::AccumulatorType'
        with
        [
            TInput1=itk::Image<VectorType,3>::PixelType,
            TInput2=itk::Image<VectorType,3>::PixelType,
            TOutput=itk::Image<VectorType,3>::PixelType
        ]
        C:\ITK\itk\Utilities\vxl\core\vnl\vnl_vector_fixed.h(596) : see declaration of 'operator`+''
C:\ITK\itk\Code\BasicFilters\itkAddImageFilter.h(67): error C2784: 'vnl_vector<T> operator +(const vnl_vector_fixed<T,n> &,const vnl_vector<T> &)' : could not deduce template argument for 'const vnl_vector_fixed<T,n> &' from 'const itk::Functor::Add2<TInput1,TInput2,TOutput>::AccumulatorType'
        with
        [
            TInput1=itk::Image<VectorType,3>::PixelType,
            TInput2=itk::Image<VectorType,3>::PixelType,
            TOutput=itk::Image<VectorType,3>::PixelType
        ]
        C:\ITK\itk\Utilities\vxl\core\vnl\vnl_vector_fixed.h(587) : see declaration of 'operator`+''
C:\ITK\itk\Code\BasicFilters\itkAddImageFilter.h(67): error C2784: 'vnl_vector_fixed<T,n> operator +(const vnl_vector_fixed<T,n> &,const vnl_vector_fixed<T,n> &)' : could not deduce template argument for 'const vnl_vector_fixed<T,n> &' from 'const itk::Functor::Add2<TInput1,TInput2,TOutput>::AccumulatorType'
        with
        [
            TInput1=itk::Image<VectorType,3>::PixelType,
            TInput2=itk::Image<VectorType,3>::PixelType,
            TOutput=itk::Image<VectorType,3>::PixelType
        ]
        C:\ITK\itk\Utilities\vxl\core\vnl\vnl_vector_fixed.h(576) : see declaration of 'operator`+''
C:\ITK\itk\Code\BasicFilters\itkAddImageFilter.h(67): error C2784: 'vnl_vector_fixed<T,n> operator +(T,const vnl_vector_fixed<T,n> &)' : could not deduce template argument for 'const vnl_vector_fixed<T,n> &' from 'const itk::Image<TPixel,VImageDimension>::PixelType'
        with
        [
            TPixel=VectorType,
            VImageDimension=3
        ]
        C:\ITK\itk\Utilities\vxl\core\vnl\vnl_vector_fixed.h(509) : see declaration of 'operator`+''
C:\ITK\itk\Code\BasicFilters\itkAddImageFilter.h(67): error C2784: 'vnl_vector_fixed<T,n> operator +(T,const vnl_vector_fixed<T,n> &)' : could not deduce template argument for 'const vnl_vector_fixed<T,n> &' from 'const itk::Image<TPixel,VImageDimension>::PixelType'
        with
        [
            TPixel=VectorType,
            VImageDimension=3
        ]
        C:\ITK\itk\Utilities\vxl\core\vnl\vnl_vector_fixed.h(509) : see declaration of 'operator`+''
C:\ITK\itk\Code\BasicFilters\itkAddImageFilter.h(67): error C2784: 'vnl_vector_fixed<T,n> operator +(const vnl_vector_fixed<T,n> &,T)' : could not deduce template argument for 'const vnl_vector_fixed<T,n> &' from 'const itk::Functor::Add2<TInput1,TInput2,TOutput>::AccumulatorType'
        with
        [
            TInput1=itk::Image<VectorType,3>::PixelType,
            TInput2=itk::Image<VectorType,3>::PixelType,
            TOutput=itk::Image<VectorType,3>::PixelType
        ]
        C:\ITK\itk\Utilities\vxl\core\vnl\vnl_vector_fixed.h(499) : see declaration of 'operator`+''
C:\ITK\itk\Code\BasicFilters\itkAddImageFilter.h(67): error C2784: 'vnl_matrix<T> operator +(const T &,const vnl_matrix<T> &)' : could not deduce template argument for 'const vnl_matrix<T> &' from 'const itk::Image<TPixel,VImageDimension>::PixelType'
        with
        [
            TPixel=VectorType,
            VImageDimension=3
        ]
        C:\ITK\itk\Utilities\vxl\core\vnl\vnl_matrix.h(35) : see declaration of 'operator`+''
C:\ITK\itk\Code\BasicFilters\itkAddImageFilter.h(67): error C2784: 'vnl_matrix<T> operator +(const T &,const vnl_matrix<T> &)' : could not deduce template argument for 'const vnl_matrix<T> &' from 'const itk::Image<TPixel,VImageDimension>::PixelType'
        with
        [
            TPixel=VectorType,
            VImageDimension=3
        ]
        C:\ITK\itk\Utilities\vxl\core\vnl\vnl_matrix.h(35) : see declaration of 'operator`+''
C:\ITK\itk\Code\BasicFilters\itkAddImageFilter.h(67): error C2784: 'vnl_vector<T> operator +(T,const vnl_vector<T> &)' : could not deduce template argument for 'const vnl_vector<T> &' from 'const itk::Image<TPixel,VImageDimension>::PixelType'
        with
        [
            TPixel=VectorType,
            VImageDimension=3
        ]
        C:\ITK\itk\Utilities\vxl\core\vnl\vnl_vector.h(45) : see declaration of 'operator`+''
C:\ITK\itk\Code\BasicFilters\itkAddImageFilter.h(67): error C2784: 'vnl_vector<T> operator +(T,const vnl_vector<T> &)' : could not deduce template argument for 'const vnl_vector<T> &' from 'const itk::Image<TPixel,VImageDimension>::PixelType'
        with
        [
            TPixel=VectorType,
            VImageDimension=3
        ]
        C:\ITK\itk\Utilities\vxl\core\vnl\vnl_vector.h(45) : see declaration of 'operator`+''
C:\ITK\itk\Code\BasicFilters\itkAddImageFilter.h(67): error C2677: binary '+' : no global operator found which takes type 'const itk::Image<TPixel,VImageDimension>::PixelType' (or there is no acceptable conversion)
        with
        [
            TPixel=VectorType,
            VImageDimension=3
        ]


 
 
Thanks for helping me, 
 
Monica
 

Luis Ibanez <luis.ibanez at kitware.com> wrote:

Hi Monica,


Did you tried the AddImageFilter ?
http://www.itk.org/Insight/Doxygen/html/classitk_1_1AddImageFilter.html


When you use the WarpImageFilter
http://www.itk.org/Insight/Doxygen/html/classitk_1_1WarpImageFilter.html
for deforming an input image using a Vector field, the
Vector field is expected to have the same extent, and
spacing as the input image. In other words they are
defined over the same grid.

It shouldn't be too hard to modify this filter in order
to use an arbitrary deformation field. Please let us
know if you need help in making such changes in the code.



Thanks



Luis



---------------------------
Monica Lumbardi wrote:

> Hi everyone,
> 
> I would like to add one DeformationField to an other
> DeformationField but I don't know how to do it.
> Has anybody an idea how to perform it?
> I'm also interested in knowing what happens if I apply
> DeformationField with 
> size: 157 189 136
> spacing: 1 1 1
> 
> to an image with:
> size: 79 95 68
> spacing: 2 2 2 
> 
> Thanks in advance.
> 
> Monica
> 
> 
> 
> 
> __________________________________
> Do you Yahoo!?
> New and Improved Yahoo! Mail - 100MB free storage!
> http://promotions.yahoo.com/new_mail 
> _______________________________________________
> Insight-users mailing list
> Insight-users at itk.org
> http://www.itk.org/mailman/listinfo/insight-users
> 





		
---------------------------------
Do you Yahoo!?
Yahoo! Mail - 50x more storage than other providers!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://public.kitware.com/pipermail/insight-users/attachments/20040813/76c6064d/attachment-0001.html


More information about the Insight-users mailing list