金子邦彦研究室インストールWindows の種々のソフトウェア(インストール)Insight Toolkit (ITK) のインストール(ソースコードを使用)(Windows 上)

Insight Toolkit (ITK) のインストール(ソースコードを使用)(Windows 上)

ITK は,次の機能を持ったソフトウェア.

Insight Toolkit (ITK) の 公式ページ: https://itk.org/

Insight Toolkit (ITK) の GitHub のページ: https://github.com/InsightSoftwareConsortium/ITK

前準備

Build Tools for Visual Studio 2022 (ビルドツール for Visual Studio 2022),Visual Studio 2022 のインストール(Windows 上)

サイト内の関連ページ

関連する外部ページ

Git のインストール(Windows 上)

Gitは,バージョン管理システム.ソースコードの管理や複数人での共同に役立つ.

サイト内の関連ページ

Windows での Git のインストール: 別ページ »で説明している.

関連する外部ページ

Git の公式ページ: https://git-scm.com/

CMake のインストール(Windows 上)

CMake はビルドツールである.

サイト内の関連ページ

Windows での cmake のインストール: 別ページ »で説明している.

関連する外部ページ

CMake の公式ダウンロードページ: https://cmake.org/download/

Python 64 ビット版のインストール,pip と setuptools の更新(Windows 上)

Windows での Python 3.10 のインストール,pip と setuptools の更新: 別ページ »で説明している.

Python の公式ページ: https://www.python.org/

Insight Toolkit (ITK) のインストール(Build Tools for Visual Studio を利用 )

  1. Windows で,コマンドプロンプト管理者として実行.

    コマンドプロンプトを管理者として実行: 別ページ »で説明

  2. Insight Toolkit (ITK) のインストールディレクトリを削除する
    C:
    cd %HOMEPATH%
    rmdir /s /q ITK
    

    [image]
  3. Insight Toolkit (ITK) のソースコードをダウンロード
    cd %HOMEPATH%
    git clone --recursive https://github.com/InsightSoftwareConsortium/ITK
    

    [image]
  4. cmake の実行

    cmake でのオプションについて

    cmake のオプションの 「Visual Studio 17 2022」のところは, 使用する Visual Studio のバージョンにあわせること. Visual Studio 2022 のときは,「Visual Studio 17 2022」. Visual Studio 2019 のときは,「Visual Studio 16 2019

    cmake の実行手順例は次の通り

    cd %HOMEPATH%
    cd ITK
    rmdir /s /q build
    mkdir build
    cd build
    del CMakeCache.txt
    cmake .. -G "Visual Studio 17 2022" -A x64 -T host=x64 ^
        -DCMAKE_BUILD_TYPE=Release ^
        -DCMAKE_INSTALL_PREFIX="C:/ITK"
    

    [image]
  5. cmake の実行結果の確認

    ※ 下の通りになるとは限らない.エラーメッセージが出るなど場合は,前で cmake を実行したときの設定を変えてやり直す

    [image]
  6. ソースコードからビルドし、インストールする

    終了までしばらく待つ.

    cmake --build. --config RELEASE
    cmake --build. --config RELEASE --target INSTALL
    
  7. 実行結果の確認

    [image]
  8. Windowsシステム環境変数 ITK_ROOT に,C:\ITK を設定

    Windows で,コマンドプロンプト管理者として実行

    コマンドプロンプトを管理者として実行: 別ページ »で説明

    次のコマンドを実行

    powershell -command "[System.Environment]::SetEnvironmentVariable(\"ITK_ROOT\", \"C:\ITK\", \"Machine\")"
    

MultiResMIRegistration の実行

参考資料

C:/InsightApplications-3.14.0/MultiResMIRegistration/ReadMe.pdf

  1. 位置合わせする画像2つを C:\ITKapp3\MultiResMIRegistration\Debug にコピー
  2. パラメータファイルCT_MRI_param.txtを作成
    --------- CT_MRI_param.txt の中身-----------
    xxCT.mhd
    MRI.mhd
    0 1 2
    0 0 0
    3
    4 4 4
    4 4 4
    2500 2500 2500
    1e-4 1e-005 5e-006
    320
    Registered_MRI.hdr
    ----------------------------------------------------------
    
  3. コマンドプロンプトを起動し,次のコマンドを実行
    cd C:\ITKapp3\MultiResMIRegistration\Debug
    MultiResMIRegistration.exe CT_MRI_param.txt
    

    実行結果の例

    [image]

    実行結果の例

    [image]