[Insight-developers] imageIO questions

Wilson Chang wmcst6+@pitt.edu
Fri, 22 Mar 2002 16:13:33 -0500


This is a multi-part message in MIME format.

------=_NextPart_000_00F3_01C1D1BC.837C9000
Content-Type: text/plain;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

hi

I have been having some problems using the image IO to read in a variety =
of file types, specifically VTK and Meta data files.  Using the code =
below to read in 3D data (both VTK and meta files):


typedef itk::Image<unsigned char, 3> InputITKImageType;
typedef itk::ImageFileReader<InputITKImageType> ImageFileReaderType;

reader =3D ImageFileReaderType::New();
itk::VTKImageIOFactory::RegisterOneFactory();
itk::MetaImageIOFactory::RegisterOneFactory();=20
 reader->SetFileName(lpszPathName);=20
try
{
  reader->Update();
}
catch (itk::ImageFileReaderException &e)
.
.
.


an exception is thrown:
Number of dimensions in file (2) does not match number of dimensions in =
output (3).=20

However, i am sure that the files are 3D data.  The code also fails if I =
force the ImageFileReader to use a specific imageIO such as =
itkVTKImageIO or itkMetaImageIO.

Has anyone else encountered any similar problems? ideas?


thanks,
wilson


------=_NextPart_000_00F3_01C1D1BC.837C9000
Content-Type: text/html;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-1">
<META content=3D"MSHTML 6.00.2712.300" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT face=3DArial size=3D2>hi</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>I have been having some problems using =
the image IO=20
to read in a variety of file types, specifically VTK and Meta data =
files.&nbsp;=20
Using the code below to read in 3D data (both VTK and meta =
files):</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>typedef itk::Image&lt;unsigned char, =
3&gt;=20
InputITKImageType;<BR></FONT><FONT face=3DArial size=3D2>typedef=20
itk::ImageFileReader&lt;InputITKImageType&gt;=20
ImageFileReaderType;<BR></FONT><FONT face=3DArial size=3D2></FONT></DIV>
<DIV><FONT face=3DArial size=3D2>reader =3D=20
ImageFileReaderType::New();<BR>itk::VTKImageIOFactory::RegisterOneFactory=
();<BR>itk::MetaImageIOFactory::RegisterOneFactory();&nbsp;<BR>=20
reader-&gt;SetFileName(lpszPathName); </FONT></DIV>
<DIV><FONT face=3DArial size=3D2>try</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>{</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>&nbsp; =
reader-&gt;Update();</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>}</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>catch (itk::ImageFileReaderException=20
&amp;e)</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>an exception is thrown:</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>Number of dimensions in file (2) does =
not match=20
number of dimensions in output (3).&nbsp;</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>However, i am sure that the files are =
3D=20
data.&nbsp; The code also fails if I force the ImageFileReader to use a =
specific=20
imageIO such as itkVTKImageIO or itkMetaImageIO.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>Has anyone else encountered any similar =
problems?=20
ideas?</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>thanks,</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>wilson</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV></BODY></HTML>

------=_NextPart_000_00F3_01C1D1BC.837C9000--