2014年2月16日 星期日

ITK + VTK + QT on Window 7 64bit and Visual Studio 2010 Pro 64bit project

building a 64-bit libraries and projects
  • ITK + VTK 6 + OpenCV + Qt 4.7.1
  • Windows 7 64-bit and visual studio 2010 sp1
=======================================

CHECK Your things

Visual Studio 2010

  1. assuming you have had it
  2. update to sp1 link

CMake

  1. cross platform
  2. build libraries and projects
  3. download it, e.g.,  Windows (Win32 Installer) cmake-2.8.11.2-win32-x86.exe

ITK & VTK

  1. download itk
  2. download vtk  (it works fine when i was using version 6.0)

Qt 4.7.1

  1. download

OpenCV

  1. download

I refer you to here, if you have not idea how to organize your directories!
Please check step 1 and 2


Now go on to the building part!

=======================================

Building 64-bit libraries by Cmake

Two important things we must remember
  1. we run everything under RELEASE MODE on vs 2010
  2. the platform we use we choose "Visual Studio 10 Win64" in cmake setting

QT part

1. Make sure installed correctly

2. setting up environment variables
  • QTDIR=C:\Qt\4.7.1
  • QMAKESPEC=win32-msvc2010
  • add ”%QTDIR%\bin” to PATH
3.building a 64-bit library for QT (since Qt 4 not supporting 64-bit )
  1. download latest jom, then unzip to "C:\Qt\jom"
  2. using administrator mode to open ”Visual Studio x64 Win64 command line (2010)”
  3. doing the following command in order ( the total time about 40 minutes)
  • configure -debug-and-release -opensource -platform win32-msvc2010
  • ..\jom\jom.exe -j N
(N represent the core number of your computer, e.g., 4 or 8, do not use "N" directly)




VTK part

first, using cmake.....

1. open Cmake (cmake-gui)
2. fill up the Source code path, e.g., ” C:\VTK\vtk-5.10.1\VTK5.10.1” and Binaries code path, e.g., ” C:\VTK\vtk-5.10.1\vs2010_x64”
3. click Configure and choose  “Visual Studio 10 Win64” and  “Use default native compilers”
4. press Finish and wait for a while
5. after Configuration done, find and check the following items (Unbelievably important!!)
  • BUILD_EXAMPLES
  • BUILD_SHARED_LIBS
  • VTK_USE_GUISUPPORT
  • VTK_USE_QT
6. press Configure again, then press Generate
7.waiting for generating done
(note: build_examples checked only for testing those samples)

second, VS2010 part.....

8. go to the binary path where your VS project built, then find "VTK.sln" and open it
9. change this project mode to release mode and x64 platform
10. build this project (it takes at least one hour)

third, post-processing....

11.go to the path that your library should locate, e.g., “C:\vtk\VTK5.10.1\vs10\bin\Release” and make sure there are QVTKWidgetPlugin.lib and QVTKWidgetPlugin.dll inside

12.copy QVTKWidgetPlugin.lib and QVTKWidgetPlugin.dll to “C:\Qt\4.x.x\plugins\designer” and then open your Qt designer, make sure there is a QVTKWidget on the component closet

13.add ”C:\VTK\VTK-5.10.1\vs2010_x64\bin\Release” or whatever place you built it to PATH (important!!)

14. (optional) test if 64-BIT Qt + 64-BIT VTK is OK ,
C:\VTK\VTK-5.10.1\vs2010_x64\Examples\VTKExamples.sln

  • EasyView
  • SimpleView
  • Qtevents
  • qtimageviewer
  • QtVTKRenderWindows
  • EventQtSlotConnect


ITK part

first, using cmake.....

1. open Cmake (cmake-gui)
2. fill up the Source code path, e.g., "C:/ITK/itk-4.4.1/InsightToolkit-4.4.1" and Binaries code path, e.g.,"C:/ITK/itk-4.4.1/vs2010_x64"
3. click Configure and choose  “Visual Studio 10 Win64” and  “Use default native compilers”
4. press Finish and wait for a while

5.after configuration done, check this one (Unbelievably important!!)

  • BUILD_SHARED_LIBS

6. press Configure again, then press Generate
7.waiting for generating done

second, VS2010 part.....

8. go to the binary path where your VS project built, then find "ITK.sln" and open it
9. change this project mode to release mode and x64 platform
10. build this project (it takes at least one hour)

third, environmental variable.....

11. add ”C:\itk\itk-4.2.1\vs10_x64\bin\Release” or whatever place you built it to PATH (Unbelievably important!!)


=======================================

Building 64-bit project by Cmake and check if it works

I refer you to here. Please check step 4
Do NOT forget to build your project on a 64-bit setting as the way you do to build 64-bit libraries above 




Note:
Qt 5+ provides a 64-bit library and it should be working with VTK 6.1+
And I haven't tried it yet!

some useful links....
if your hard-drive is not big enough....link

沒有留言:

張貼留言