[Insight-users] conflict between MFC and ITK: Problem with reader->Update()

Luis Ibanez luis.ibanez@kitware.com
Thu, 03 Apr 2003 10:16:41 -0500


Hi Cliff,

The DICOM reader in ITK expects your dicom files
to have extension ".dcm". Does your file has this
extension ?

If your file does not have any of the extensions
recognized by ITK readers (ImageIO objects), the
ImageFileReader will throw an exception.

A nice summary of IO support was recently contributed
by Mathieu Malaterre to the ITK FAQ
http://www.itk.org/cgi-bin/InsightFAQ/

The entries in question are
http://www.itk.org/cgi-bin/InsightFAQ/InsightFAQ?req=show&file=faq01.007.htp
http://www.itk.org/cgi-bin/InsightFAQ/InsightFAQ?req=show&file=faq01.008.htp

---

Also keep in mind that DICOM files can only be
read as 2D sliced. If you have an entire volume,
the simplest way to load it as this point is to
create a MetaImage header for the set of files
and them provide the name of the MetaImage header
to the reader.

JPEG compression is not supported yet in the
DICOM readers, so, please make sure that your
dicom files are uncompressed.


Regards,


   Luis



-------------------------------
cliff macnab wrote:
> 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
>