[Insight-developers] proposed addition to itkImage: get indexed pixel Voronoi region

Luis Ibanez luis.ibanez at kitware.com
Mon Aug 8 10:34:06 EDT 2005


Hi Torsten,

It doesnt seems to be too much of a problem.

I will just suggest to use MetaProgramming in order
to avoid the for() loop, since it will prevent this
function from being inlined...


Note also that this service could also be provided
by a helper class, to which you connect the image
in order to get Origin and Spacing.  Then add a
method to that helper class in order to compute
the Voronoi region. In this way you could speed
up the computation.

This could be a bit like the Image Calculators...


   Regards,


      Luis



-------------------------
Torsten Rohlfing wrote:
> 
> Hi Luis and everyone:
> 
> I was wondering what the general sentiment is about adding a member 
> function to itkImage to compute a pixel's Voronoi region? This function 
> might look something like this:
> 
>  /** Get the Voronoi region of a pixel in physical space (in the space 
> which
> 
>   * the origin and spacing infomation comes from) from a discrete index 
> (in the index space)
> 
>   */
> 
>  template<class TCoordRep>
> 
>  void GetPixelVoronoiCellFromIndex(
> 
>    const IndexType & index,
> 
>    Point<TCoordRep, VImageDimension>& voronoiRegionFrom,
> 
>    Point<TCoordRep, VImageDimension>& voronoiRegionTo ) const
> 
>  {
> 
>    for (unsigned int i = 0 ; i < VImageDimension ; i++)
> 
>      {
> 
>      voronoiRegionFrom[i] =
>    static_cast<TCoordRep>( this->m_Spacing[i] *
> 
>                ( static_cast<double>( index[i] ) - 0.5 )
> 
>                + this->m_Origin[i] );
> 
>      voronoiRegionTo[i] =
>    voronoiRegionFrom[i] + static_cast<TCoordRep>( this->m_Spacing[i] );
>      }
> 
>  }
> 
> 
> I would also be curious if you could think of a better way to represent 
> the resulting region, rather than by its two corner points. I couldn't 
> seem to find any lightweight class for a physical-space box in ITK, but 
> maybe I am just missing something?
> 
> Thanks for any comments and suggestions!
>  Torsten
> 
> PS: why do I need this? Well, once I have the Voronoi region of any 
> given pixel, I can compute the intersections of any given line with the 
> boundaries of that region (currently coding that), and that will be very 
> useful in implementing Mori's DTI fiber tracking algorithm in ITK. In 
> the long run, the line intersection may also be useful for high-quality 
> DRR computation and/or ART-type CT reconstruction.
> 



More information about the Insight-developers mailing list