How to build Evaluation Metrics Project from CETUS Challenge? - build

CETUS is an open challenge on 3D echocardiography Segmentation. The goal is to segment some part of the volume of data provided for the challenge. To measure how successful you have been on segmentation, a package is provided by the challenge which needs VTK (Visualization Toolkit) to be contained in the project to be built.
I downloaded VTK-8.1.1 and compiled it using cmake and visual studio 12 and added the path project_directory/bin/release/ to windows 7 path environment variable.
When I try to configure challenge measurement project by cmake, it returns an error:
CMake Error at CMakeLists.txt:30 (FIND_PACKAGE):
By not providing "FindVTK.cmake" in CMAKE_MODULE_PATH this project has
asked CMake to find a package configuration file provided by "VTK", but
CMake did not find one.
Could not find a package configuration file provided by "VTK" with any of
the following names:
VTKConfig.cmake
vtk-config.cmake
Add the installation prefix of "VTK" to CMAKE_PREFIX_PATH or set "VTK_DIR"
to a directory containing one of the above files. If "VTK" provides a
separate development package or SDK, be sure it has been installed.
Configuring incomplete, errors occurred!
See also "C:/Users/MJ/Desktop/EvaluationMetrics/EvaluationMetrics/build_dir/CMakeFiles/CMakeOutput.log".
I don't know whether I should modify configurations in cmake for VTK, or perhaps the VTK I've downloaded is not a full version!
Can anyone help me to build measurement metrics project?

Related

How can I configure CMake with CGAL?

I am working on the installation of CGAL for my 3D project.
I installed CGAL using the vcpkg package (library) and tried to configure a compiler/linker CMake with CGAL.
Unfortunately I am getting an error to configure CGAL with CMake (see below). How is it possible to link these two together? What does the error mean?
****CMake Error at CMakeLists.txt:22 (find_package):
By not providing "FindCGAL.cmake" in CMAKE_MODULE_PATH this project has
asked CMake to find a package configuration file provided by "CGAL", but
CMake did not find one.
Could not find a package configuration file provided by "CGAL" with any of
the following names:
CGALConfig.cmake
cgal-config.cmake
Add the installation prefix of "CGAL" to CMAKE_PREFIX_PATH or set
"CGAL_DIR" to a directory containing one of the above files. If "CGAL"
provides a separate development package or SDK, be sure it has been
installed.****
Configuring incomplete, errors occurred!
See also "C:/Users/Desktop/CGAL-5.0.2/examples/Triangulation_2/build/CMakeFiles/CMakeOutput.log".

CMake Error at C:\Users\...\Desktop\imgwarp-opencv\imgwarp-opencv\src\CMakeLists.txt:2 (FIND_PACKAGE)

I am using Window 10, Visual Studio 2017. I have installed OpenCV properly and I can run some basic projects of C++ OpenCV that can be found around the internet.
I have also followed this video which shows How to Build Open Source Projects Using CMake and Visual Studio.
But, I can not run this project on my machine. I try File->Open->CMake to open the CMakeLists.txt which can be found in the downloaded repository, and I get this error:
CMake Error at C:\Users\Majid\Desktop\imgwarp-opencv\imgwarp-opencv\src\CMakeLists.txt:2 (FIND_PACKAGE):
By not providing "FindOpenCV.cmake" in CMAKE_MODULE_PATH this project has
asked CMake to find a package configuration file provided by "OpenCV", but
CMake did not find one.
Could not find a package configuration file provided by "OpenCV" with any
of the following names:
OpenCVConfig.cmake
opencv-config.cmake
Add the installation prefix of "OpenCV" to CMAKE_PREFIX_PATH or set
"OpenCV_DIR" to a directory containing one of the above files. If "OpenCV"
provides a separate development package or SDK, be sure it has been
installed.
I think I must extract the downloaded opencv-4.0.1-vc14_vc15.exe file somewhere in the project folder and link the CMakeLists.txt file (which one?) to the OpenCVConfig.cmake which is in the extracted opencv. Or maybe not.
I have also CMake gui and if I should run it that way I will appreciate that you explain it that way instead of using Visual Studio File->Open->CMake. No matter how, any way that helps me run this project is welcome. Please explain it step by step.
In one line (forget all the above): What should I do to run this project properly?

CMake "find_package" command on a package that was not installed is unexpectedly successful

I am following chapter-02/recipe-06 in "CMake Cookbook". This particular example requires the Eigen C++ libraries.
I attempted to build the example and got the error that Eigen was not found.
CMake Error at CMakeLists.txt:9 (find_package):
Could not find a package configuration file provided by "Eigen3" (requested
version 3.3) with any of the following names:
Eigen3Config.cmake
eigen3-config.cmake
Add the installation prefix of "Eigen3" to CMAKE_PREFIX_PATH or set
"Eigen3_DIR" to a directory containing one of the above files. If "Eigen3"
provides a separate development package or SDK, be sure it has been
installed.
This was expected because the library was not installed on my system.
I then downloaded the ".zip" file for the Eigen libraries and unzipped it to an arbitrary location outside of my project. I created a "build" folder in the Eigen directory and ran cmake .. in the "build" folder. (I only ran cmake - I did NOT build or install the package.)
After running CMake on the Eigen build directory, I went back to the example code for "recipe-06" and it was magically able to find the Eigen library and built successfully even though Eigen was never built or installed.
Somehow just running CMake in the Eigen project made CMake aware of the Eigen libraries location. After doing this, any projects that do find_package to find Eigen3 somehow get the ${Eigen3_DIR} variable defined and are able to find it.
Looking at the CMake documentation for find_package I don't see any explanation of why this works. Eigen is not in any of the typical locations that find_package searches. According to the documentation it looks like it should NOT be found.
Even more interesting - it doesn't matter where I put Eigen on my system. I can put it literally anywhere and it will still find it.
According to everything I see in the documentation it should not be found... but it is found. So the question is how? Why does this work?
Additional info: I am using CMake version 3.13.3
There are 2 "origins" of XXXConfig.cmake files, used internally by find_package() call.
Usually, XXXConfig.cmake file is produced when the project is installed, and the file contains information about installed libraries and headers.
But CMake provides also an export() command, which allows to export build tree.
export(PACKAGE <name>)
Store the current build directory in the CMake user package registry for package <name>. The find_package command may consider the directory while searching for package <name>.
Eigen's CMakeLists.txt uses export() command, so the project becomes detectable with find_package just after running cmake for Eigen.

Not found Eigen3_DIR when configuring a cmake project in Windows

I want to compile an open project, it needs Eigen3, I followed its guideline but stuck in this step:
"Set environment variable Eigen3_DIR to {YOUR_EIGEN3_DIRECTORY}/eigen3/cmake."
I have installed CMake gui and it printed following errors after configuration
Make Error at src/CMakeLists.txt:15 (find_package):
By not providing "FindEigen3.cmake" in CMAKE_MODULE_PATH this project has
asked CMake to find a package configuration file provided by "Eigen3", but
CMake did not find one.
Could not find a package configuration file provided by "Eigen3" with any
of the following names:
Eigen3Config.cmake
eigen3-config.cmake
Add the installation prefix of "Eigen3" to CMAKE_PREFIX_PATH or set
"Eigen3_DIR" to a directory containing one of the above files. If "Eigen3"
provides a separate development package or SDK, be sure it has been
installed.
But I have downloaded Eigen3 from here, and set the Eigen3_DIR as follows
So what should I do to fix it? I am just a beginner in cmake.
I am assuming you are using Windows. You will need Visual Studio installed. You can use the community version. You will need to do the following:
Create a directory called "build" within your Eigen directory.
Go to the build directory and do "cmake ..". This will create Visual Studio projects.
Load the .sln using Visual Studio.
Build the solution.
Ensure that the project called INSTALL was built also.
This will create the Eigen3Config.cmake file in your install directory. In my case the install directory was "C:\Program Files(X86)\Eigen3. Use this to as the value for Eigen3_DIR variable.
By default Eigen does not come with the Eigen3Config.cmake file. You will see Eigen3Config.cmake.in file. This is used to build the Eigen3Config.cmake file.
HTH

Compiling with CMake and ITK error

I'm trying to compile some code from here using CMake and ITK but I'm running into an error.
In CMake I select the source folder at /utilities/ITKImageSeriesToVolume and the build folder at /utilities/ITKImageSeriesToVolume/build. This however gives me an error:
CMake Error at CMakeLists.txt:42 (find_package):
By not providing "FindITK.cmake" in CMAKE_MODULE_PATH this project has
asked CMake to find a package configuration file provided by "ITK", but
CMake did not find one.
Could not find a package configuration file provided by "ITK" with any of
the following names:
ITKConfig.cmake
itk-config.cmake
Add the installation prefix of "ITK" to CMAKE_PREFIX_PATH or set "ITK_DIR"
to a directory containing one of the above files. If "ITK" provides a
separate development package or SDK, be sure it has been installed.
I have tried to set a CMAKE_PREFIX_PATH environment variable that points to the root folder of ITK containing ITKConfig.cmake but get the same error.
Hoping someone can help, thanks in advance.
EDIT: After setting ITK_DIR to the root ITK folder I get:
CMake Error at D:/Apps/InsightToolkit/ITK/ITKConfig.cmake:48 (include):
include could not find load file:
D:/Apps/InsightToolkit/Build/ITKTargets.cmake
Call Stack (most recent call first):
CMakeLists.txt:42 (find_package)
CMake Error at D:/Apps/InsightToolkit/Source/CMake/ITKModuleAPI.cmake:56 (message):
No such module: "ITKDoubleConversion"
Call Stack (most recent call first):
D:/Apps/InsightToolkit/Source/CMake/ITKModuleAPI.cmake:26 (itk_module_load)
D:/Apps/InsightToolkit/Source/CMake/ITKModuleAPI.cmake:84 (_itk_module_config_recurse)
D:/Apps/InsightToolkit/ITK/ITKConfig.cmake:68 (itk_module_config)
CMakeLists.txt:42 (find_package)
It has a simple fix as mentioned in the ERROR
"Add the installation prefix of "ITK" to CMAKE_PREFIX_PATH or set "ITK_DIR"
to a directory containing one of the above files. If "ITK" provides a
separate development package or SDK, be sure it has been installed."
Make sure your point the CMAKE_PREFIX_PATH and ITK to your ITK Build Directory. This is assuming you have already build ITK using Cmake atleast once.
Steps
1) Create ITK source folder.
2) Create ITK build folder.
3) Run CMake and select source and build folders.
4) Select respective compiler, and if there are any compiler issues refer this discussion.
5) Configure and generate cmake.
6) Open the build files in build folder with respective IDE (use .sln file if visual studio compilers are used).
7) Build all once on visual studio.
8) Now for your new project use same steps and point CMAKE_PREFIX_PATH and ITK to your ITK Build Directory.
And everything should work.
Good Luck!!!
Your ITK build seems to be partly broken. Can you try re-building it? If that does not help, see whether ITK_USE_SYSTEM_DOUBLECONVERSION is ON. That means not to build DoubleConversion library which comes with ITK but to use the one already present on the system. If it is not present, you have a problem.
Also, unless ITK_BUILD_DEFAULT_MODULES is ON, you have to specifically turn on each module or module group you want to be compiled. In that case, turn on ITKDoubleConversion, and any additional modules which that code requires.