[Insight-users] MetaImageIO problem
Chris Farmer
cfarmer at scitegic.com
Mon Nov 14 15:22:23 EST 2005
Hi. I'm trying to use the MetaImageIO class to determine some basic
image properties. I was trying to use this in a context similar to an
old post I found in the archives
(http://www.itk.org/pipermail/insight-users/2002-June/000513.html).
Here's my simple code:
try
{
itk::MetaImageIO::Pointer io = itk::MetaImageIO::New();
io->SetFileName("c:\\someimage.png");
io->ReadImageInformation();
}
catch (itk::ExceptionObject& ex)
{
const char* hmmm = ex.GetDescription();
}
The problem occurs several layers deep during the ReadImageInformation()
call, in the MET_Read function in metaUtils.cxx. The exception that's
thrown from ReadImageInformation() says simply "File cannot be read" but
there are other META_DEBUG outputs that say "MetaObject: Read: MET_Read
Failed" and "MetaImage: M_Read: Error parsing file."
I'm pretty sure this image is a valid png file. I can successfully read
it independently with an ImageFileReader and print its info. I can also
view it in other basic image handling apps.
My basic question is this: How can I get simple attributes of an image
that will enable me to choose the correct template types when creating
my itk objects? I had been using ImageMagick for this, but I would like
to drop it entirely if I can figure this out!
Thanks,
Chris
More information about the Insight-users
mailing list