[Insight-users] Exception of read image

Jimmy Wong good_piggy at msn.com
Mon Nov 29 09:17:33 EST 2004


Dear itk users:

I have such an exception :

"Unhandled exception at 0x77e738b2 in myJRS.exe: Microsoft C++ exception: 
itk::ImageFileReaderException @0x00fbf748"

and the pointer points to the "std::ifstream readTester" in 
itkimagefilereader.txx

My code:
============================================
#include "itkImage.h"
#include "itkImageFileReader.h"

#include "itkScalarImageToListAdaptor.h"

const    unsigned int    Dimension = 2;
typedef  unsigned char   PixelType;

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

typedef itk::ImageFileReader< ImageType >	ReaderType;

typedef itk::Statistics::ScalarImageToListAdaptor< ImageType > SampleType;



const char * InputImageName[]  = {"A.png", "B.png"};

int main()
{
	// Read source images
	ReaderType::Pointer readerA = ReaderType::New();
	ReaderType::Pointer readerB = ReaderType::New();
	readerA->SetFileName( InputImageName[0] );
	readerB->SetFileName( InputImageName[1] );

	readerA->Update();
	ImageType::Pointer image = readerA->GetOutput();

	SampleType::Pointer sample = SampleType::New();
	sample->SetImage(image);


	return 0;
}
==============================================

What's wrong with it? Anyone has idea of this one?

Thanks.




More information about the Insight-users mailing list