[Insight-users] Pointer to itk image or filter of any type
Weiguang Guan
guanw at rhpcs.mcmaster.ca
Mon Jun 20 13:34:03 EDT 2005
Thank you, but this is not what I want. I want to define a generic
itk::Image type with unknown data type, MyGenericITKImageType. Then,
typedef itk::ImageToImageFilter <MyGenericITKImageType,
MyGenericITKImageType> MyGenericITKFilterType.
Is it possible?
Weiguang
--
========================================================
Weiguang Guan, Research Engineer
RHPCS, McMaster University
========================================================
On Mon, 20 Jun 2005, Karthik Krishnan wrote:
> If you don't want the datatype exposed in your specific function. You
> could dynamic_cast to its base class, ImageBase in this case:
>
> void ProcessAnyGenericImage( DataObject *someDataObject )
> {
> const ImageBase< 3 > *myGenericImage = dynamic_cast< const ImageBase<
> 3 > * >( someDataObject );
> if( !myGenericImage ) //throw exception
>
> // Process myGenericImage
> }
>
> But if you have a stand alone application, at some point you will have
> to explicitly instantiate the class.
>
> -karthik
>
> Weiguang Guan wrote:
>
> >Hi ITK users,
> >
> >I wonder if I could define a Pointer type of "generic" itk image or
> >filter. By "generic" I mean the data type of itk image or filter is
> >unknown, and it could be anything c++ legal type, e.g., unsigned char,
> >short, int, float ...
> >
> >I've tried (This is something I want)
> > typedef itk::Image GenericITKImageType;
> > typedef typename GenericITKImageType::Pointer
> >GenericITKImagePointer;
> >and compiler complained "invalid use of template-name ...". I just want to
> >get rid of "<float, 3>" in typedef itk::Image<float, 3> GenericITKImageType;
> >
> >Does anyone have find a way to work this out? This is actually a c++
> >question, I think.
> >
> >Thanks in advance.
> >
> >Weiguang
> >
> >
> >
>
More information about the Insight-users
mailing list