[Insight-users] GDCMImageIO with (wx)Windows App

Derek Magee derekmagee at hotmail.com
Mon Jul 24 13:07:34 EDT 2006


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



More information about the Insight-users mailing list