[Insight-users] read an image from a file

JOJOW jieqiong.wang17 at gmail.com
Tue Jul 19 10:21:51 EDT 2011


    I compiled itk in  vs2008. There is a problem in the example of itk. The
code is 
#include "itkImage.h"
#include "itkImageFileReader.h"
int main( int , char * argv[])
{
typedef unsigned char          PixelType;
const unsigned int             Dimension = 3;

typedef itk::Image< PixelType, Dimension >   ImageType;
typedef itk::ImageFileReader< ImageType >  ReaderType;
ReaderType::Pointer reader = ReaderType::New();
const char * filename ="mprage_noface.nii";
reader->SetFileName( filename );
reader->Update();
ImageType::Pointer image = reader->GetOutput();

return 0;
}

If I choose release mode, the result is correct. But If I choose debug mode,
when the code run to reader->update(), there is an error:
Unhandled exception at 0x00ae7ca0 in *.exe: 0xC0000005: access conflict
occours when read  location 0xcccccccc

I don't know what's wrong!

Best regards,
Jojo


--
View this message in context: http://itk-insight-users.2283740.n2.nabble.com/read-an-image-from-a-file-tp6598945p6598945.html
Sent from the ITK Insight Users mailing list archive at Nabble.com.


More information about the Insight-users mailing list