Qt Creator + MITK (Linux)

2019-06-02 05:35发布

问题:

I'm trying to use MITK with Qt Creator. I've successfully compiled and used VTK and ITK with ccmake.

I've compiled MITK in superbuild mode (it downloads CTK, VTK, ITK, etc). Then I've configured it. I've compiled with make (About two hours).

I've tried make install, but MITK doesn't work that way.

With GDCM, ITK, VTK, I could find header files in /usr/local/include and shared libs in /usr/local/lib, so I included those in my .pro file in the Qt Creator project and start working.

I've been looking inside MITK-superbuild folder -after compilation-, but I can't find, for example, QmitkRenderWindow.h, and it's the first one I need.

I'm looking into MITK doc: http://docs.mitk.org/nightly-qt4/BuildInstructionsPage.html

I have an existing project with a .pro file, so I don't know how to continue.

Edited: ok, following this: http://doc.qt.digia.com/qtcreator-2.4/creator-project-cmake.html and the previous link, I created a CMakeLists.txt and changed the build directory to MITK-build folder.

Now I have autocomplete adding .h headers into code. I have to navigate into subfolders.

Is MITK-build the right folder to add? I say this because QmitkRenderWindow.h is not there, it's in MITK-src, which I've downloaded before compiling MITK.

回答1:

Two alternate suggestions (I couldn't try cause I m right now stuck with MITK build with some other configuration ) based on way that I used to make project using Creator for ITK and VTK projects

  1. If you want to use MITK using .pro file I can just give a clue (based on ITK/VTK settings for .pro) add path of all libs and header files path as below (which I used for VTK)

    INCLUDEPATH *= E:/DebugLibrary/VTK E:/DebugLibrary/VTK/Common E:/DebugLibrary/VTK/Filtering E:/DebugLibrary/VTK/GenericFiltering E:/DebugLibrary/VTK/Graphics E:/DebugLibrary/VTK/GUISupport/Qt E:/DebugLibrary/VTK/Hybrid E:/DebugLibrary/VTK/Imaging E:/DebugLibrary/VTK/IO E:/DebugLibrary/VTK/Parallel E:/DebugLibrary/VTK/Rendering E:/DebugLibrary/VTK/Utilities E:/DebugLibrary/VTK/VolumeRendering E:/DebugLibrary/VTK/Widgets E:/DebugLibrary/VTK/Wrapping

    LIBS *= -LE:/DebugLibrary/VTKBin/bin/release -lvtkCommon -lvtksys -lQVTK -lvtkWidgets -lvtkRendering -lvtkGraphics -lvtkImaging -lvtkIO -lvtkFiltering -lvtkDICOMParser -lvtkpng -lvtktiff -lvtkzlib -lvtkjpeg -lvtkexpat -lvtkNetCDF -lvtkexoIIc -lvtkftgl -lvtkfreetype -lvtkHybrid -lvtkVolumeRendering -lQVTKWidgetPlugin -lvtkGenericFiltering

  2. If you want to use Qt Creator + Cmake (within Qt) just select nmake for build and then CMake and build project (you can't use qmake here).

As I told before I didn't tried but above solutions are working with VTK for me on windows

hope this may also help Set include path with environment variable value



回答2:

Qt Creator supports native CMake. MITK, VTK and ITK are managed by CMake. So to use Qt Creator with a CMake Projekt, simply open the file CMakeLists.txt as Project File. (File->Open File or Project ...). As you already mentioned, VTK/ITK/MITK are supposed to be build as a shadow build, so source and build files are split in different directories. After loading the CMakeLists.txt QtCreator asks you for a directory where to build the project.

In case of the MITK Project you have to differ between superbuild and and building MITK only. As you already have a superbuild, simply change the build directory to the subdir MITK-build. To open the superbuild-project, choose the direcotory above. Notice that in both cases you can use the same CMakeLists.txt

Btw, to configure your build you can use the very nice gui program cmake-gui, which you can find in linux (apt-based) in the package cmake-qt-gui.

Hope that will help you. =)