[Insight-users] Please help! ImportImage filter in a function call error

Sharath Venkatesha sharath20284 at yahoo.com
Fri Aug 21 13:26:02 EDT 2009



Hi,

I have a program as follows 

//function

ImageType::Pointer myFunction(...)
{

typedef unsigned char PixelType;
const int Dimension=2;
typedef itk::ImportImageFilter< PixelType, Dimension > ImportFilterType;
ImportFilterType::Pointer importFilter = ImportFilterType::New();
...
return ImportFilter->GetOuput();
}


//main
..

typedef unsigned char PixelType;
const int Dimension=2;
typedef itk::Image < PixelType, Dimension > ImageType;
ImageType::Pointer inputImage=myFunction(...);

typedef itk::ImageFileWriter< ImageType >  WriterType;
WriterType::Pointer writer = WriterType::New();
writer->SetFileName( "test.png");
writer->SetInput( inputImage);
writer->Update();  //<---

---

I am running in debug mode in Visual Studio 2008, and I get an "Unhandled exception at 0x6008edaa (msvcr90d.dll)...." on calling Update() of the writer.
Can you let me know where I am going wrong?

I have taken care to return Smart Pointer from the function, and assign to another smart pointer in main. The memory location of the pointers is the same. But the update fails.

Thanks,
Sharath


      


More information about the Insight-users mailing list