[Insight-developers] about fileio

Ting Chen chenting@graphics.cis.upenn.edu
Mon, 22 Jan 2001 13:43:10 -0600


I am writing code to read in data from arbitary image file format such as
jpeg and bitmap. I am using the class itkfilterfileiotoimage. but there is
error message when I compile the code.
here is my code:
typedef itk::Image<float>  Image;
...
itk::FilterFileIOToImage<Image>* loadFilter;
loadFilter = new itk::FilterFileIOToImage<Image>("myimage.bmp");
...


and the error message:
d:\users\chenting\insight\insight\code\common\itkfilterfileiotoimage.txx(34)
: error C2039: 'Index' : is not a member of 'Image<float,2,class
itk::ValarrayImageContainer<unsigned long,float> >'
        d:\program files\vc98\include\xtree(559) : while compiling
class-template member function 'void __thiscall
itk::FilterFileIOToImage<class itk::Image<float,2,class
itk::ValarrayImageContainer<unsigned long,float> > >::GenerateData(void)'
d:\users\chenting\insight\insight\code\common\itkfilterfileiotoimage.txx(34)
: error C2955: 'Index' : use of class template requires template argument
list
        d:\users\chenting\insight\insight\code\common\itkindex.h(237) : see
declaration of 'Index'
        d:\program files\vc98\include\xtree(559) : while compiling
class-template member function 'void __thiscall
itk::FilterFileIOToImage<class itk::Image<float,2,class
itk::ValarrayImageContainer<unsigned long,float> > >::GenerateData(void)'
d:\users\chenting\insight\insight\code\common\itkfilterfileiotoimage.txx(34)
: error C2133: 'start' : unknown size
        d:\program files\vc98\include\xtree(559) : while compiling
class-template member function 'void __thiscall
itk::FilterFileIOToImage<class itk::Image<float,2,class
itk::ValarrayImageContainer<unsigned long,float> > >::GenerateData(void)'
d:\users\chenting\insight\insight\code\common\itkfilterfileiotoimage.txx(34)
: error C2512: 'Index' : no appropriate default constructor available
        d:\program files\vc98\include\xtree(559) : while compiling
class-template member function 'void __thiscall
itk::FilterFileIOToImage<class itk::Image<float,2,class
itk::ValarrayImageContainer<unsigned long,float> > >::GenerateData(void)'
d:\users\chenting\insight\insight\code\common\itkfilterfileiotoimage.txx(34)
: error C2262: 'start' : cannot be destroyed
        d:\program files\vc98\include\xtree(559) : while compiling
class-template member function 'void __thiscall
itk::FilterFileIOToImage<class itk::Image<float,2,class
itk::ValarrayImageContainer<unsigned long,float> > >::GenerateData(void)'
d:\users\chenting\insight\insight\code\common\itkfilterfileiotoimage.txx(35)
: error C2662: 'SetIndex' : cannot convert 'this' pointer from 'class
itk::Index' to 'class itk::Index<VIndexDimension> &'
        Reason: cannot convert from 'class itk::Index' to 'class
itk::Index<VIndexDimension>'
        Conversion requires a second user-defined-conversion operator or
constructor
        d:\program files\vc98\include\xtree(559) : while compiling
class-template member function 'void __thiscall
itk::FilterFileIOToImage<class itk::Image<float,2,class
itk::ValarrayImageContainer<unsigned long,float> > >::GenerateData(void)'
d:\users\chenting\insight\insight\code\common\itkfilterfileiotoimage.txx(40)
: error C2664: 'SetIndex' : cannot convert parameter 1 from 'class
itk::Index' to 'const class itk::Index<2> &'
        Reason: cannot convert from 'class itk::Index' to 'const class
itk::Index<2>'
        No constructor could take the source type, or constructor overload
resolution was ambiguous
        d:\program files\vc98\include\xtree(559) : while compiling
class-template member function 'void __thiscall
itk::FilterFileIOToImage<class itk::Image<float,2,class
itk::ValarrayImageContainer<unsigned long,float> > >::GenerateData(void)'

actually i think the class itkfilterfileiotoimage do not like the imageio
class introduced in the documents directory. can anyone who have written
code for the similar purpose give me a short template for image file read
in? Thanks!
ting