[Insight-users] conflict between MFC and ITK
Lydia Ng
lng@insightful.com
Thu, 3 Apr 2003 09:52:56 -0800
Hi Cliff,
You might know this already. In visual studio you can set the debugger
to break when an exception is thrown=20
(Debug->Exceptions->Micosoft C++ Exception set to always stop).=20
This might help you to track down the origin of the exception.
Cheers,
Lydia
> -----Original Message-----
> From: cliff macnab [mailto:cliffmacnab@yahoo.co.uk]
> Sent: Thursday, April 03, 2003 7:02 AM
> To: luis.ibanez@kitware.com
> Cc: Insight-users@public.kitware.com
> Subject: Re: [Insight-users] conflict between MFC and ITK
>=20
> Thanks Luis for your immediate reply.
>=20
> My code is a copy of the DicomImageViewer application.
>=20
> BOOL CMFRatioDoc::OnOpenDocument(LPCTSTR lpszPathName)
>=20
> {
> if (!CDocument::OnOpenDocument(lpszPathName))
> return FALSE;
>=20
> // TODO: Add your specialized creation code here
>=20
>=20
> typedef itk::ImageFileReader<DcmImageType>
> DCMReaderType;
> DCMReaderType::Pointer reader=3DDCMReaderType::New();
>=20
> reader->SetFileName(lpszPathName);
> try
> {
> reader->Update();
> }
> catch(itk::ExceptionObject &exception)
> {
> CString msg;
> msg.Format(exception);
> ::AfxMessageBox(msg);
> return FALSE;
> }
>=20
> mImage=3Dreader->GetOutput();
>=20
>=20
> return TRUE;
> }
>=20
> The program throws a exception of"abnormal program
> termination" by MFC and stops at reader->Update().
> I am trying to read dicom file.
>=20
> Cliff
>=20
>=20
> ----- 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
>=20
>=20
> >
> > 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
>=20
>=20
> __________________________________________________
> 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