[Insight-users] IO object creation error
rg32@njit.edu
rg32 at njit . edu
Fri, 26 Sep 2003 12:18:18 -0400 (EDT)
Hi all ,
Could anyone help me with the run time error .
ExceptionObject caught !
itk::ImageFileReaderException (00EFFB84)
Too many errors encountered; the rest of the message is ignored:
Location: "Unknown"
File: C:\Documents and Settings\rashmi\Desktop\downloads\In
de\IO\itkImageFileReader.txx
Line: 101
Description: Could not create IO object for file bar1.png
> > ===========================
> >
> >
> > void SubtractFilter(char * arg1 , char * arg2 ,char * arg3)
> > {
> >
> > typedef unsigned char CharPixelType; //IO
> > typedef float RealPixelType; //Operations
> >
> > const unsigned int Dimension = 3;
> >
> > typedef itk::Image<CharPixelType, Dimension> CharImageType;
> > typedef itk::Image<RealPixelType, Dimension> RealImageType;
> >
> > typedef itk::ImageFileReader< RealImageType > ReaderType;
> > typedef itk::ImageFileReader< RealImageType > ReaderTypeSecond;
> >
> > typedef itk::ImageFileWriter< RealImageType > WriterType;
> >
> > typedef itk::SubtractImageFilter<RealImageType ,
> > RealImageType ,RealImageType> SubtractImageFilterType;
> >
> > //Setting the IO
> > ReaderType::Pointer reader = ReaderType::New();
> > ReaderTypeSecond::Pointer readerSecond = ReaderTypeSecond::New();
> > WriterType::Pointer writer = WriterType::New();
> >
> > //Setting the ITK pipeline filter
> >
> > SubtractImageFilterType::Pointer SubtractImageFilterPtr =
> > SubtractImageFilterType::New();
> >
> > reader->SetFileName( arg1 );
> > readerSecond->SetFileName( arg2 );
> > writer->SetFileName( arg3 );
> >
> >
> > SubtractImageFilterPtr->SetInput1(reader->GetOutput() );
> > SubtractImageFilterPtr->SetInput2(readerSecond->GetOutput() );
> >
> > try
> > {
> > SubtractImageFilterPtr->Update();
> > }
> > catch( itk::ExceptionObject & err )
> > {
> > std::cout << "ExceptionObject caught !" << std::endl;
> > std::cout << err << std::endl;
> >
> > }
> >
> > writer->SetInput(SubtractImageFilterPtr->GetOutput() );
> > writer->Update();
> >
> > }
> > int main( int argc, char * argv[] )
> > {
> > if( argc < 5 )
> > {
> > std::cerr << "Usage: " << std::endl;
> > std::cerr << argv[0] << " inputImageFile outputImageFile
> variance
> > maxKernelWidth outputImageFile2" << std::endl;
> > return 1;
> > }
> >
> > SubtractFilter(argv[1],argv[2],argv[5]);
> >
> > return 0;
> > }
> >
> >
>