[Insight-users] Simple file reader problem

Chris Farmer cfarmer at scitegic.com
Thu Sep 8 19:24:51 EDT 2005


Ah, perfect!  

Thanks for the quick response.  This works nicely.  I've now lost the
color information in my image, but that's just something else for me to
discover how to control in itk.





-----Original Message-----
From: Luis Ibanez [mailto:luis.ibanez at kitware.com] 
Sent: Thursday, September 08, 2005 4:10 PM
To: Chris Farmer
Cc: insight-users at itk.org
Subject: Re: [Insight-users] Simple file reader problem


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
> 
> 



-- 
Click on the link below to report this email as spam
https://www.mailcontrol.com/sr/3mT2PcpIGEGN7h6gajsy8WbOlFV3Ue4iF75QR78Uv
mQoc8uc9vJ20zaoRWjm3qYxhhNDuvRdMMgDiQGSTvX7gMpmzG8rFbdzBJilVU+N+K3qGlWMk
Mkxo!Qa1rHiyLmmanFZD!XYlwkNSjbsMCOj5rg1mnnrtBq8Ks49AKW!uQrPIBrPNadG6+ksz
9CEeEXk4jHKGIEkXnEbCnFw7IqCX+J4u9Ekoi!I 


More information about the Insight-users mailing list