[Insight-users] OT: Generic Programming - Typedefs inside template functions

Wagner Sales wsalles2003 at yahoo.com.br
Sun Jan 7 19:02:41 EST 2007


Dears,

May be that's a fool question, but I'm not so familiar with templates and my searches are returned not useful.

Well, I'm trying to give some type at a template function and use them to define the image type. My method are:

template <typename T>
void MyFilter::processImage(T)
{
    if(!m_ImageData) return;
    // defines the type
    typedef T PixelType;
    typedef itk::Image<T, 3> ImageData;
    ImageData::Pointer m_Image = ImageData::New();
    typedef itk::ImageToVTKImageFilter< ImageData > ToVTKConverter;
        typedef itk::VTKImageToImageFilter< ImageData > ToITKConverter;
    typedef itk::BinaryThresholdImageFilter<ImageData, ImageData> FilterType;
    ToVTKConverter::Pointer m_toVTKConverter = ToVTKConverter::New();
        ToITKConverter::Pointer m_toITKConverter = ToITKConverter::New();
    FilterType::Pointer m_Filter = FilterType::New();
.
.
and so on...
}

My compiler just returns:
MyFilter.cpp:78: error: expected `;' before ‘a’
MyFilter.cpp:82: error: expected `;' before ‘m_toVTKConverter’
MyFilter.cpp:83: error: expected `;' before ‘m_toITKConverter’
MyFilter.cpp:84: error: expected `;' before ‘m_Filter’

This method are inside a NOT template class, and I'm trying to solve the various pixel types that's are encountered in DICOM images without conversion, just instantiate the filter and runs them.

Sorry by this newbie question,
but I'll appreciate any help from yours.

Thanks in advance,

Wagner Sales


 __________________________________________________
Fale com seus amigos  de graça com o novo Yahoo! Messenger 
http://br.messenger.yahoo.com/ 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://public.kitware.com/pipermail/insight-users/attachments/20070107/581da215/attachment.html


More information about the Insight-users mailing list