diff --git a/documentation/docs/installation.md b/documentation/docs/installation.md index 0bee798..8a72f95 100644 --- a/documentation/docs/installation.md +++ b/documentation/docs/installation.md @@ -21,6 +21,15 @@ If no error appears, then PCT was successfully installed. If you need to edit the source code of PCT, or tune the compilation process, then you need to manually compile PCT. PCT depends on [ITK](https://itk.org) and [RTK](https://openrtk.org), the first step is therefore to download and compile them. +### Create a Python virtual environment + +If you want to use PCT as a Python module, it's preferable to create a new virtual environment. NumPy is also mandatory to compile ITK Python wrappings. A virtual environment can for instance be created using `venv`: +```bash +python -m venv venv_pct +source venv_pct/bin/activate +pip install numpy +``` + ### Compiling ITK and RTK RTK comes bundled as an ITK module, so it is enough to download ITK and compile it with an option that indicates that RTK is also required. First, clone ITK from GitHub: @@ -30,7 +39,7 @@ git clone git@github.com:InsightSoftwareConsortium/ITK.git Then, create a compilation folder for ITK: ``` -mkdir itk-build +mkdir itk-build itk-install cd itk-build ``` @@ -39,13 +48,15 @@ ITK uses [CMake](https://cmake.org) as its building tool. Below is an example of cmake \ -DITK_WRAP_PYTHON=ON \ -DModule_RTK=ON \ + -DCMAKE_INSTALL_PREFIX=/itk-install \ ../ITK ``` `ITK_WRAP_PYTHON` mean that ITK will generate and compile Python wrapping for the C++ code, which is also supported by PCT. This option massively increases compilation time, so if Python wrappings are not needed, this option can be disabled. `Module_RTK` enables the compilation of RTK, which is required for PCT. -Once configuration finishes, the compilation is started using +The installation allows you to have access to PCT from your Python virtual environment if it was activated before. ``` cmake --build . +make install ``` Depending on your machine and whether `ITK_WRAP_PYTHON` is on, compiling ITK can take from few minutes up to several hours. @@ -58,7 +69,7 @@ git clone https://github.com/RTKConsortium/PCT.git Then, create a build directory for PCT: ```bash -mkdir pct-build +mkdir pct-build pct-install cd pct-build ``` @@ -66,12 +77,14 @@ Similar to ITK, configuration and compilation is handled via [CMake](https://cma ```bash cmake \ -DITK_DIR= \ + -DCMAKE_INSTALL_PREFIX=/pct-install -DPCT_BUILD_APPLICATIONS=ON \ ../PCT ``` Once configuration completes, the compilation can be achieved using ```bash cmake --build . +make install ``` Optionally, PCT can be added to the user's `$PATH` variable using for instance