[Insight-users] AnalyzeImageIO interfering with custom ImageIO class

Parag Chandra pchandra@radonc.unc.edu
Fri, 2 May 2003 16:12:32 -0400


This is a multi-part message in MIME format.

------=_NextPart_000_0020_01C310C5.A3377BF0
Content-Type: text/plain;
	charset="US-ASCII"
Content-Transfer-Encoding: quoted-printable

Hi,

=20

I've registered a couple of ImageIO classes that I've written with the
object factory, and am seeing a problem when the ImageFileReader =
attempts to
instantiate the correct one based on the given filename. The first of =
the
ImageIO's I've registered correctly returns false from CanReadFile(), =
and
then the next ImageIO that is checked is AnalyzeImageIO.
AnalyzeImageIO::CanReadFile() always strips off the file extension and
appends a .hdr to the filename, so if I passed myfile.fm, it changes it =
to
myfile.hdr. It then attempts to open 'myfile.hdr', which does not exist
since it's not an Analyze file to begin with, so the open fails, and the
method then throws an itk::ExceptionObject. So in effect, the second =
ImageIO
class I've registered, which will correctly handle the image, is never =
asked
if it can read the file, and the file cannot be loaded. Shouldn't this
method just return false if the file cannot be opened, so that other
ImageIO's can be queried? I also cannot just manually set the ImageIO of =
the
ImageFileReader, since I don't know the filetype in advance. Is this a =
bug,
or am I doing something wrong?

=20

Best regards,

-Parag

=20


------=_NextPart_000_0020_01C310C5.A3377BF0
Content-Type: text/html;
	charset="US-ASCII"
Content-Transfer-Encoding: quoted-printable

<html>

<head>
<META HTTP-EQUIV=3D"Content-Type" CONTENT=3D"text/html; =
charset=3Dus-ascii">


<meta name=3DGenerator content=3D"Microsoft Word 10 (filtered)">

<style>
<!--
 /* Style Definitions */
 p.MsoNormal, li.MsoNormal, div.MsoNormal
	{margin:0in;
	margin-bottom:.0001pt;
	font-size:12.0pt;
	font-family:"Times New Roman";}
a:link, span.MsoHyperlink
	{color:blue;
	text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
	{color:purple;
	text-decoration:underline;}
span.EmailStyle17
	{font-family:Arial;
	color:windowtext;}
@page Section1
	{size:8.5in 11.0in;
	margin:1.0in 1.25in 1.0in 1.25in;}
div.Section1
	{page:Section1;}
-->
</style>

</head>

<body lang=3DEN-US link=3Dblue vlink=3Dpurple>

<div class=3DSection1>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>Hi,</span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>&nbsp;</span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>I&#8217;ve registered a couple of ImageIO classes =
that I&#8217;ve
written with the object factory, and am seeing a problem when the
ImageFileReader attempts to instantiate the correct one based on the =
given
filename. The first of the ImageIO&#8217;s I&#8217;ve registered =
correctly
returns false from CanReadFile(), and then the next ImageIO that is =
checked is
AnalyzeImageIO. AnalyzeImageIO::CanReadFile() always strips off the file
extension and appends a .hdr to the filename, so if I passed myfile.fm, =
it changes
it to myfile.hdr. It then attempts to open &#8216;myfile.hdr&#8217;, =
which does
not exist since it&#8217;s not an Analyze file to begin with, so the =
open
fails, and the method then throws an itk::ExceptionObject. So in effect, =
the
second ImageIO class I&#8217;ve registered, which will correctly handle =
the
image, is never asked if it can read the file, and the file cannot be =
loaded.
Shouldn&#8217;t this method just return false if the file cannot be =
opened, so
that other ImageIO&#8217;s can be queried? I also cannot just manually =
set the
ImageIO of the ImageFileReader, since I don&#8217;t know the filetype in
advance. Is this a bug, or am I doing something wrong?</span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>&nbsp;</span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>Best regards,</span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>-Parag</span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>&nbsp;</span></font></p>

</div>

</body>

</html>

------=_NextPart_000_0020_01C310C5.A3377BF0--