[Insight-users] Problem compiling with ITK 3.16.0 in Linux

Alfonso Castro Martinez alfonso.castro at udc.es
Tue Oct 20 05:31:57 EDT 2009


The code that uses itk:PasteImageFilter:

PasteFilterType::Pointer paster = PasteFilterType::New();

WriterType::Pointer writerPaste  = WriterType::New();

PasteFilterType::InputImageIndexType destIndex;

ImageIOType::Pointer gdcmImageIOPaste2 = ImageIOType::New();

PasteFilterType::Pointer paster2 = PasteFilterType::New();

WriterType::Pointer writerPaste2  = WriterType::New();

PasteFilterType::InputImageIndexType destIndex2;

PasteFilterType::Pointer getPaste(int indX, int indY){
   paster->SetDestinationImage(readerDEST->GetOutput());
   paster->SetSourceImage(readerSRC->GetOutput());


   destIndex[0] = indX;
   destIndex[1] = indY;
   paster->SetDestinationIndex( destIndex );

   paster->SetSourceRegion( readerSRC->GetOutput()-
>GetLargestPossibleRegion());

   try
   {
       paster->Update();
   }
   catch( itk::ExceptionObject & excp )
   {
       std::cerr << "Exception thrown while pasting the Images" << std::endl;
       std::cerr << excp << std::endl;
   }
   return(paster);
}


void PasteImages(char *imGrande, char *imPeque, int indx, int indy, char 
*name){
readerSRC=readSRC(imPeque);
readerDEST=readDEST(imGrande);
paster=getPaste(indx,indy);
writerPaste=writePaste(paster,name);
}

The entire Paste.h:

#include "itkImage.h"
#include "itkImageFileReader.h"
#include "itkImageFileWriter.h"
#include "itkGDCMImageIO.h"
#include "itkPasteImageFilter.h"

void PasteImages(char *imGrande, char *imPeque, int indx, int indy, char 
*name);
void PasteImages2(char *imGrande2, char *imPeque2, int indx2, int indy2, char 
*name2);

The entire itkPasteImageFilter.h in the source directory of the application:

 #ifndef __itkPasteImageFilter_h
 #define __itkPasteImageFilter_h
 
 #include "itkInPlaceImageFilter.h"
 #include "itkSmartPointer.h"
 
 namespace itk
 {
 
 template <class TInputImage, class TSourceImage=TInputImage, class 
TOutputImage=TInputImage>
 class ITK_EXPORT PasteImageFilter:
     public InPlaceImageFilter<TInputImage,TOutputImage>
 {
 public:
   typedef PasteImageFilter                              Self;
   typedef InPlaceImageFilter<TInputImage,TOutputImage>  Superclass;
   typedef SmartPointer<Self>                            Pointer;
   typedef SmartPointer<const Self>                      ConstPointer;
 
  itkNewMacro(Self);  

   itkTypeMacro(PasteImageFilter, InPlaceImageFilter);
 
   typedef typename Superclass::InputImagePointer  InputImagePointer;
   typedef typename Superclass::OutputImagePointer OutputImagePointer;
   typedef typename TSourceImage::Pointer      SourceImagePointer;
   typedef typename TSourceImage::ConstPointer SourceImageConstPointer;
   typedef typename TOutputImage::RegionType OutputImageRegionType;
   typedef typename TInputImage::RegionType  InputImageRegionType;
   typedef typename TSourceImage::RegionType SourceImageRegionType;
   typedef typename TOutputImage::PixelType OutputImagePixelType;
   typedef typename TInputImage::PixelType  InputImagePixelType;
   typedef typename TSourceImage::PixelType SourceImagePixelType;
   typedef typename TOutputImage::IndexType OutputImageIndexType;
   typedef typename TOutputImage::SizeType  OutputImageSizeType;
   typedef typename TInputImage::IndexType  InputImageIndexType;
   typedef typename TInputImage::SizeType   InputImageSizeType;
   typedef typename TSourceImage::IndexType SourceImageIndexType;
   typedef typename TSourceImage::SizeType  SourceImageSizeType;
   itkStaticConstMacro(InputImageDimension, unsigned int,
                      TInputImage::ImageDimension);
  itkStaticConstMacro(OutputImageDimension, unsigned int,
                       TOutputImage::ImageDimension);
   itkStaticConstMacro(SourceImageDimension, unsigned int,
                      TSourceImage::ImageDimension);
   itkSetMacro(DestinationIndex, InputImageIndexType);
   itkGetMacro(DestinationIndex, InputImageIndexType);

  itkSetMacro(SourceRegion, SourceImageRegionType);
  itkGetMacro(SourceRegion, SourceImageRegionType);
   void SetDestinationImage(TInputImage *dest) { this->SetNthInput(0, dest); }
   const TInputImage* GetDestinationImage() { return this->GetInput(0); }
   void SetSourceImage(TSourceImage *src) { this->SetNthInput(1, src); }
   const TSourceImage* GetSourceImage() { return this->GetInput(1); }
  virtual void GenerateInputRequestedRegion();
 
 protected:
   PasteImageFilter();
   ~PasteImageFilter() {};
  void PrintSelf(std::ostream& os, Indent indent) const;
  void ThreadedGenerateData(const OutputImageRegionType& 
outputRegionForThread,
                             int threadId );
   SourceImageRegionType m_SourceRegion;
   InputImageIndexType   m_DestinationIndex;
 private:
   PasteImageFilter(const Self&); //purposely not implemented
  void operator=(const Self&); //purposely not implemented
 };
  
 } // end namespace itk
 #ifndef ITK_MANUAL_INSTANTIATION
 #include "itkPasteImageFilter.txx"
 #endif
   
 #endif


Thanks in advance.

Alfonso Castro Martinez
Dept. of Information and Communication Technologies
University of A Coruna
Spain

O Luns 19 Outubro 2009 15:05:12 Bill Lorensen escribiu:
> Can you show the statement in your code that uses the
>  itk::PasteImageFilter?
> 
> Bill
> 
> 2009/10/19 Alfonso Castro Martinez <alfonsocastro at udc.es>:
> > Thanks for your reply.
> >
> > We are using the class to join a TAC separated in two images: left lobe
> > and right lobe.
> >
> > The error is in a include file: Paste.h in our source:
> >
> > #include "itkImage.h"
> > #include "itkImageFileReader.h"
> > #include "itkImageFileWriter.h"
> > #include "itkGDCMImageIO.h"
> > #include "itkPasteImageFilter.h"
> >
> > void PasteImages(char *imGrande, char *imPeque, int indx, int indy, char
> > *name);
> > void PasteImages2(char *imGrande2, char *imPeque2, int indx2, int indy2,
> > char *name2);
> >
> > From there the message error comes from itkPasteImageFilter.txx in the
> > source directory of ITK in line 46, the  code in this position:
> >
> > template <class TInputImage, class TSourceImage, class TOutputImage>
> > void
> > PasteImageFilter<TInputImage,TSourceImage,TOutputImage>
> >
> > ::SetSourceImage(const SourceImageType *src)
> >
> > {
> >  // Process object is not const-correct so the const casting is required.
> >  this->SetNthInput(1, const_cast<SourceImageType *>( src ));
> > }
> >
> >
> > Thanks in advance.
> >
> > Alfonso Castro Martinez
> > Dept. of Information and Communication Technologies
> > University of A Coruna
> > Spain
> >
> > O Venres 16 Outubro 2009 05:55:09 escribiches:
> >> Luis,
> >>
> >> Perhaps the const correctness changes you made to itkPasteImageFilter
> >> are not bacward compatible?
> >>
> >> Alfonso,
> >>
> >> How are you using this class? Our intent is to not break backward
> >>  compatibility.
> >>
> >> Bill
> >>
> >> 2009/10/14 Alfonso Castro Martinez <alfonsocastro at udc.es>:
> >> > Hi.
> >> >
> >> > I have a program to preprocess lung TACs made with ITK. I don't have
> >> > problems compiling this program in OpenSuSE 11.1 x86_64 with ITK
> >> > 3.12.0 but when I compile it with ITK 3.16.0. I obtain the next error:
> >> >
> >> > /toolkits/InsightToolkit-3.16.0/Code/BasicFilters/itkPasteImageFilter.
> >> >txx
> >> >
> >> >:46: error: expected ‘,’ or ‘...’ before ‘*’ token
> >> >
> >> > /toolkits/InsightToolkit-3.16.0/Code/BasicFilters/itkPasteImageFilter.
> >> >txx
> >> >
> >> >:46: error: ISO C++ forbids declaration of ‘SourceImageType’ with no
> >> >: type
> >> >
> >> > /toolkits/InsightToolkit-3.16.0/Code/BasicFilters/itkPasteImageFilter.
> >> >txx
> >> >
> >> >:46: error: prototype for ‘void itk::PasteImageFilter<TInputImage,
> >> >
> >> > TSourceImage, TOutputImage>::SetSourceImage(int)’ does not match any
> >> > in class
> >> > ‘itk::PasteImageFilter<TInputImage, TSourceImage, TOutputImage>’
> >> > /mia/itk/preprocesado tac pulmon/Codigo/src/itkPasteImageFilter.h:53:
> >> > error: candidate is: void itk::PasteImageFilter<TInputImage,
> >> > TSourceImage, TOutputImage>::SetSourceImage(TSourceImage*)
> >> > /toolkits/InsightToolkit-3.16.0/Code/BasicFilters/itkPasteImageFilter.
> >> >txx
> >> >
> >> >:55: error: prototype for ‘const typename
> >> >
> >> > itk::PasteImageFilter<TInputImage, TSourceImage,
> >> > TOutputImage>::SourceImageType*
> >> > itk::PasteImageFilter<TInputImage, TSourceImage,
> >> > TOutputImage>::GetSourceImage() const’ does not match any in class
> >> > ‘itk::PasteImageFilter<TInputImage, TSourceImage, TOutputImage>’
> >> > /mia/itk/preprocesado tac pulmon/Codigo/src/itkPasteImageFilter.h:54:
> >> > error: candidate is: const TSourceImage*
> >> > itk::PasteImageFilter<TInputImage, TSourceImage,
> >> > TOutputImage>::GetSourceImage()
> >> > /toolkits/InsightToolkit-3.16.0/Code/BasicFilters/itkPasteImageFilter.
> >> >txx
> >> >
> >> >:65: error: expected ‘,’ or ‘...’ before ‘*’ token
> >> >
> >> > /toolkits/InsightToolkit-3.16.0/Code/BasicFilters/itkPasteImageFilter.
> >> >txx
> >> >
> >> >:65: error: ISO C++ forbids declaration of ‘InputImageType’ with no
> >> >: type
> >> >
> >> > /toolkits/InsightToolkit-3.16.0/Code/BasicFilters/itkPasteImageFilter.
> >> >txx
> >> >
> >> >:65: error: prototype for ‘void itk::PasteImageFilter<TInputImage,
> >> >
> >> > TSourceImage, TOutputImage>::SetDestinationImage(int)’ does not match
> >> > any in class ‘itk::PasteImageFilter<TInputImage, TSourceImage,
> >> > TOutputImage>’ /mia/itk/preprocesado tac
> >> > pulmon/Codigo/src/itkPasteImageFilter.h:51: error: candidate is: void
> >> > itk::PasteImageFilter<TInputImage,
> >> > TSourceImage, TOutputImage>::SetDestinationImage(TInputImage*)
> >> > /toolkits/InsightToolkit-3.16.0/Code/BasicFilters/itkPasteImageFilter.
> >> >txx
> >> >
> >> >:74: error: prototype for ‘const typename
> >> >
> >> > itk::PasteImageFilter<TInputImage, TSourceImage,
> >> > TOutputImage>::InputImageType*
> >> > itk::PasteImageFilter<TInputImage, TSourceImage,
> >> > TOutputImage>::GetDestinationImage() const’ does not match any in
> >> > class ‘itk::PasteImageFilter<TInputImage, TSourceImage, TOutputImage>’
> >> >
> >> > Can some help me, please?
> >> >
> >> > Thanks in advance.
> >> >
> >> > Alfonso Castro Martinez
> >> > Dept. of Information and Communication Technologies
> >> > University of A Coruna
> >> > Spain
> >> > _____________________________________
> >> > Powered by www.kitware.com
> >> >
> >> > Visit other Kitware open-source projects at
> >> > http://www.kitware.com/opensource/opensource.html
> >> >
> >> > Please keep messages on-topic and check the ITK FAQ at:
> >> > http://www.itk.org/Wiki/ITK_FAQ
> >> >
> >> > Follow this link to subscribe/unsubscribe:
> >> > http://www.itk.org/mailman/listinfo/insight-users
> 


More information about the Insight-users mailing list