[Insight-users] Can't see result imae from ImageReadWrite

Ella Maria Kadas ella_kadas at yahoo.com
Fri Feb 25 02:20:57 EST 2011


Hi Gib,

   I managed to build ITK, VTK, and run the ImageReadWrite.cxx.
It seems that the folder structure suggested by John Drescher worked for me.
I still get a First-chance exception at 0x7c812afb in ImageReadWrite.exe: Microsoft C++ exception: itk::ExceptionObject at memory location 0x0137f6b8..
The program '[3412] ImageReadWrite.exe: Native' has exited with code 1 (0x1).
    I googled it and it seems to be a a notification to the debugger so it can stop the program.
    But i still can't see the result image. My image is a gray scale jpeg 164x120
Here is my code:
#if defined(_MSC_VER)
#pragma warning ( disable : 4786 )
#endif

#ifdef __BORLANDC__
#define ITK_LEAN_AND_MEAN
#endif

#include "itkImageFileReader.h"
#include "itkImageFileWriter.h"
#include "itkImage.h"


int main( int argc, char ** argv )
{
  

  typedef short      PixelType;
  const   unsigned int        Dimension = 2;
  typedef itk::Image< PixelType, Dimension >    ImageType;
  typedef itk::ImageFileReader< ImageType >  ReaderType;
  typedef itk::ImageFileWriter< ImageType >  WriterType;

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

  const char * inputFilename  = "bla.jpg"; 
  const char * outputFilename = "bla2.jpg";

  reader->SetFileName( inputFilename  );
  writer->SetFileName( outputFilename );
 
  try 
    { 
    writer->Update(); 
    } 
  catch( itk::ExceptionObject & err ) 
    { 
    std::cerr << "ExceptionObject caught !" << std::endl; 
    std::cerr << err << std::endl; 
    return EXIT_FAILURE;
    } 

  return EXIT_SUCCESS;
}
Cheers,
Ella


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20110225/5a7a7727/attachment.htm>


More information about the Insight-users mailing list