[Insight-developers] Image::TransformPhysicalPointToIndex

Wilson Chang wmcst6+@pitt.edu
Wed, 27 Feb 2002 17:21:03 -0500


I just checked and there already is code that does the bounds checking.  It
seems likely that many coordinates might land outside of the dataspace even
with truncation, and that is why the bounds checking is still in place.
Rounding might introduce a few, but probably insignificant, amoutn of
additional pixels landing out of bounds.  I think the benefits of nearest
neighbor might outweight the few additional pixels landing out of bounds.
Would there be a performance hit with going to rounding?  That would be my
only concern.

wilson


----- Original Message -----
From: "Miller, James V (CRD)" <millerjv@crd.ge.com>
To: "'Lydia Ng'" <lng@insightful.com>;
<insight-developers@public.kitware.com>
Sent: Wednesday, February 27, 2002 4:56 PM
Subject: RE: [Insight-developers] Image::TransformPhysicalPointToIndex


> Interesting problem.
>
> I understand wanting nearest neighbor type calculation but if the
transform
> is changed to round then the index returned may not be a valid pixel (it
> may be outside the image).
>
> I think the default behavior should truncate and perhaps another method
> could round.
>
>
>
> -----Original Message-----
> From: Lydia Ng [mailto:lng@insightful.com]
> Sent: Wednesday, February 27, 2002 4:33 PM
> To: insight-developers@public.kitware.com
> Subject: [Insight-developers] Image::TransformPhysicalPointToIndex
>
>
>
> Currently Image::TransformPhysicalPointToIndex
> does a truncation to convert the index from
> continuous space to discrete space. i.e
>
>     for (unsigned int i = 0 ; i < VImageDimension ; i++)
>       {
>       index[i] = static_cast<long>(inputPoint[i]);
>       }
>
> Any objection if that the truncation is change
> to vnl_math_rnd instead? ie.
>
>     for (unsigned int i = 0 ; i < VImageDimension ; i++)
>       {
>       index[i] = static_cast<long>( vnl_math_rnd(inputPoint[i]) );
>       }
>
>
> - Lydia
>
>
>
> _______________________________________________
> Insight-developers mailing list
> Insight-developers@public.kitware.com
> http://public.kitware.com/mailman/listinfo/insight-developers
> _______________________________________________
> Insight-developers mailing list
> Insight-developers@public.kitware.com
> http://public.kitware.com/mailman/listinfo/insight-developers
>