[Insight-users] conflict between MFC and ITK

cliff macnab cliffmacnab@yahoo.co.uk
Thu, 3 Apr 2003 07:01:35 -0800 (PST)


Thanks Luis for your immediate reply.

My code is a copy of the DicomImageViewer application.

BOOL CMFRatioDoc::OnOpenDocument(LPCTSTR lpszPathName)

{
	if (!CDocument::OnOpenDocument(lpszPathName))
		return FALSE;

	// TODO: Add your specialized creation code here


  	typedef itk::ImageFileReader<DcmImageType>
DCMReaderType;
	DCMReaderType::Pointer reader=DCMReaderType::New();

	reader->SetFileName(lpszPathName);
  	try
	{
		reader->Update();
	}
	catch(itk::ExceptionObject &exception)
	{
		CString msg;
		msg.Format(exception);
		::AfxMessageBox(msg);
		return FALSE;
	}

	mImage=reader->GetOutput();

	
	return TRUE;
}

The program throws a exception of"abnormal program
termination" by MFC and stops at reader->Update().
I am trying to read dicom file.

Cliff


----- Original Message ----- 
From: "Luis Ibanez" <luis.ibanez@kitware.com>
To: "cliff macnab" <cliffmacnab@yahoo.co.uk>
Cc: <insight-users@public.kitware.com>
Sent: Thursday, April 03, 2003 10:45 PM
Subject: Re: [Insight-users] conflict between MFC and
ITK


> 
> Hi Cliff,
> 
> There are no conflicts between MFC and ITK.
> 
> The toolkit has been used with MFC applications
> from the early times of the project.
> 
> If the program is crashing in the Update() call,
> It is *very* likely that it is actually throwing
> an exception.
> 
> Did you put the Update() method in a try/catch
> block as is illustrated in the Software Guide ?
> Please take a look at the examples in the Filtering
> and 'Reading Images' Chapters.
> 
>     http://www.itk.org/ItkSoftwareGuide.pdf
> 
> It may be that the reader is having trouble to
> read your file (e.g. recognizing the file format)
> and is throwing an exception as result.  If you
don't
> catch the exception, it will abort the program.
> 
> BTW what type of file are you reading  ?
> 
> 
>     Luis
> 
> 
> -------------------------------------------------
> cliff macnab wrote:
> > Dear Experts,
> > 
> >    I am trying to show itkimage with MFC. In my
> > program, I read image with itkimagereader.
Everything
> > goes well in compiling process, but there is an
> > "abnormal program termination" when
> > "reader->update()".  By debuging, I found there is
> > conflict between win32 lib "kernel32.lib" and itk.
Am
> > I right? How to fix this problem? My OS is
Win2000.
> > 
> > Thanks in advance,
> > 
> > Cliff
> > 
> > __________________________________________________
> > Do you Yahoo!?
> > Yahoo! Tax Center - File online, calculators,
forms, and more
> > http://tax.yahoo.com
> > _______________________________________________
> > Insight-users mailing list
> > Insight-users@public.kitware.com
> >
http://public.kitware.com/mailman/listinfo/insight-users


__________________________________________________
Do you Yahoo!?
Yahoo! Tax Center - File online, calculators, forms, and more
http://tax.yahoo.com