[Insight-users] VectorImageToImageAdaptor

David Doria daviddoria at gmail.com
Thu Mar 24 19:06:31 EDT 2011


On Thu, Mar 24, 2011 at 6:54 PM, David Doria <daviddoria at gmail.com> wrote:
> On Thu, Mar 24, 2011 at 5:12 PM, David Doria <daviddoria at gmail.com> wrote:
>> I am having trouble getting this filter to present a scalar image.
>> Below is a short example - it creates a vector image and then tries to
>> find the max/min of the adapted scalar image (the 0th component) :
>>
>> typedef itk::VectorImage<float, 2> VectorImageType;
>> VectorImageType::Pointer image;
>>
>> // ... Fill image ...
>>
>> typedef itk::VectorImageToImageAdaptor<float, 2> ImageAdaptorType;
>> ImageAdaptorType::Pointer adaptor = ImageAdaptorType::New();
>> adaptor->SetExtractComponentIndex(0);
>> adaptor->SetImage(image);
>>
>> typedef itk::MinimumMaximumImageCalculator <ImageAdaptorType>
>> ImageCalculatorFilterType;
>> ImageCalculatorFilterType::Pointer imageCalculatorFilter =
>> ImageCalculatorFilterType::New();
>> imageCalculatorFilter->SetImage(adaptor);
>> imageCalculatorFilter->Compute();
>>
>> The error is:
>> itkImageAdaptor.txx:334: error: cannot convert ‘float*’ to ‘const
>> itk::VariableLengthVector<float>*’ in return
>>
>> Is there a different adaptor I am supposed to be using for this?
>>
>> Thanks,
>>
>> David
>
> I also tried to use a
>
> typedef itk::NthElementImageAdaptor<VectorImageType, float> ImageAdaptorType;
> ImageAdaptorType::Pointer adaptor = ImageAdaptorType::New();
> adaptor->SelectNthElement(0);
> adaptor->SetImage(image);
>
> as the input to the MinimumMaximumImageCalculator and I get the exact
> same error.
>
> So to add to the question - what is the difference between
> NthElementImageAdaptor and VectorImageToImageAdaptor?
>
> David
>

It seems like itkVectorIndexSelectionCastImageFilter gets the job done.

So the update is "What is the difference between the following?"

NthElementImageAdaptor
VectorImageToImageAdaptor
VectorIndexSelectionCastImageFilter


More information about the Insight-users mailing list