[Insight-users] interpolating VariableLengthVectors?
Luis Ibanez
luis.ibanez at kitware.com
Fri Feb 5 13:03:35 EST 2010
Hi George,
This is a "bug" in the VectorLinearInterpolateImageFunction,
we should be using the Traits
MeasurementVectorTraits::GetLength( x2 )
Instead of assuming that the pixel type has a "Dimension" trait.
So, we should remove from itkVectorInterpolateImageFunction.h
the statement in line 65-66
itkStaticConstMacro(Dimension, unsigned int,
TInputImage::PixelType::Dimension);
and remove from itkVectorLinearInterpolateImageFunction.h
the lines 66-67
itkStaticConstMacro(Dimension, unsigned int,
Superclass::Dimension);
and finally, in itkVectorLinearInterpolateImageFunction.txx
we should replace line 141:
for(unsigned int k = 0; k < Dimension; k++ )
with
for(unsigned int k = 0; k < vectorDimension; k++ )
and insert just after line 140 something like:
const unsigned int vectorDimension =
MeasurementVectorTraits::GetLength( input );
With these changes, the vector linear interpolator
should be compatible with VariableLength vector as a
pixel type.
Could you please give it a try at these changes,
and let us know if they work for you ?
If so we will commit them in the CVS repository.
Thanks
Luis
--------------------------------------------
On Thu, Feb 4, 2010 at 11:47 AM, g c <gc12358 at googlemail.com> wrote:
> Hi,
>
> I use the following 'solution' for interpolating a VectorImage by
> using the VectorImageToImageAdaptor and interpolating each component
> separately:
>
> =======================
>
> unsigned int Dimension = 3;
> typedef float DataType;
> typedef itk::VectorImage< DataType, Dimension > VectorImageType;
> typedef itk::VectorImageToImageAdaptor< DataType, Dimension >
> VectorImageToImageAdaptorType;
> typedef itk::LinearInterpolateImageFunction<
> VectorImageToImageAdaptorType, DataType >
> LinearInterpolateImageFunctionType;
>
> VectorImageToImageAdaptorType::Pointer Adaptor =
> VectorImageToImageAdaptorType::New();
> LinearInterpolateImageFunctionType::Pointer Interpolator =
> LinearInterpolateImageFunctionType::New();
>
> VectorImageType::Pointer VectorImage = VectorImageType::New();
>
> ...
>
> for( unsigned int i=0; i<NrOfComp; i++)
> {
> Adaptor->SetExtractComponentIndex( i );
> Adaptor->SetImage( VectorImage );
> Adaptor->Update();
> Interpolator->SetInputImage( Adaptor );
>
> PointsContainerIteratorType Iter = m_PointsContainer->Begin();
> unsigned int PointId = 0;
> while( Iter != m_PointsContainer->End() )
> {
> m_Data[PointId][i] = Interpolator->Evaluate( Iter.Value() );
> Iter++;
> PointId++;
> }
> }
>
> =======================
>
> I would still be interested if anyone knows a more direct/better way
> of interpolating an itk::VectorImage.
>
> cheers,
>
> George
>
>
> On 1 February 2010 13:29, g c <gc12358 at googlemail.com> wrote:
>> Dear all,
>> I may have missed this when looking through the itk documentation, but is
>> there a way to interpolate the VariableLengthVectors in a VectorImage?
>> I've tried:
>> typedef float DataType;
>> typedef itk::VectorImage< DataType, 3 > VectorImageType;
>> typedef itk::VectorLinearInterpolateImageFunction< VectorImageType,
>> DataType > VectorImageInterpolatorType;
>> but when I instantiate the interpolator using
>> VectorImageInterpolatorType::Pointer CoefficientsInterpolator =
>> VectorImageInterpolatorType::New();
>> I get the error 'Dimension' is not a member of
>> 'itk::VariableLengthVector<mm::DataType>'
>> So I guess VectorLinearInterpolateImageFunction can only be used for
>> FixedArray pixel types?
>> Is there an itk interpolator that can deal with VariableLengthVectors? Any
>> suggestions welcome!
>> Thanks,
>> George
> _____________________________________
> 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.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-users
>
More information about the Insight-users
mailing list