[Insight-users] MetaImageIO problem

Chris Farmer cfarmer at scitegic.com
Mon Nov 14 16:53:05 EST 2005



Oops... wow, I'm an idiot.  It's plain to see from my code that I was
using the wrong ImageIO for my file type.  Too much cut and paste.



-----Original Message-----
From: Chris Farmer 
Sent: Monday, November 14, 2005 12:22 PM
To: insight-users at itk.org
Subject: [Insight-users] MetaImageIO problem



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

_______________________________________________
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/4R40jkeDnTeSdaxTb9KK0rTMQJQhm9lvWgUzFyHvK
VKdmDKcJVA1KFckFjvZENSAEWenbZG+dPYCv83+8g9i!hmEIxLpI6Wrkevfz3qAGx4QcJHq8
xbNNAZ3pEFPOlPIssttngDSaCaNos5BhNqCCa6WadkdsVHJO2M5qH0d1vnM9qOHQk3U1J9rn
Se0ucrUDuJVDdi1IQ0TsZXUyn4Ldh3mssVn+j+k 


More information about the Insight-users mailing list