[Insight-users] GDCMImageIO with (wx)Windows App (solved by
enabling RTTI)
Derek Magee
derekmagee at hotmail.com
Wed Jul 26 06:07:46 EDT 2006
For anyone who is interested this problem was solved by enabling run
time-type info for the application being built in visual studio
(Properties->C++->Language->Enable run time-type info or using the /GR
option). This isn't actually a wxWindows/wxWidgets issue at all, just that
the example projects that come with wxWidgets have this disabled by default.
Thanks for all the help
Derek
>From: Mathieu Malaterre <mathieu.malaterre at kitware.com>
>To: Derek Magee <derekmagee at hotmail.com>
>CC: insight-users at itk.org
>Subject: Re: [Insight-users] GDCMImageIO with (wx)Windows App
>Date: Mon, 24 Jul 2006 13:14:55 -0400
>
>Derek,
>
> This is just a shot in the dark, but did you read the FAQ for wxGTK:
>
>Why doesn't reading floating point numbers work when using wxWidgets?
>If your program reads the floating point numbers in the format 123.45 from
>a file, it may suddenly start returning just 123 instead of the correct
>value on some systems -- which is all the more mysterious as the same code
>in a standalone program works just fine.
>
>The explanation is that GTK+ changes the current locale on program startup.
>If the decimal point character in the current locale is not the period (for
>example, it is comma in the French locale), all the standard C functions
>won't recognize the numbers such as above as floating point ones any more.
>
>The solution is to either use your own function for reading the floating
>point numbers (probably the best one) or to call setlocale(LC_NUMERIC, "C")
>before reading from file and restore the old locale back afterwards if
>needed.
>
>http://wxwidgets.org/docs/faqgtk.htm#locale
>
>
>
>HTH
>Mathieu
>
>Derek Magee wrote:
>>I'm trying to load a DICOM file using itk (in a wxWindows application,
>>i.e. jsut a standard windows app). The code works under linux, and in a
>>terminal app under windows (MSVC.net), but not within a GUI app
>>(wxWindows) The code is:
>>
>> typedef itk::Image< short, 2 > XImageType;
>> typedef itk::ImageFileReader< XImageType > XReaderType;
>> typedef itk::GDCMImageIO XImageIOType;
>>
>> XReaderType::Pointer Xreader = XReaderType::New();
>>
>> XImageIOType::Pointer XdicomIO = XImageIOType::New();
>> Xreader->SetFileName( "E:\\DICOM\\41A6F3CD.DCM" );
>> Xreader->SetImageIO( XdicomIO );
>>
>> try
>> {
>> Xreader->Update();
>> }
>> catch (itk::ExceptionObject &ex)
>> {
>> cerr << "Read error" << endl ;
>> }
>> catch(...)
>> {
>> wxString er ;
>> er.Printf("Unknown read error E:\\DICOM\\41A6F3CD.DCM") ;
>> wxLogError(er) ;
>> }
>>
>>The "Unknown read error" exception is caught. This seems to relate to the
>>dynamic cast in itkImageFileReader.txx:
>>
>>template <class TOutputImage, class ConvertPixelTraits>
>>void
>>ImageFileReader<TOutputImage, ConvertPixelTraits>
>>::EnlargeOutputRequestedRegion(DataObject *output)
>>{
>> typename TOutputImage::Pointer out =
>>dynamic_cast<TOutputImage*>(output);
>>
>>(I'm using itk 2.0.1, but I tried 2.8.1 on another computer and the
>>exception is still there)
>>
>>Any ideas???
>>
>>Thanks
>>
>>Derek
>>
>>_________________________________________________________________
>>The new MSN Search Toolbar now includes Desktop search!
>>http://join.msn.com/toolbar/overview
>>
>>_______________________________________________
>>Insight-users mailing list
>>Insight-users at itk.org
>>http://www.itk.org/mailman/listinfo/insight-users
>>
>
_________________________________________________________________
Windows Live Messenger has arrived. Click here to download it for free!
http://imagine-msn.com/messenger/launch80/?locale=en-gb
More information about the Insight-users
mailing list