0
votes

I am working a project that uses the Discrete Gaussian Image Filter within ITK. I am using CMake to automate the build process but it seems that CMake is leaving out certain ITK libraries during the configuration/generate step. I am currently using other headers in the ITK library without any issue. There are no configuration error messages in CMake for the project.

The CMakeLists.txt for my project:

#PROJECT(REGISTRATION)
#
# List of source files
CMAKE_MINIMUM_REQUIRED(VERSION 2.8)

# Top of file: the name of the program
PROJECT(MultiObjModelToUSReg)
INCLUDE_REGULAR_EXPRESSION("^.*$")

FIND_PACKAGE( ITK REQUIRED)
IF( ITK_FOUND )
    INCLUDE( ${USE_ITK_FILE} )
ENDIF( ITK_FOUND )


# Directories to search for #include (add more if needed) 
# (ITK is already included through the use of INCLUDE(${ITK_USE_FILE})
INCLUDE_DIRECTORIES(
   ${CMAKE_CURRENT_SOURCE_DIR}
   src
)

# Name of the executable
#SET(MultiObjModelToUSReg MultiObjModelToUSReg_EXE) 

# All source files (only .cxx, not .h or .txx)
SET(MultiObjModelToUSReg_SRCS 
    src/Utilities.cpp 
    src/MultiObjModel.cpp
    src/USVolume.cpp
    src/Registration.cpp
    src/BoneProbabilityMap.cpp
    #src/MultiObjModelToUSRegistration.cpp
    #src/USRegistrationDialog.cpp   
    #src/MainPanel.cpp
    #src/ModelRegistration.cxx
)

#only .h files that use QT_ macros!
#SET(MultiObjModelToUSReg_HEADERS 
    #src/USRegistrationDialog.h 
    #src/MainPanel.h
    #src/ModelRegistration.h)

#SET(MultiObjModelToUSReg_FORMS 
    ##ui/USRegistrationDialog.ui 
    ##ui/MainPanel.ui
    #ui/ModelRegistration.ui)

#SET(MultiObjModelToUSReg_RESOURCES)


# These two lines will compile and link your executable
#ADD_EXECUTABLE(MultiObjModelToUSReg
    #${MultiObjModelToUSReg_EXE} 
    #${MultiObjModelToUSReg_SRCS}
    #${MultiObjModelToUSReg_HEADERS_MOC} 
        #${MultiObjModelToUSReg_FORMS_HEADERS} 
        #${MultiObjModelToUSReg_RESOURCES_RCC}
        #)



ADD_LIBRARY(MultiObjModelToUSReg STATIC ${MultiObjModelToUSReg_SRCS})
TARGET_LINK_LIBRARIES(MultiObjModelToUSReg ${ITK_LIBRARIES} )
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR})

ENABLE_TESTING()

INCLUDE(CTEST)
IF (BUILD_TESTING)
    ADD_SUBDIRECTORY (Test)
ENDIF (BUILD_TESTING)

CMake's error-free output:

Check for working C compiler using: Visual Studio 9 2008
Check for working C compiler using: Visual Studio 9 2008 -- works
Detecting C compiler ABI info
Detecting C compiler ABI info - done
Check for working CXX compiler using: Visual Studio 9 2008
Check for working CXX compiler using: Visual Studio 9 2008 -- works
Detecting CXX compiler ABI info
Detecting CXX compiler ABI info - done
Configuring done
Generating done

However, when I compile in Visual C++ 2008:

1>------ Build started: Project: MultiObjModelToUSReg, Configuration: Debug Win32 ------
1>Compiling...
1>BoneProbabilityMap.cpp
1>..\src\BoneProbabilityMap.cpp(8) : fatal error C1083: Cannot open include file: 'itkDiscreteGaussianImageFilter.h': No such file or directory
1>Build log was saved at "file://c:\MultiObjModelToUSReg\bin\MultiObjModelToUSReg.dir\Debug\BuildLog.htm"
1>MultiObjModelToUSReg - 1 error(s), 0 warning(s)
2>------ Skipped Build: Project: ALL_BUILD, Configuration: Debug Win32 ------
2>Project not selected to build for this solution configuration 
========== Build: 0 succeeded, 1 failed, 12 up-to-date, 1 skipped ==========

While there is a workaround to manually it into the project's configuration, I will need to collaborate with others so it would be ideal to have the build process automated.

Any help would be greatly appreciated! (I am quite new to Stackoverflow, please let me know if I made anything unclear).

1
Did you solve your previous problem here stackoverflow.com/q/16429640/2065121 ? - Roger Rowland
@RogerRowland No, I was not able to solve it. I think this problem is more at the core of what was not working. - poliu2s
Did you build ITK with ITK_BUILD_ALL_MODULES=ON? - David Doria
@DavidDoria Thanks! My hard drive didn't have the space so I had to omit it the first time around. I went back and check all the modules (ie. filtering) I needed and it has worked for me so far. Thanks again for the suggestion! - poliu2s
Great. Please accept the answer below so the question no longer shows up as having no answer. - David Doria

1 Answers

1
votes

You need to build ITK with ITK_BUILD_ALL_MODULES=ON.