[Insight-users] Scalar vs vector resampler/interpolator

Luis Ibanez luis.ibanez at kitware.com
Mon Feb 15 18:18:21 EST 2010


Hi Dan,

Yes, we have talked about this a couple of times.
It looks like it should be feasible.

I believe Brad Lowekamp had some ideas on how
to implement this.


Options that come to mind are:


1) The image class now has a method:
     image->GetNumberOfComponentsPerPixel()

and/or

2) Using the Statistics traits

       MeasurementVectorTraits::GetLenght( pixel );


Note that (1) still needs some work, since when you call it
in an RGB image it will  return 1 component, but if you call
it in a VectorImage it will correctly return the number of
components.

The method (2) needs to get one pixel (i.e. you could just
use the first pixel in the image), since some image types
have variable length pixels.


Whatever it is the implementation that we adopt, we
should make sure that it works for the following cases:

itk::Image< itk::RGBPixel< T> , N >
itk::Image< itk::Vector< T, M > , N >
itk::Image< itk::Point< T, M > , N >
itk::Image< itk::CovariantVector< T, M > , N >
itk::VectorImage< T, N >
itk::Image< std::vector< T >, N >


These is the collection of test cases that we used for the
(relatively) recent refactoring of the Statistics Framework


    Regards,


          Luis


--------------------------------------------------------------------------------
On Mon, Feb 15, 2010 at 5:55 AM, Dan Mueller <dan.muel at gmail.com> wrote:
> Hi all,
>
> I have some existing code which uses the ITK scalar registration
> components (including itkResampleImageFilter and
> itkLinearInterpolateImageFunction). I now want to extend this code to
> work for vector (eg. color) images.
>
> It will be possible (though not straight forward) to perform a kind of
> switch within the existing code. E.g.
>
> if ( scalar pixel type )
> {
>    Use Resample and LinearInterpolate
> }
> else if ( vector pixel type )
> {
>    Use VectorResample and VectorLinearInterpolate
> }
>
> However, rather than make the switch in my own code, I'm wondering if
> it would be possible to do the switch within the ITK components (ie.
> make "uber" resampler/interpolator components which work on both
> scalar and vector images). I even heard rumors this had once been
> discussed on the mailing list...? What would be involved to achieve
> this?
>
> Thanks for any advice.
>
> Cheers, Dan
> _____________________________________
> 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