[Insight-users] Exception: No image IO set, or none could be created

Aaron Skewes adskewes at uh.edu
Fri Oct 22 17:13:31 EDT 2004


Hello folks,

 

I am trying to rescale some .mhd images, but I am receiving an exception
form the ImageFileWriter: No image IO set, or none could be created. I am
not sure why I am receiving this. Any ideas?

 

Thanks,

Aaron

 

 

typedef unsigned char          PixelType;

const unsigned int             Dimension = 3;

typedef itk::Image< PixelType, Dimension >   ImageType;

typedef itk::ImageFileReader< ImageType >   ReaderType;

typedef itk::ImageFileWriter< ImageType >   WriterType; 

typedef itk::RescaleIntensityImageFilter< ImageType, ImageType >
RescaleFilterType;

:

:

:

inputFileName= inputFile.data();

            ReaderType::Pointer reader = ReaderType::New();


            reader->SetFileName( inputFileName  );

            //Explicitly update the reader

            try 

                        { 

                        reader->Update(); 

                        } 

            catch( itk::ExceptionObject & err ) 

                        { 

                        std::cout << "ExceptionObject caught !" <<
std::endl; 

                        std::cout << err << std::endl; 

                        }           

 

            RescaleFilterType::Pointer rescaler = RescaleFilterType::New();

            rescaler->SetOutputMinimum(   0 );

            rescaler->SetOutputMaximum( 255 );

            rescaler->SetInput(reader->GetOutput());

 

            try

                        {

                        rescaler->Update();

                        }

            catch ( itk::ExceptionObject &err)

                        {

                        std::cout << "ExceptionObject caught !" <<
std::endl; 

                        std::cout << err << std::endl;

            }

  

            outputFileName= outputFile.data();

            WriterType::Pointer writer = WriterType::New();

            writer->SetFileName( outputFileName );

            writer->SetInput(rescaler->GetOutput());

 

            try

                        {

                        writer->Update();

                        }

            catch ( itk::ExceptionObject &err)

                        {

                        std::cout << "ExceptionObject caught !" <<
std::endl; 

                        std::cout << err << std::endl;

            }

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://public.kitware.com/pipermail/insight-users/attachments/20041022/28472184/attachment.htm


More information about the Insight-users mailing list