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

Luis Ibanez luis.ibanez at kitware.com
Thu Sep 14 10:42:19 EDT 2006


Hi Jörg,


     Very interesting....


1) What compiler do you use ?
2) Did you make sure to set up your CC and CXX environment variables ?


One option is that the file:

               itkImageToImageFilterDetail.h

may be corrupted in your disk,
because line 25 actually should have only a newline character.

Could you open that file in a binary editor such as khexedit, or dump it
with "hexdump -C", and check whether the content of line 25 is a
character "0a" or not.


Please let us know what you find.


     Thanks


        Luis



---------------------------
Jörg P.Pfannmöller wrote:
> 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




More information about the Insight-users mailing list