[Insight-developers] [Insight-users] Fast Marching Minimal Path Extraction error

Luis Ibanez luis.ibanez at kitware.com
Mon Jul 14 10:18:26 EDT 2008


Hi Dan,


The standard practice for including vnl_math.h is to do


               #include "vnl/vnl_math.h"


You will find several examples of this use in Insight/Code/Common.



In general, ITK_SOURCE_DIR shouldn't be used because it will not
exist in an installed ITK.


    Regards,


       Luis


------------------
Dan Mueller wrote:
> Hi Luis,
> 
> Thanks for your response.
> 
> I am using ITK_SOURCE_DIR to construct a path to
> {SOURCE}\Utilities\vxl\core\vnl so that "#include vnl_math.h" works.
> 
> What is the recommended way to add this directory to the include path
> of a CMake generated project?
> 
> Regards, Dan
> 
> 2008/7/13 Luis Ibanez <luis.ibanez at kitware.com>:
> 
>>Hi Dan,
>>
>>The use of ITK_SOURCE_DIR is discouraged because when you install ITK
>>the actual source code may no longer be available.
>>
>>The ITK_SOURCE_DIR may make sense when you are building your application
>>against a local build of ITK.
>>
>>If, on the other hand, you build against an installed ITK then only the
>>header files and the compiled libraries will be available.
>>
>>If you are using a Debian installed ITK (or for that matter any Linux or
>>Windows installation), then the ITK_SOURCE_DIR should not be available.
>>
>>BTW: Why is that you need "ITK_SOURCE_DIR" ?
>>
>>
>>
>>It seems that the problem is that
>>
>>
>>                FIND_PACKAGE(ITK REQUIRED)
>>
>>
>>is not being used in this CMakeLists.txt file.
>>
>>
>> Please let us know,
>>
>>
>>     Luis
>>
>>
>>
>>----------------
>>Dan Mueller wrote:
>>
>>>Hi Alex,
>>>
>>>The problem is definitely in step 3. The VXL_INCLUDE_DIRS should have
>>>the full path (with non-empty ITK_SOURCE_DIR). It seems ITK_SOURCE_DIR
>>>is not being set...
>>>
>>>Insight Developers: do you know of any reason why ITK_SOURCE_DIR is
>>>not being set using the below CMakeLists.txt on Linux(Debian)? (It
>>>seems to work on Windows, cygwin, and the IJ Testing Environment...)
>>>
>>>Thanks for any insight.
>>>
>>>Regards, Dan
>>>
>>>#Set the project
>>>CMAKE_MINIMUM_REQUIRED(VERSION 2.4)
>>>PROJECT(MinimalPath)
>>>
>>>#Include some macros from another file...
>>>INCLUDE(${CMAKE_SOURCE_DIR}/IJMacros.txt)
>>>
>>>#Setup required paths
>>>SET(DATA_PATH ${CMAKE_SOURCE_DIR}/Data)
>>>SET(SOURCE_PATH ${CMAKE_SOURCE_DIR}/Source)
>>>SET(TESTING_PATH ${CMAKE_SOURCE_DIR}/Testing)
>>>
>>>SET(LIBRARY_OUTPUT_PATH ${CMAKE_BINARY_DIR}/bin CACHE PATH "Single
>>>output directory for building all libraries." FORCE)
>>>SET(EXECUTABLE_OUTPUT_PATH ${CMAKE_BINARY_DIR}/bin CACHE PATH "Single
>>>output directory for building all executables." FORCE)
>>>
>>>#The following lines are required to use Dart
>>>ENABLE_TESTING()
>>>INCLUDE(Dart)
>>>FIND_PROGRAM(IMAGE_COMPARE ImageCompare)
>>>
>>>#Declare any external dependencies that your project may have here.
>>>#examples include: ITK, VTK, JPEG, PNG, OpenGL, ZLIB, Perl, Java
>>>#If you're not sure what name to use, look in the Modules directory of
>>>your
>>>#cmake install and check that a file named Find(Package).cmake exists
>>>SET(Required_Packages
>>>   ITK
>>>)
>>>
>>>#this foreach loads all of the packages that you specified as required.
>>>#It shouldn't need to be modified.
>>>FOREACH(Package ${Required_Packages})
>>> LOADPACKAGE(${Package})
>>>ENDFOREACH(Package)
>>>
>>>#Construct VXL/VNL includes
>>>SET(VXL_INCLUDE_DIRS
>>>   ${ITK_SOURCE_DIR}/Utilities/vxl
>>>   ${ITK_SOURCE_DIR}/Utilities/vxl/core
>>>   ${ITK_SOURCE_DIR}/Utilities/vxl/core/vnl
>>>   ${ITK_SOURCE_DIR}/Utilities/vxl/vcl)
>>>
>>>
>>>2008/7/11 Oleksandr Dzyubak <adzyubak at gmail.com>:
>>>
>>>
>>>>Hi Daniel,
>>>>
>>>>Thanks for quick response.
>>>>
>>>>1) Yes. My ITK_DIR is  /usr/local/lib/InsightToolkit
>>>>
>>>>2) Yes.
>>>>dzyubak at debian: /vnl$ pwd
>>>>/usr/local/include/InsightToolkit/Utilities/vxl/core/vnl
>>>>
>>>>dzyubak at debian: /vnl$ ls | grep vnl_math
>>>>vnl_math.h
>>>>
>>>>3) After adding a line as you advised
>>>>MESSAGE(SEND_ERROR ${VXL_INCLUDE_DIRS}) # Add this line (it is now
>>>>located
>>>>on the line 41),
>>>>I got an error message below.
>>>>
>>>>CMake Error at CMakeLists.txt:41 (MESSAGE):
>>>>
>>>>/Utilities/vxl/Utilities/vxl/core/Utilities/vxl/core/vnl/Utilities/vxl/vcl
>>>>
>>>>4) The content of the flags.make file is below.
>>>>
>>>>*********Begin flags.make ********
>>>># CMAKE generated file: DO NOT EDIT!
>>>># Generated by "Unix Makefiles" Generator, CMake Version 2.6
>>>>
>>>># compile CXX with /usr/bin/c++
>>>>CXX_FLAGS =   -ftemplate-depth-50 -Wall
>>>>-I/usr/local/include/InsightToolkit/Review
>>>>-I/usr/local/include/InsightToolkit/Patented
>>>>-I/usr/local/include/InsightToolkit/gdcm/src
>>>>-I/usr/local/include/InsightToolkit/gdcm
>>>>-I/usr/local/include/InsightToolkit/Utilities/vxl/core
>>>>-I/usr/local/include/InsightToolkit/Utilities/vxl/vcl
>>>>-I/usr/local/include/InsightToolkit/Utilities/vxl/v3p/netlib
>>>>-I/usr/local/include/InsightToolkit/Utilities
>>>>-I/usr/local/include/InsightToolkit/Utilities/itkExtHdrs
>>>>-I/usr/local/include/InsightToolkit/Utilities/nifti/znzlib
>>>>-I/usr/local/include/InsightToolkit/Utilities/nifti/niftilib
>>>>-I/usr/local/include/InsightToolkit/Utilities/expat
>>>>-I/usr/local/include/InsightToolkit/Utilities/DICOMParser
>>>>-I/usr/local/include/InsightToolkit/Utilities/NrrdIO
>>>>-I/usr/local/include/InsightToolkit/Utilities/MetaIO
>>>>-I/usr/local/include/InsightToolkit/SpatialObject
>>>>-I/usr/local/include/InsightToolkit/Numerics/NeuralNetworks
>>>>-I/usr/local/include/InsightToolkit/Numerics/Statistics
>>>>-I/usr/local/include/InsightToolkit/Numerics/FEM
>>>>-I/usr/local/include/InsightToolkit/IO
>>>>-I/usr/local/include/InsightToolkit/Numerics
>>>>-I/usr/local/include/InsightToolkit/Common
>>>>-I/usr/local/include/InsightToolkit/BasicFilters
>>>>-I/usr/local/include/InsightToolkit/Algorithms
>>>>-I/usr/local/include/InsightToolkit
>>>>-I/mnt/Public/ITK_Test/Fast_Marching_Minimal_Path_Extraction_in_ITK
>>>>
>>>>-I/mnt/Public/ITK_Test/Fast_Marching_Minimal_Path_Extraction_in_ITK/Source
>>>>-I/Utilities/vxl -I/Utilities/vxl/core -I/Utilities/vxl/core/vnl
>>>>-I/Utilities/vxl/vcl
>>>>CXX_DEFINES =
>>>>
>>>>*********Begin flags.make ********
>>>>
>>>>
>>>>Thanks for your help,
>>>>
>>>>Alex
>>>>
>>>>Dan Mueller wrote:
>>>>
>>>>
>>>>>Hi Alex,
>>>>>
>>>>>Sorry, I meant "itkSingleImageCostFunction.txx".
>>>>>
>>>>>Yes, the main CMakeLists.txt should take care of everything (at least
>>>>>it does on my builds and the IJ).
>>>>>
>>>>>Basically the problem seems to be that "vnl_math.h" is not being
>>>>>included. It should be a simple matter of some detective work to find
>>>>>out where things go wrong.
>>>>>
>>>>>Can you please check a couple of things:
>>>>>1. When you configure the project, I assume you are specifying the
>>>>>ITK_DIR variable?
>>>>>2. Do you have the "{ITK_SOURCE_DIR}\Utilities\vxl\core\vnl"
>>>>>directory? Is the "vnl_math.h" file inside?
>>>>>3. Can you please add the following line to the main CMakeLists.txt
>>>>>and let me know the result?
>>>>>#Construct VXL/VNL includes
>>>>>SET(VXL_INCLUDE_DIRS
>>>>> ${ITK_SOURCE_DIR}/Utilities/vxl
>>>>> ${ITK_SOURCE_DIR}/Utilities/vxl/core
>>>>> ${ITK_SOURCE_DIR}/Utilities/vxl/core/vnl
>>>>> ${ITK_SOURCE_DIR}/Utilities/vxl/vcl)
>>>>>MESSAGE(SEND_ERROR ${VXL_INCLUDE_DIRS}) # Add this line
>>>>> 4. Can you please report the include paths generated by CMake? They
>>>>>should include the directories shown above. (On my cygwin system,
>>>>>these go into
>>>>>
>>>>>"{MinimalPath_BUILD_DIR}\Source\CMakeFiles\MinimalPathMain.dir\flags.make")
>>>>>
>>>>>Let me know regarding these things.
>>>>>
>>>>>Cheers, Dan
>>>>>
>>>>>2008/7/10 Oleksandr Dzyubak <adzyubak at gmail.com>:
>>>>>
>>>>>
>>>>>
>>>>>>Hi Daniel,
>>>>>>
>>>>>>Thanks for your prompt reply.
>>>>>>I am using Linux(Debian) or UNIX(FreeBSD). Mostly Linux.
>>>>>>Yes, I am using rev.6. Just downloaded once again to make sure it is.
>>>>>>There no such a file like "itkSingleImageCostFunction.cxx" in the
>>>>>>downloaded
>>>>>>archive.
>>>>>>Did you mean the template file "itkSingleImageCostFunction.txx"?
>>>>>>
>>>>>>Following your advice, I have changed the includes but no magic
>>>>>>happened.
>>>>>>The same error.
>>>>>>
>>>>>>I thought that it is the CMakeLists.txt in concert with cmake which
>>>>>>should
>>>>>>take care of that.
>>>>>>It is not?
>>>>>>
>>>>>>Regards,
>>>>>>
>>>>>>Alex
>>>>>>
>>>>>>Dan Mueller wrote:
>>>>>>
>>>>>>
>>>>>>
>>>>>>>Hi Alex,
>>>>>>>
>>>>>>>Strange. It compiles fine for me on Windows with Visual Studio 8.0 and
>>>>>>>on the IJ Testing Environment (some flavour of Linux, I think)...
>>>>>>>
>>>>>>>Are you using revision 6?
>>>>>>>
>>>>>>>Perhaps try changing this line in itkSingleImageCostFunction.cxx
>>>>>>> #include "vnl_math.h"
>>>>>>>to
>>>>>>> #include "vnl/vnl_math.h"
>>>>>>>
>>>>>>>Let me know if you still have problems.
>>>>>>>
>>>>>>>Regards, Dan
>>>>>>>
>>>>>>>2008/7/10 Oleksandr Dzyubak <adzyubak at gmail.com>:
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>>Dear ITKers,
>>>>>>>>
>>>>>>>>After reading the articles by J. Sethian,
>>>>>>>>I decided to downloaded the Fast Marching Minimal Path Extraction
>>>>>>>>program
>>>>>>>>and give it a try.
>>>>>>>>
>>>>>>>>Surprisingly I could not even compile it.
>>>>>>>>The errors I got are below. Did somebody try it?
>>>>>>>>
>>>>>>>>Just in case. I am using Debian Linux with
>>>>>>>>gcc version 4.1.2 20061115 (prerelease) (Debian 4.1.1-21).
>>>>>>>>
>>>>>>>>Thanks,,
>>>>>>>>Alex
>>>>>>>>
>>>>>>>>*********Begin Errors********
>>>>>>>>
>>>>>>>>dzyubak at debian: /BUILD$ make
>>>>>>>>Scanning dependencies of target MinimalPathMain
>>>>>>>>[ 33%] Building CXX object
>>>>>>>>Source/CMakeFiles/MinimalPathMain.dir/main.o
>>>>>>>>In file included from
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>/mnt/Public/ITK_Test/Fast_Marching_Minimal_Path_Extraction_in_ITK/Source/itkSingleImageCostFunction.h:147,
>>>>>>>>           from
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>/mnt/Public/ITK_Test/Fast_Marching_Minimal_Path_Extraction_in_ITK/Source/itkArrivalFunctionToPathFilter.h:23,
>>>>>>>>           from
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>/mnt/Public/ITK_Test/Fast_Marching_Minimal_Path_Extraction_in_ITK/Testing/MinimalPathTests.cxx:39,
>>>>>>>>           from
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>/mnt/Public/ITK_Test/Fast_Marching_Minimal_Path_Extraction_in_ITK/Source/main.cxx:10:
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>/mnt/Public/ITK_Test/Fast_Marching_Minimal_Path_Extraction_in_ITK/Source/itkSingleImageCostFunction.txx:20:22:
>>>>>>>>error: vnl_math.h: No such file or directory
>>>>>>>>make[2]: *** [Source/CMakeFiles/MinimalPathMain.dir/main.o] Error 1
>>>>>>>>make[1]: *** [Source/CMakeFiles/MinimalPathMain.dir/all] Error 2
>>>>>>>>make: *** [all] Error 2
>>>>>>>>dzyubak at debian: /BUILD$
>>>>>>>>
>>>>>>>>
>>>>>>>>**********End Errors******
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>_______________________________________________
>>>>>>>>Insight-users mailing list
>>>>>>>>Insight-users at itk.org
>>>>>>>>http://www.itk.org/mailman/listinfo/insight-users
>>>>>>>>
>>>>
>>>>
>>>_______________________________________________
>>>Insight-developers mailing list
>>>Insight-developers at itk.org
>>>http://www.itk.org/mailman/listinfo/insight-developers
>>>
>>
> 


More information about the Insight-developers mailing list