[Insight-users] Simple file reader problem
Luis Ibanez
luis.ibanez at kitware.com
Thu Sep 8 19:10:10 EDT 2005
Hi Chris,
Since you are not using CMake, you are probaly forgetting
to enable the user of RTTI in your Visual C++ project.
Without RTTI enabled, the operations of dynamic_cast will fail.
Regards,
Luis
-------------------
Chris Farmer wrote:
>
> Hi again.
>
> I'm trying something which I think should be trivial, but I'm getting an
> error that I can't seem to track down. I'm trying to read an image from
> a file using the ImageFileReader, then call Update() on the reader. The
> code is analogous to that in the Image2.cxx example:
>
> typedef unsigned char PixelType;
> const unsigned int Dimension = 2;
> typedef itk::Image< PixelType, Dimension > ImageType;
> typedef itk::ImageFileReader< ImageType > ReaderType;
> ReaderType::Pointer reader = ReaderType::New();
> reader->SetFileName( "c:\\burger.PNG" );
> reader->Update();
>
> I added this code into an existing C++ project (Windows, VS.NET 2003)
> that we've had around for a while. I didn't use cmake since it was an
> existing project. I manually added the include file directories and
> library files to the project. I also added the defines that are present
> in the Image2.vcproj file. It builds fine. This same code works
> happily in the Image2 example.
>
> When I try to run this in my application, it enters the Update() code,
> then eventually goes down into ImageFileReader<TOutputImage,
> ConvertPixelTraits>
> ::EnlargeOutputRequestedRegion(DataObject *output) in
> itkimagefilereader.txx. The first line in this method (line 257 in my
> ITK 2.2 build) does a cast of the "output" DataObject* into a
> TOutputImage::Pointer. This cast fails in my application. I'm having
> trouble figuring out how output is different in my app versus Image2.
>
> Can anyone suggest where I could be screwing this up?
>
>
> Thanks,
> Chris
>
>
>
>
>
>
> _______________________________________________
> Insight-users mailing list
> Insight-users at itk.org
> http://www.itk.org/mailman/listinfo/insight-users
>
>
More information about the Insight-users
mailing list