<div>David,</div>
<div> </div>
<div>Looks OK to me. Does aimpack.h contain and strange #define's? </div>
<div> </div>
<div>Bill<br><br> </div>
<div><span class="gmail_quote">On 10/18/07, <b class="gmail_sendername">David Christen</b> <<a href="mailto:davidchristen@gmail.com">davidchristen@gmail.com</a>> wrote:</span>
<blockquote class="gmail_quote" style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid">Hi all.<br><br>I wrote an ImageIO-class for a proprietary image file format (AIM).<br>(see itkAIMImageIO.h
below) For the last few days I was trying to add<br>the possibility of reading/writing a log about the processing done on<br>the image (ProcessingLog). However, if I call the Set- or<br>GetProcessingLog functions, I get a compiler error:
<br><br>AIMReadWrite.cxx:59: error: 'class itk::AIMImageIO' has no member<br>named 'SetProcessingLog'<br><br>The idea is to get the log from the reader-object, eventually modify<br>it and finally pass it to the writer-object.
<br><br>I've been trying many things and I found out, that I can't declare any<br>additional public functions or members. Well, I can, and I can even<br>find it in the (shared) library, but if I include it in an application
<br>and try to call the method or variable, I get the error above.<br>If I don't call any of the added functions, the application compiles<br>smoothly and the executable does exactly as expected.<br><br>If I make the member variable m_ProcessingLog public, I still can't
<br>access it from outside the class. ("... has no member named<br>'m_ProcessingLog' ")<br><br>The output of nm is:<br>[dch@neuron itkUtilities]$ nm -C libvtkmyITKUtility.so | grep AIMImageIO<br><..>
<br>00000000000f15fa W itk::AIMImageIO::SetProcessingLog(char const*)<br>00000000000f15cc W<br>itk::AIMImageIO::SetProcessingLog(std::basic_string<char,<br>std::char_traits<char>, std::allocator<char> > const&)
<br><..><br>00000000000f15dc W itk::AIMImageIO::GetProcessingLog() const<br><..><br><br>So the macro was correctly expanded (I even tested it in a member<br>function of the class).<br><br>I strongly suspect a namespace problem, but I can't figure out what I
<br>have to change.<br><br>Any help is very much appreciated,<br>David<br><br><br>/**========================================================================<br>itkAIMImageIO.h<br>=========================================================================*/
<br>#ifndef __itkAIMImageIO_h<br>#define __itkAIMImageIO_h<br><br>#include "itkImageIOBase.h"<br><br>#include "aimpack.h"<br><br>namespace itk<br>{<br>/** \class AIMImageIO<br>*<br>* \brief ImageIO object for reading and writing AIM Files
<br>*<br>*/<br>class ITK_EXPORT AIMImageIO : public ImageIOBase<br>{<br>public:<br>/** Standard class typedefs. */<br>typedef AIMImageIO Self;<br>typedef ImageIOBase Superclass;<br>typedef SmartPointer<Self> Pointer;
<br>typedef SmartPointer<const Self> ConstPointer;<br><br>/** Method for creation through the object factory. */<br>itkNewMacro(Self);<br><br>/** Run-time type information (and related methods). */<br>itkTypeMacro(AIMImageIO, ImageIOBase);
<br><br>/** Any other get/set options that should be public */<br><br>itkGetStringMacro(ProcessingLog);<br>itkSetStringMacro(ProcessingLog);<br><br>/*-------- This part of the interface deals with reading data. -----*/<br>
<br>/** Determine the file type. Returns true if this ImageIO can read the<br> * file specified. */<br>virtual bool CanReadFile(const char*);<br><br>/** Set the spacing and diemention information for the set filename.*/<br>
virtual void ReadImageInformation();<br><br>/** Reads the data from disk into the memory buffer provided. */<br>virtual void Read(void* buffer);<br><br><br>/*-------- This part of the interfaces deals with writing data. ----*/
<br><br>/** Determine the file type. Returns true if this ImageIO can read the<br> * file specified. */<br>virtual bool CanWriteFile(const char*);<br><br>/** Writes the spacing and dimentions of the image.<br> * Assumes SetFileName has been called with a valid file name. */
<br>virtual void WriteImageInformation();<br><br>/** Writes the data to disk from the memory buffer provided. Make sure<br> * that the IORegion has been set properly. */<br>virtual void Write(const void* buffer);<br><br>
protected:<br>AIMImageIO();<br>~AIMImageIO();<br>void PrintSelf(std::ostream& os, Indent indent) const;<br><br>D3AnyImage030 * m_AIMimage;<br>std::string m_ProcessingLog;<br><br>private:<br>AIMImageIO(const Self&); //purposely not implemented
<br>void operator=(const Self&); //purposely not implemented<br><br>};<br><br>} // end namespace itk<br><br>#endif // __itkAIMImageIO_h<br><br><br>/**========================================================================
<br>AIMReadWrite.cxx<br>=========================================================================*/<br>#include "itkImageFileReader.h"<br>#include "itkImageFileWriter.h"<br>#include "itkAIMImageIO.h
"<br><br>//#include "itkImage.h"<br><br><br>int main( int argc, char ** argv )<br>{<br>// Verify the number of parameters in the command line<br>if( argc < 3 )<br> {<br> std::cerr << "Usage: " << std::endl;
<br> std::cerr << argv[0] << " inputImageFile outputImageFile "<br> <<std::endl;<br> return EXIT_FAILURE;<br> }<br><br>typedef float PixelType;<br>const unsigned int Dimension = 3;
<br>typedef itk::Image< PixelType, Dimension > ImageType;<br><br>typedef itk::ImageFileReader< ImageType > ReaderType;<br>typedef itk::ImageFileWriter< ImageType > WriterType;<br>typedef itk::AIMImageIO ImageIOType;
<br><br>ReaderType::Pointer reader = ReaderType::New();<br>WriterType::Pointer writer = WriterType::New();<br>ImageIOType::Pointer aimIOwrite = ImageIOType::New();<br>ImageIOType::Pointer aimIOread = ImageIOType::New();<br>
<br>const char * inputFilename = argv[1];<br>const char * outputFilename = argv[2];<br><br>reader->SetFileName( inputFilename );<br>writer->SetFileName( outputFilename );<br><br>writer->SetInput( reader->GetOutput() );
<br><br>aimIOread->CanReadFile(inputFilename);<br><br>reader->SetImageIO( aimIOread );<br>writer->SetImageIO( aimIOwrite );<br><br>try<br> {<br> reader->Update();<br> }<br>catch( itk::ExceptionObject & err )
<br> {<br> std::cerr << "ExceptionObject caught !" << std::endl;<br> std::cerr << err << std::endl;<br> return EXIT_FAILURE;<br> }<br><br>aimIOwrite->SetProcessingLog( aimIOread->GetProcessingLog() );
<br><br>try<br> {<br> writer->Update();<br> }<br>catch( itk::ExceptionObject & err )<br> {<br> std::cerr << "ExceptionObject caught !" << std::endl;<br> std::cerr << err << std::endl;
<br> return EXIT_FAILURE;<br> }<br><br>return EXIT_SUCCESS;<br>}<br>_______________________________________________<br>Insight-users mailing list<br><a href="mailto:Insight-users@itk.org">Insight-users@itk.org</a><br>
<a href="http://www.itk.org/mailman/listinfo/insight-users">http://www.itk.org/mailman/listinfo/insight-users</a><br></blockquote></div><br>