[Insight-users] Erode example does not compile although it was not changed.

"Jörg P.Pfannmöller" J.Pfannmoeller at gmx.de
Thu Sep 7 07:37:17 EDT 2006


Hello,

I want to apply the grayscale erosion filter to an image. To start I tried to compile the example contained in the ITK Software guide. Therefore I copied the file MathematicalMorphologyGrayscaleFilters.cxx in a seperate folder away from the ITK source code tree. Then I created the following CMakeLists.txt:

# This project is designed to be built outside the Insight source tree.
PROJECT (MathematicalMorphologyGrayscaleFilters)

# Find ITK.
FIND_PACKAGE(ITK)
IF(ITK_FOUND)
  INCLUDE(${ITK_USE_FILE})
ELSE(ITK_FOUND)
  MESSAGE(FATAL_ERROR
          "Cannot build without ITK.  Please set ITK_DIR.")
ENDIF(ITK_FOUND)

ADD_EXECUTABLE(MathematicalMorphologyGrayscaleFilters MathematicalMorphologyGrayscaleFilters.cxx )
TARGET_LINK_LIBRARIES(MathematicalMorphologyGrayscaleFilters ITKCommon ITKIO)

After that I created a make file with the help of cmake. I performed a out-of-source build as recommended. Then I compiled everything. Unfortunately I received some error messages that I can´t correct. A typical error is given by the following. Error Message:

[100%] Building CXX object CMakeFiles/MathematicalMorphologyGrayscaleFilters.dir/MathematicalMorphologyGrayscaleFilters.o
In file included from /home/pfannmoe/Sourcen/workdir/dki-gf-detect/Insight/src/ITK/Code/Common/itkImageToImageFilter.h:26,
                 from /home/pfannmoe/Sourcen/workdir/dki-gf-detect/Insight/src/ITK/Code/BasicFilters/itkMorphologyImageFilter.h:20,
                 from /home/pfannmoe/Sourcen/workdir/dki-gf-detect/Insight/src/ITK/Code/BasicFilters/itkGrayscaleErodeImageFilter.h:20,
                 from /home/pfannmoe/Sourcen/workdir/dki-gf-detect/Insight/joerg-src/Grayscale_Filters/MathematicalMorphologyGrayscaleFilters.cxx:53:
/home/pfannmoe/Sourcen/workdir/dki-gf-detect/Insight/src/ITK/Code/Common/itkImageToImageFilterDetail.h:25: error: syntax
   error before `namespace'

The file where the error is supposed to appear looks around line 25 as follows:

#ifndef __itkImageToImageFilterDetail_h
#define __itkImageToImageFilterDetail_h

#include "itkImageRegion.h"
#include "itkSmartPointer.h"
namespace itk //line 25
{

Does somebody know where the mistake comes from? For me the syntax in that file is alright. I have compiled other examples and they all worked. ITK-Snap also works fine.

So long pfannmoe
-- 
**********************************************************
Jörg P.Pfannmöller                                
In der Köhlertanne 56
64295 Darmstadt  

Telnr.:+491714615381                          
Homepage: www.pfannmoeller.de.vu                      
GnuPG KeyID: B7CA2E9F
**********************************************************

Der GMX SmartSurfer hilft bis zu 70% Ihrer Onlinekosten zu sparen!
Ideal für Modem und ISDN: http://www.gmx.net/de/go/smartsurfer


More information about the Insight-users mailing list