[Insight-developers] Re: ImageAdaptors, ImageBase, extracting enum during derivation
Luis Ibanez
ibanez@cs.unc.edu
Tue, 20 Feb 2001 13:52:07 -0500
Jim,
We have encounter this problem before, and it is not clear
how to solve it right. It seems that the compiler initialize
the enums only after checking the types.
When the ImageDimension is to be used for declaring internal
new types, Lydia found that the best solution is to declare an
enum with the dimenision, and use the enum in the subsequent
typedefs...
But, as here we need to use it to declare the class itself, that
doesn't seems to be feasible.
The option you propose of templating the ImageAdaptor
over dimension sounds good to me.
It has the additional advantage that if we figure out the way
of extending the capabilities of ImageAdaptors, one application
is to generate 2D images from 3D ones, and in those cases
having a separate dimension spedified will be a plus.
Luis
--------------------
"Miller, James V (CRD)" wrote:
> Luis,
>
> I am still working on revamping ImageBase. I have hit a problem with subclassing ImageAdaptor from
> ImageBase. ImageAdaptor is templated over image type and accessor type. But in specifying its
> derivation from ImageBase, we need to tell ImageBase the dimension of the image. So what I like to
> write is code like....
>
> template <class TImage, class TAccessor >
> class ITK_EXPORT ImageAdaptor : public ImageBase<TImage::ImageDimension>
> {
> public:
> ...
>
> But the compilers are tripping over over the "public ImageBase<TImage::ImageDimension>" clause, and
> incorrectly translating this to "public ImageBase<0>".
>
> Do you know of a way to specify the derivation so ImageBase is templated over the dimension of the
> image (which is the template parameter to ImageAdaptor)?
>
> The only path I see so far is add a template parameter to the ImageAdaptor which the dimension of the
> image it is adapting.
>
> Jim Miller
> _____________________________________
> Computer Graphics & Systems Program
> GE Corporate Research & Development
> Bldg. KW, Room C218B
> P.O. Box 8, Schenectady NY 12301
>
> millerjv@crd.ge.com <mailto:millerjv@crd.ge.com>
> (518) 387-4005, Dial Comm: 8*833-4005,
> Cell: (518) 505-7065, Fax: (518) 387-6981
>
> <<James Miller (E-mail).vcf>>
>
> Name: James Miller (E-mail).vcf
> James Miller (E-mail).vcf Type: VCard (text/x-vcard)
> Encoding: x-uuencode
--
______________________________________________________________________
Luis Ibanez
Research Assistant Professor - Division of Neurosurgery
University of North Carolina at Chapel Hill
CB# 7060, Chapel Hill, NC 27599
email : ibanez@cs.unc.edu home : http://www.cs.unc.edu/~ibanez
phone : (919)-843-9961 fax : (919)-966-6627
______________________________________________________________________