[Insight-users] Crash on simple application in Release

Daanen Vincent daanen at koelis.com
Mon May 24 10:25:54 EDT 2010


Hi all,

I want to use Itk image loading capabilities.
This simple program crashes ** in release (it's ok in debug) ** on the
itk::ImageFileReader constructor 80

What's wrong with the so simple program ?


template <class ITK_IMAGE>
bool ReadAsAnalyze(typename ITK_IMAGE::Pointer p_pImg, const char *p_pName)
{
	typedef ITK_IMAGE TImage;
	typedef itk::ImageFileReader< TImage > ReaderType;
	typedef itk::AnalyzeImageIO ImageIOType;

	ReaderType::Pointer reader = ReaderType::New();
	ImageIOType::Pointer AnalyzeImageIO = ImageIOType::New();
	reader->SetFileName(p_pName);

	try {
		reader->Update();
		p_pImg = reader->GetOutput();

	}
	catch( itk::ExceptionObject & err ) {
		std::cerr << "ExceptionObject caught !" << std::endl;
		std::cerr << err << std::endl;
		return false;
	}

	return true;
}


int main(int argc, char **argv)
{
	typedef itk::Image<WORD,3> TImage;
	TImage::Pointer l_pImg = TImage::New();
	
	
ReadAsAnalyze<TImage>(l_pImg,InExePath("..\\..\\Doc\\JESSAI\\Coronal_Anisotr
opic.hdr"));
}


My platform is Visual Studio 2005/ Windows XP SP3

Thanks for any help

 V
--------------------------------------------
Vincent Daanen, PhD
D&D Manager

--------------------------------------------
KOELIS
5, avenue du Grand Sablon 38700 La Tronche
www.koelis.com  -  daanen at koelis.com
Tel .+33(0) 476637588 Fax .+33(0) 476637592
--------------------------------------------

CONFIDENTIALITY This e-mail and any attachments are confidential and may
also be privileged. If you are not the named recipient, please notify the
sender immediately and do not disclose the contents to another person, use
it for any purpose, or store or copy the information in any medium.

"Les problèmes ne peuvent être résolus par ceux dont l'horizon se limite aux
réalités quotidiennes,  mais par ceux qui rêvent de choses qui n'ont jamais
existé et qui se disent : Pourquoi Pas ?" (J-F Kennedy, 1963). 



More information about the Insight-users mailing list