[Insight-users] weird thing happen when I try to write template function
Baoyun Li
baoyun_li123 at yahoo.com
Fri Feb 20 17:47:01 EST 2009
Dear All:
I am trying to write some template function.
Here is my function, it just passed ReaderType::Pointer from the main program
template <class TInputImage>
void IsotropicResample( TInputImage* inputimage )
{
const unsigned int Dimension=3;
typedef short OutputPixelType;
typedef itk::Image< OutputPixelType, Dimension > OutputImageType;
typedef itk::ImageFileWriter< OutputImageType > WriterType;
WriterType::Pointer writer = WriterType::New();
writer->SetFileName("../data/test.hdr");
writer->SetInput( inputimage->GetOutput() );
try
{
writer->Update();
}
catch( itk::ExceptionObject & excep )
{
std::cerr << "Exception caught !" << std::endl;
std::cerr << excep << std::endl;
}
;
};
////// in the main function, we call the function as following
main()
{
typedef itk::ImageFileReader< InputImageType > ReaderType;
ReaderType::Pointer reader = ReaderType::New();
IsotropicResample <ReaderType> (reader );
}
When I run the program through command line, everything is ok, I got the test.hdr as output.
But when I debug program, the program catch error and goes to the catch branch.
warning RTTI symbol not found,
FileReader<itk::Image<short, 3u>, itk::DefaultConvertPixelTraits<short> >'
try
{
writer->Update();
}
catch( itk::ExceptionObject & excep )
{
std::cerr << "Exception caught !" << std::endl;
std::cerr << excep << std::endl;
}
However, the result is still there?
Can sombody teach me how to solve this problem??
Thanks
Baoyun
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20090220/3d79bb60/attachment.htm>
More information about the Insight-users
mailing list