[Insight-users] VectorImageToImageAdaptor

Bradley Lowekamp blowekamp at mail.nih.gov
Fri Mar 25 08:39:15 EDT 2011


Thanks David,

I was just ran into this problem the other day and didn't know which Adaptor/Filter to use. In my particular case I have a VectorImage, and wanted to operate some filter on it in a per component basis. This was the missing piece. 

There is the obvious difference between  Adaptors and Filters. Aside from that it's very confusion which is correct to use is which scenario. Added to that the confusion between a "Vector Image" and an "Image of Vectors", and things are messy.

Thanks for your hard work on the Wiki Examples.

Brad

On Mar 24, 2011, at 7:06 PM, David Doria wrote:

> 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
> _____________________________________
> 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

========================================================
Bradley Lowekamp  
Lockheed Martin Contractor for
Office of High Performance Computing and Communications
National Library of Medicine 
blowekamp at mail.nih.gov


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20110325/6ba00c86/attachment.htm>


More information about the Insight-users mailing list