[Insight-developers] Image Orientation Progress(2) :
MetaProgramming
Lorensen, William E (Research)
lorensen at crd.ge.com
Sun Mar 13 08:05:36 EST 2005
Luis,
Looks promising. For now I'll continue down the conventional path. We can inject this technology later.
Bill
-----Original Message-----
From: Luis Ibanez [mailto:luis.ibanez at kitware.com]
Sent: Saturday, March 12, 2005 11:26 PM
To: Lorensen, William E (Research)
Cc: Insight-developers (E-mail)
Subject: Re: [Insight-developers] Image Orientation Progress(2) :
MetaProgramming
Bill,
Given the performance concern of the Index-Physical point conversion,
it may be interesting to look at implementing these methods using
recursive templates (aka MetaProgramming).
We may be able to to this if we manage to avoid any partial specialization.
I just put a proposal in the Wiki with a draft code of a Helper class
that could implement the recursion.
http://www.itk.org/Wiki/Proposals:Orientation#Recursive_Templates_for_fast_computation_of_Index-Point_transform
The helper class could be called from the itk::Image.
This will have the advantage of
1) inlining the conversions
2) unrolling the for-loop, therefore saving an "if"
somehow (2) is related to (1), since some compliers will
refuse to inline functions that contain for loops.
For a couple of links on MetaProgramming:
http://www.boost-consulting.com/metaprogramming-book.html
http://www.awprofessional.com/bookstore/product.asp?isbn=0321227255&rl=1#
http://www.amazon.com/exec/obidos/tg/detail/-/0321227255/qid=1110687865/sr=8-1/ref=pd_csp_1/104-1336514-6670359?v=glance&s=books&n=507846
http://en.wikipedia.org/wiki/Template_metaprogramming
The same techniques should be applicable to the
Vector X Matrix computation that are needed for
the general ImageOrientation support, as well as
the computations of the Tensor pixel type.
Luis
---------------------------------------
Lorensen, William E (Research) wrote:
> Folks,
> Some more progress on the image orientation upgrade.
>
> I have been worried about performance of the PhysicalPointToIndex and other related transformations in itkImage. I have created a subclass of image called itkOrientedImage that uses the direction cosines to convert between physical space and vice versa. itkImageBase still keeps the direction cosines but does not use them for conversion between physical and index spaces. The only perfomance hit for Imnage may come from making the transformation methods virtual.
>
> (I know Stephen, this is deja vu all over again when we first did image.)
>
> This compromise will permit applications to treat the orientation if desired while allowing other apps to trade-off performance if all images are of the same ilk.
>
> I am still doing this in my local checkout. I'd appreciate comments.
>
> Bill
> _______________________________________________
> Insight-developers mailing list
> Insight-developers at itk.org
> http://www.itk.org/mailman/listinfo/insight-developers
>
>
More information about the Insight-developers
mailing list