[Insight-users] IO object creation error

Luis Ibanez luis . ibanez at kitware . com
Fri, 26 Sep 2003 14:47:10 -0400


Hi Rg32,

Your code looks fine.

The ImageFileReader throws exceptions when it
fails to find an ImageIO capable of reading
your image file.

It may be that your "bar1.png" file is not
quite a standard PNG file.

Have you tried with the PNG files that are
available in Insight/Examples/Data  ?

Please try your program with the PNG files
in that directory.

You could also try to read your PNG file
with some of the IO examples in
Insight/Examples/IO,

a good try will be ImageReadWrite.cxx


This should help to figure out if the
problem is originated from your code or
from your data.


Please let us know what you find.


Thanks,


   Luis



--------------------------
rg32 at njit . edu wrote:
> 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;
>>>}
>>>
>>>
>>
> 
> _______________________________________________
> Insight-users mailing list
> Insight-users at itk . org
> http://www . itk . org/mailman/listinfo/insight-users
>