[Insight-developers] ITK code style
Luis Ibanez
luis.ibanez at kitware.com
Mon, 26 Apr 2004 22:24:30 -0400
Hi Zach,
1) You can use an ImageAdaptor, instead of a CastImageFilter.
Unless you plan to visit the pixels of this image many
times. Adaptors are a convenient way of changing the
pixel representation without having to duplicate memory.
You will find a chapter on ImageAdaptors in the SoftwareGuide.
2) One nice advantage of Extreme Programming is the recognition
that it is almost impossible to get things right the first
time. It is therefore more important to the *one* version
working, and then let it evolve according to the feedback
from other users. I would suggest you follow the simplest
implementation first. In this case it seems to be the option
in which you pass the PCAShapeModelEstimator as input to
the PCA projection filter.
Generalization in ITK is usually achieved by first commiting
a particular version of a class. Once in the repository, it
is easier to work with other developers in order to blend it
better with other components in the tookit, and make it more
general.
Please let us know if you have further questions.
Regards.
Luis
----------------------
Zachary Pincus wrote:
> 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
>
> _______________________________________________
> Insight-developers mailing list
> Insight-developers at itk.org
> http://www.itk.org/mailman/listinfo/insight-developers
>