[Insight-users] How can i complie RegionGrowingSegmentation outside InsightApplications?

=?GB2312?B?wfXQy5VO?= lxssxl at gmail.com
Thu Mar 15 23:30:40 EST 2007


Dear Luis and all ITK users,

      I want to RegionGrowingSegmentation outside InsightApplications.(makes
it has its own *.dsw)  So I moved the RegionGrowingSegmentation directory to
the E:\ root and just added two macros(ITK_DISABLE_FLTK_GENERATED_WARNINGS
and ADD_GUI_EXECUTABLE) to the original CMakeList.txt.

      Here is my CMakeList.txt:

PROJECT( RegionGrowingSegmentation )

# The fluid-generated fltk sources have many warnings.  This macro
# will disable warnings for the generated files on some compilers.
MACRO(ITK_DISABLE_FLTK_GENERATED_WARNINGS files)
  IF(CMAKE_COMPILER_IS_GNUCXX)
    FOREACH(f ${files})
      STRING(REGEX REPLACE "\\.fl$" ".cxx" SRC "${f}")
      STRING(REGEX REPLACE ".*/([^/]*)$" "\\1" SRC "${SRC}")
      SET_SOURCE_FILES_PROPERTIES(${SRC} PROPERTIES COMPILE_FLAGS -w)
    ENDFOREACH(f)
  ENDIF(CMAKE_COMPILER_IS_GNUCXX)
ENDMACRO(ITK_DISABLE_FLTK_GENERATED_WARNINGS)

# Macro for adding resources to GUI application on the Mac
#
IF(APPLE AND NOT FLTK_USE_X)
    FIND_PROGRAM(ITK_APPLE_RESOURCE Rez /Developer/Tools)
    FIND_FILE(ITK_FLTK_RESOURCE mac.r /usr/local/include/FL)
    IF(NOT ITK_FLTK_RESOURCE)
      MESSAGE("Fltk resources not found, GUI application will not respond to
mouse events")
    ENDIF(NOT ITK_FLTK_RESOURCE)

    MACRO(ADD_GUI_EXECUTABLE name sources)
      ADD_EXECUTABLE(${name} ${sources})
      INSTALL_TARGETS(/bin ${name})
      SET(EXEC_PATH ${EXECUTABLE_OUTPUT_PATH})
      IF(NOT EXEC_PATH)
        SET(EXEC_PATH ${CMAKE_CURRENT_BINARY_DIR})
      ENDIF(NOT EXEC_PATH)
        IF(ITK_APPLE_RESOURCE)
          ADD_CUSTOM_COMMAND(SOURCE ${name}
                             COMMAND ${ITK_APPLE_RESOURCE}
                             ARGS -t APPL ${ITK_FLTK_RESOURCE} -o
                             ${EXEC_PATH}/${name}
                             TARGET ${name})
        ENDIF(ITK_APPLE_RESOURCE)
    ENDMACRO(ADD_GUI_EXECUTABLE)
ELSE(APPLE AND NOT FLTK_USE_X)
  MACRO(ADD_GUI_EXECUTABLE name sources)
    ADD_EXECUTABLE(${name} ${sources})
    INSTALL_TARGETS(/bin ${name})
  ENDMACRO(ADD_GUI_EXECUTABLE)
ENDIF(APPLE AND NOT FLTK_USE_X)

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

  FIND_PACKAGE(FLTK)
  IF(FLTK_FOUND)
    INCLUDE_DIRECTORIES(${FLTK_INCLUDE_DIR})
  ENDIF(FLTK_FOUND)

  FIND_PACKAGE(VTK)
  IF (VTK_FOUND)
      INCLUDE (${VTK_USE_FILE})
  ENDIF (VTK_FOUND)



INCLUDE_DIRECTORIES(
${InsightApplications_SOURCE_DIR}/Auxiliary/FltkImageViewer
${InsightApplications_SOURCE_DIR}/Auxiliary/VtkFltk
${InsightApplications_SOURCE_DIR}/Auxiliary/vtk
${InsightApplications_BINARY_DIR}/Auxiliary/FltkImageViewer
${InsightApplications_BINARY_DIR}/Auxiliary/VtkFltk
${RegionGrowingSegmentation_SOURCE_DIR}
${RegionGrowingSegmentation_BINARY_DIR}
)


FLTK_WRAP_UI( RegionGrowingSegmentation   RegionGrowingSegmentationGUI.fl)
FLTK_WRAP_UI( RegionGrowingSegmentation2D RegionGrowingSegmentation2DGUI.fl)


ITK_DISABLE_FLTK_GENERATED_WARNINGS(RegionGrowingSegmentationGUI.fl)
ITK_DISABLE_FLTK_GENERATED_WARNINGS(RegionGrowingSegmentation2DGUI.fl)


SET(RegionGrowingSegmentation2D_SRCS
RegionGrowingSegmentationBase2D.cxx
RegionGrowingSegmentation2D.cxx
${RegionGrowingSegmentation2D_FLTK_UI_SRCS}
)


SET(RegionGrowingSegmentation_SRCS
RegionGrowingSegmentationBase.cxx
RegionGrowingSegmentation.cxx
${RegionGrowingSegmentation_FLTK_UI_SRCS}
)


LINK_LIBRARIES (
ITKCommon
ITKNumerics
ITKBasicFilters
ITKIO
ITKFltkImageViewer
ITKVtkFltk
vtkRendering
vtkGraphics
vtkHybrid
vtkImaging
vtkIO
vtkFiltering
vtkCommon
)


ADD_GUI_EXECUTABLE(RegionGrowingSegmentation2D
"${RegionGrowingSegmentation2D_SRCS}")
ADD_GUI_EXECUTABLE(RegionGrowingSegmentation
"${RegionGrowingSegmentation_SRCS}")


Looks like it works. After running cMake, I got a
RegionGrowingSegmentation.dsw and received no errors. But when I built the
RegionGrowingSegmentation.dsw in VC++ 6.0, it reported that some files(
fltkImageViewer.h etc.) were missing. I found these files in Insight ToolKit
or InsightApp directory and added them to the local directory one by one. At
last it stop asking for files.And some new errors occoured.
--------------------Configuration: RegionGrowingSegmentation - Win32
Debug--------------------
Compiling...
RegionGrowingSegmentation.cxx
E:\RegionGrowingSegmentation_Bin\fltkImageViewer.txx(444) : error C2512:
'ClickPoint' : no appropriate default constructor available
        C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\xmemory(66) :
while compiling class-template member function 'void __thiscall
fltk::ImageViewer<float,unsigned char>::UpdateClickedPoints(void)'
E:\RegionGrowingSegmentation_Bin\fltkImageViewer.txx(445) : error C2660:
'getClickedPoint' : function does not take 2 parameters
        C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\xmemory(66) :
while compiling class-template member function 'void __thiscall
fltk::ImageViewer<float,unsigned char>::UpdateClickedPoints(void)'
E:\RegionGrowingSegmentation_Bin\fltkImageViewer.txx(444) : error C2512:
'ClickPoint' : no appropriate default constructor available
        C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\xmemory(66) :
while compiling class-template member function 'void __thiscall
fltk::ImageViewer<short,unsigned char>::UpdateClickedPoints(void)'
E:\RegionGrowingSegmentation_Bin\fltkImageViewer.txx(445) : error C2660:
'getClickedPoint' : function does not take 2 parameters
        C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\xmemory(66) :
while compiling class-template member function 'void __thiscall
fltk::ImageViewer<short,unsigned char>::UpdateClickedPoints(void)'
Error executing cl.exe.

ALL_BUILD - 4 error(s), 0 warning(s)

I am a novice. Can you tell me how to fix it?
Or what I have done is totally wrong.I can do it in another way?

Thank you very much in advance!


Regards,
Xing-Sheng Liu
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://public.kitware.com/pipermail/insight-users/attachments/20070316/33d6d50a/attachment.html


More information about the Insight-users mailing list