[Insight-users] Writing images to files

Julien Jomier jjomier at cs.unc.edu
Tue Sep 7 14:31:46 EDT 2004


Hi Chris,

It seems that you are missing some ITK libraries.
Please check that you have added the ITKIO library in your CMakeLists.txt
Otherwise, can you post your CMakeLists.txt to the list?

Thanks,

Julien

> -----Original Message-----
> From: insight-users-bounces at itk.org 
> [mailto:insight-users-bounces at itk.org] On Behalf Of chris harris
> Sent: Tuesday, September 07, 2004 2:20 PM
> To: insight-users at itk.org
> Subject: RE: [Insight-users] Writing images to files
> 
> 
> Hi Julien,
>            Thanks for the suggestion. I have added the
> line to my code and the object file is built
> succesfully but Iam getting some errors concerning the
> ImageIOFactory while building the executable file. Iam
>  unable to comprehend what it says and the program is
> executing well if I take out the writing the image
> part. Iam pasting the error below. Thanks for the
> help.
> 
> Building dependencies. cmake.depends...
> Building object file Image1.o...
> Building executable 
> .../itkp/Image1...
> Image1.o(.gnu.linkonce.t._ZN3itk13ImageIORegionC1Ev+0x1a):
> In function `itk::ImageIORegion::ImageIOReg ion()':
> : undefined reference to `vtable for
> itk::ImageIORegion'
> Image1.o(.gnu.linkonce.t._ZN3itk15ImageFileWriterINS_5ImageItL
j3EEEE5WriteEv+0x6db):
> In function `itk: :ImageFileWriter<itk::Image<unsigned
> short, 3u> >::Write()':
> : undefined reference to
> `itk::ImageIOFactory::CreateImageIO(char const*,
> itk::ImageIOFactory::FileMod eType)'
> Image1.o(.gnu.linkonce.t._ZN3itk15ImageFileWriterINS_5ImageItL
j3EEEE5WriteEv+0xae4):
> In function `itk: :ImageFileWriter<itk::Image<unsigned
> short, 3u> >::Write()':
> : undefined reference to
> `itk::ImageIOFactory::CreateImageIO(char const*,
> itk::ImageIOFactory::FileMod eType)'
> Image1.o(.gnu.linkonce.t._ZN3itk15ImageFileWriterINS_5ImageItL
j3EEEE5WriteEv+0xf8d):
> In function `itk: :ImageFileWriter<itk::Image<unsigned
> short, 3u> >::Write()':
> : undefined reference to
> `itk::ImageIOBase::SetNumberOfDimensions(unsigned
> int)'
> Image1.o(.gnu.linkonce.t._ZNK3itk15ImageFileWriterINS_5ImageIt
Lj3EEEE9PrintSelfERSoNS_6IndentE+0x182):
>  In function `itk::ImageFileWriter<itk::Image<unsigned
> short, 3u> >::PrintSelf(std::basic_ostream<char ,
> std::char_traits<char> >&, itk::Indent) const':
> : undefined reference to
> `itk::operator<<(std::basic_ostream<char,
> std::char_traits<char> >&, itk::Ima geIORegion
> const&)'
> Image1.o(.gnu.linkonce.t._ZNK3itk15ImageFileWriterINS_5ImageIt
Lj3EEEE11GetIORegionEv+0xed):
> In functio n `itk::ImageFileWriter<itk::Image<unsigned
> short, 3u> >::GetIORegion() const':
> : undefined reference to
> `itk::operator<<(std::basic_ostream<char,
> std::char_traits<char> >&, itk::Ima geIORegion
> const&)'
> Image1.o(.gnu.linkonce.t._ZN3itk13ImageIORegionC1Ej+0x1a):
> In function `itk::ImageIORegion::ImageIOReg
> ion(unsigned int)':
> : undefined reference to `vtable for
> itk::ImageIORegion'
> Image1.o(.gnu.linkonce.t._ZN3itk13ImageIORegionD1Ev+0xb):
> In function `itk::ImageIORegion::~ImageIOReg ion()':
> : undefined reference to `vtable for
> itk::ImageIORegion'
> Image1.o(.gnu.linkonce.t._ZN3itk13ImageIORegionC1ERKS0_+0x1a):
> In function `itk::ImageIORegion::ImageI
> ORegion(itk::ImageIORegion const&)':
> : undefined reference to `vtable for
> itk::ImageIORegion'
> 
> 
> 
> 
> --- Julien Jomier <jjomier at cs.unc.edu> wrote:
> 
> > Hi Chris,
> > 
> > The error message is clear:
> > 
> > > Image1.cxx:51:`outputFilename'
> > >    undeclared (first use this function)
> > 
> > the variable 'outputFilename' is not declared. The
> > itkImageFileWriter is
> > expecting a variable of type char* for the FileName.
> > 
> > You should add in your code something like:
> > 
> > const char* outputFilename= "MyFileName.jpg";
> > 
> > Julien
> > 
> > > -----Original Message-----
> > > From: insight-users-bounces at itk.org 
> > > [mailto:insight-users-bounces at itk.org] On Behalf
> > Of chris harris
> > > Sent: Tuesday, September 07, 2004 12:47 PM
> > > To: insight-users at itk.org
> > > Subject: [Insight-users] Writing images to files
> > > 
> > > 
> > > Hi.
> > >     Iam trying to write an Image to a file
> > > outputFilename with the following lines
> > > 
> > > WriterType::Pointer writer = WriterType::New();
> > > 
> > > writer->SetFileName(outputFilename);
> > > 
> > > writer->SetInput(image);
> > > 
> > > but Iam getting an error 
> > > 
> > > Image1.cxx:51:`outputFilename'
> > >    undeclared (first use this function)
> > > 
> > > Can any one help me out in figuring out the
> > problem?
> > > 
> > > 
> > > =====
> > > Thanks
> > > Chris harris
> > > 
> > > 
> > > 		
> > > __________________________________
> > > Do you Yahoo!?
> > > Read only the mail you want - Yahoo! Mail
> > SpamGuard.
> > > http://promotions.yahoo.com/new_mail 
> > > _______________________________________________
> > > Insight-users mailing list
> > > Insight-users at itk.org
> > > http://www.itk.org/mailman/listinfo/insight-users
> > > 
> > 
> > 
> 
> 
> =====
> Thanks
> Chris harris
> 
> 
> 		
> _______________________________
> Do you Yahoo!?
> Win 1 of 4,000 free domain names from Yahoo! Enter now.
> http://promotions.yahoo.com/goldrush
> _______________________________________________
> Insight-users mailing list
> Insight-users at itk.org
> http://www.itk.org/mailman/listinfo/insight-users
> 



More information about the Insight-users mailing list