[Insight-developers] ITK code style
Zachary Pincus
zpincus at stanford.edu
Sun, 25 Apr 2004 17:12:09 -0700
Hello,
I'm working on a class that I think I might submit for inclusion in
ITK. (Specifically, a class that calculates the projection of an image
into the space described by an orthonormal basis set, e.g. the output
of PCA analysis).
Anyhow, I had a couple of questions on what I ought to do to conform to
ITK's style, etc.
First, a CastImageFilter will be needed for this computation, except in
the case when the template output and input image types are the same.
To what extent does/should ITK code try to detect these cases and skip
unnecessary steps? (And if this is recommended, is there a good
mechanism for doing so? All I can think of is a templated function
AreTheSame<TypeA, TypeB>() that returns false except in the few special
cases I implement manually... And that seems a bit nasty.)
Second, my class needs basically all the output from a
PCAShapeModelEstimator. Projecting into a space described by a basis
set is a general task, but from the ITK perspective, this pretty much
is only necessary in the PCA case. Anyhow, I could have my class take
as input either (a) a series of images that consist of a portion of the
output from a PCAShapeModelEstimator, or (b) the class could just take
a reference to the PCAShapeModelEstimator itself. The latter option is
attractive, since it will be impossible for users to do the wrong thing
and send the wrong part of the Estimator's output to my class. But it
seems a bit at variance to the way things are done in ITK. Does anyone
have guidance for this case?
Thanks,
Zach Pincus
Department of Biochemistry and Program in Biomedical Informatics
Stanford University School of Medicine