RTK wiki help: Difference between revisions

From Openrtk
Jump to navigation Jump to search
 
(56 intermediate revisions by 4 users not shown)
Line 11: Line 11:
[http://www.openrtk.org/RTK/project/contactus.html Contact us]
[http://www.openrtk.org/RTK/project/contactus.html Contact us]


RTK is an open source C++ library, not an executable. This means that you must write code that uses RTK and compile it before you will obtain something that you can run and get a result from. It also means that you can adapt or extend RTK to address your problem at hand. To facilitate this over multiple operating systems, compilers, and system configurations, RTK itself must be built from its source code. RTK is based on [http://www.itk.org The Insight Toolkit], therefore you would need to get, configure and compile The Insight Toolkit first.
= GettingStarted.md =


The three steps to starting to work with RTK are therefore:
See the [https://github.com/SimonRit/RTK/blob/master/GettingStarted.md Getting started] and [https://github.com/SimonRit/RTK/blob/master/INSTALLATION.md installation] pages.


#Download and Build the ITK source
= Docker =
#Download/Obtain/Get the RTK source
#Build the RTK library
#Write your own code that uses RTK and build it, linking to the RTK library.


In the next sections we describe each of these steps.
Another installation solution is to use the Docker solution provided by Thomas Baudier:


== Requirements ==
  docker pull tbaudier/rtk:v1.3.0
In order to compile RTK you will need the following:
  docker run -ti --rm -e DISPLAY=$DISPLAY -v [Documents]:/home tbaudier/rtk:v1.3.0 bash
* GIT (in order to get the software)
* CMake (in order to configure RTK)
* C/C++ compiler


== Step 0 - Getting ITK ==
Information on what is installed can be reached using the commands:
'''RTK currently uses ITK 3.20 or ITK 4.30'''.


We recommend to look into the [http://www.itk.org/Wiki/ITK ITK wiki] in order to compile ITK for your system. The documentation for ITK should be fairly straight forward. Moreover, the concepts for building ITK are very similar to those for RTK. In order to get ITK 3.20 from git:
  docker images
  docker ps -a


  git clone git://itk.org/ITK.git ITK
To clean it after use, you can do:
  cd ITK
  git checkout release-3.20


Or ITK 4.30:
   docker rm -f [container id]
 
   docker rmi -f [image id]
  git clone git://itk.org/ITK.git
  cd ITK
  git checkout v4.3.0
 
Once ITK source code is downloaded you need to configure and generate the CMake files:
 
   mkdir ITK-bin
  cd ITK-bin
  ccmake ../ITK
 
One important CMake option to make sure is enabled if you are using ITK 3.20 is the ITK_USE_REVIEW which should be set to ON when running CMake on ITK 3.20:
 
  ITK_USE_REVIEW ON
 
If you are using ITK 4.3.0 make sure ITK_BUILD_ALL_MODULES is ON to be sure that you
have everything required:
 
  ITK_BUILD_ALL_MODULES ON
 
Note that you do not need to build the examples, the documentation or any of the tests to use ITK with RTK. You can set them off in order to speed up the process with the following flags:
 
  BUILD_DOCUMENTATION OFF
  BUILD_EXAMPLES OFF
  BUILD_TESTING OFF
 
After generating your CMake files you are ready to start the compilation process, run:
 
  make
 
== Step 1 - Getting RTK ==
This page documents how to download RTK through [http://git-scm.com Git].
Follow the ITK [[Git/Download|Git download instructions]] to install Git.
 
To get the latest source code for RTK:
   git clone git://github.com/SimonRit/RTK.git
 
== Step 2 - Building RTK ==
Like ITK, in order to build RTK you would need to install [CMake www.cmake.org]. CMake supports out of source build so we recommend to create a binary directory 'RTK-bin'
 
  mkdir RTK-bin
  cd RTK-bin
  ccmake ../RTK
 
When CMake asks for the ITK_DIR, specify the binary directory where ITK is built and choose CMAKE_BUILD_TYPE (default: Release),
 
  ITK_DIR /path_to_directory/ITK-bin
  CMAKE_BUILD_TYPE Release
 
Finally, after configuring and generating your CMake files, you can start the compilation running the following command:
 
  make
 
== Step 3 - Running the HelloWorld application ==
In order to verify the installation of your RTK library, you can run the HelloWorld application. This application is part of the RTK examples and should be built by default. Otherwise make sure that
 
  BUILD_EXAMPLES ON
 
when configuring RTK with CMake.


= Tutorials =
= Tutorials =


== Tutorial 0 - Building an HelloWorld application with RTK ==
== Tutorial 0 - Building a HelloWorld application with RTK ==
RTK is a library, therefore it's meant to be integrated into application. This tutorial shows how to create a simple HelloWorld project that links with RTK. '''The source code for this tutorial is located in RTK/examples/HelloWorld'''.
RTK is a library, therefore it's meant to be integrated into application. This tutorial shows how to create a simple FirstReconstruction project that links with RTK. The source code for this tutorial is located in [https://github.com/SimonRit/RTK/tree/master/examples/FirstReconstruction RTK/examples/FirstReconstruction].
 
* First you need to create a CMakeLists.txt with the following lines:
 
  # This project is designed to be built outside the RTK source tree.
  PROJECT(HelloWorld)
 
  # Find the RTK libraries and includes
  FIND_PACKAGE(RTK REQUIRED)
  INCLUDE(${RTK_USE_FILE})
 
  # Executable
  ADD_EXECUTABLE(HelloWorld HelloWorld.cxx )
  TARGET_LINK_LIBRARIES(HelloWorld ${RTK_LIBRARIES})
  TARGET_LINK_LIBRARIES(HelloWorld ${ITK_LIBRARIES})
 
* Create a HelloWorld.cxx file


  #include <rtkFDKBackProjectionImageFilter.h>
* First you need to create a [https://github.com/SimonRit/RTK/blob/master/examples/FirstReconstruction/CMakeLists.txt CMakeLists.txt],
* Create a [https://github.com/SimonRit/RTK/blob/master/examples/FirstReconstruction/FirstReconstruction.cxx FirstReconstruction.cxx] file,
* Run CMake on the FirstReconstruction directory and create a HelloWorld-bin,
* Configure and build the project using your favorite compiler,
* Run <code>FirstReconstruction image.mha geometry.xml</code>. If everything runs correctly, you should see a few messages ending with <code>Done!</code> and two new files in the current directory, image.mha and geometry.xml. image.mha is the reconstruction of a sphere from 360 projections and geometry.xml is the geometry file in the [http://www.openrtk.org/Doxygen/DocGeo3D.html RTK format].


  int main(int argc, char **argv)
== Tutorial 1 - Modifying a basic RTK application ==
  {
  // Define the type of pixel and the image dimension
  typedef float OutputPixelType;
  const unsigned int Dimension = 3;


  // Define the type of image
In [https://github.com/SimonRit/RTK/tree/master/applications/rtktutorialapplication applications/rtktutorialapplication/], you will find a very basic RTK application that can be used as a starting point for building more complex applications. There are many existing applications in [https://github.com/SimonRit/RTK/tree/master/applications applications] which can directly be used. See examples below.
  typedef itk::Image< OutputPixelType, Dimension > OutputImageType;


  // Define and allocate the FDK Back Projection Filter
= Wrapping =
  typedef rtk::FDKBackProjectionImageFilter<OutputImageType, OutputImageType> BPType;
  BPType::Pointer p = BPType::New();


  std::cout << "RTK Hello World!" << std::endl;
[[SimpleRTK]] provides a wrapping mechanism to several languages such as Python and C#.


  return 0;
[[WaterPreCorrection]] is an example of SimpleRTK processing to correct for cupping.
  }


* Run CMake on the HelloWorld directory and create a HelloWorld-bin
[[FanBeam]] is an example of SimpleRTK processing to do 2D fan-beam reconstructions.
* Configure and build the project using your favorite compiler
* Run the HelloWorld application. If everything runs correctly you should see "RTK Hello World!" written on the console.


== Tutorial 1 - My first reconstruction ==
You can also [[WrappersCompilation|compile them yourself]].
[[RTK/Examples/FirstReconstruction | Reconstruct a Sphere]]


= Applications =
= Applications =


RTK also provide a set of command line applications that are compiled if the cmake option BUILD_APPLICATIONS is turned on. Each application uses [[http://www.gnu.org/software/gengetopt/gengetopt.html gengetopt]] to allow parsing of the command line options. The manual of each application can be obtained with the --help or -h option. They can be executed sequentially in bash scripts.
RTK also provide a set of command line applications that are compiled if the cmake option BUILD_APPLICATIONS is turned on. Each application uses [[http://www.gnu.org/software/gengetopt/gengetopt.html gengetopt]] to allow parsing of the command line options. The manual of each application can be obtained with the --help or -h option. They can be executed sequentially in bash scripts. We provide below links to examples of use for RTK applications.


== Script 1 - FDK ==
* [[RTK/Scripts/FDK | FDK Shepp Logan ]]
* [[RTK/Scripts/3DCG | 3D Conjugate Gradient ]]
* [[RTK/Scripts/ForwardProjection | Forward projection ]]
* [[RTK/Scripts/RayBoxIntersection | Ray/box projections and reconstruction ]]
* [[RTK/Scripts/DrawGeometricPhantom | 3D geometric phantom ]]
* [[RTK/Scripts/CreateGammexPhantom | 3D gammex phantom ]]
* [[RTK/Scripts/AmsterdamShroud | Amsterdam Shroud image ]]
* [[RTK/Examples/ElektaReconstruction | Reconstruct from Elekta Data]]
* [[RTK/Examples/VarianReconstruction | Reconstruct from Varian Data]]
* [[RTK/Examples/MCCBCTReconstruction | Motion-compensated reconstruction ]]
* [[RTK/Examples/ADMMTVReconstruction | Total variation-regularized reconstruction ]]
* [[RTK/Examples/ADMMWaveletsReconstruction | Daubechies wavelets-regularized reconstruction ]]
* [[RTK/Examples/4DROOSTERReconstruction | 4DROOSTER: Total variation-regularized 3D + time reconstruction ]]


[[RTK/Scripts/FDK | FDK Shepp Logan ]]
= Image quality =


== Script 2 - Forward Projection ==
[[RTK/ImageQuality | Summary of existing and future developments for image quality in RTK]]
 
[[RTK/Scripts/ForwardProjection | POPI projections and reconstruction ]]
 
== Script 3 - Ray Box Intersection ==
 
[[RTK/Scripts/RayBoxIntersection | RayBox projections and reconstruction ]]
 
== Script 4 - Draw Geometric Phantom ==
 
[[RTK/Scripts/DrawGeometricPhantom | Creation of a 3D geometric phantom ]]
 
== Script 5 - Amsterdam Shroud Image ==
 
[[RTK/Scripts/AmsterdamShroud | Creation of an Amsterdam Shroud image ]]
 
== Script 6 - Reconstruction of Elekta Data ==
[[RTK/Examples/ElektaReconstruction | Reconstruct Elekta Data]]
 
== Script 7 - Reconstruction of Varian Data ==
[[RTK/Examples/VarianReconstruction | Reconstruct Varian Data]]


= Geometry =
= Geometry =


The description of the [http://www.openrtk.org/Doxygen/classrtk_1_1ThreeDCircularProjectionGeometry.html 3D circular geometry] is based on the international standard IEC 61217 which has been designed for cone-beam imagers on isocentric radiotherapy systems, but it can be used for any 3D circular trajectory. The fixed coordinate system of RTK and the fixed coordinate system of IEC 61217 are the same. A clear understanding of the geometry is essential for the use of a tomography package. The geometry description has been written in a [https://github.com/SimonRit/RTK/blob/master/documentation/geometry.tex latex document] compiled [http://www.openrtk.org/Doxygen/geometry.pdf here].
The description of the [http://www.openrtk.org/Doxygen/classrtk_1_1ThreeDCircularProjectionGeometry.html 3D circular geometry] is based on the international standard IEC 61217 which has been designed for cone-beam imagers on isocentric radiotherapy systems, but it can be used for any 3D circular trajectory. The fixed coordinate system of RTK and the fixed coordinate system of IEC 61217 are the same. A clear understanding of the geometry is essential for the use of a tomography package. The geometry description has been written in this [http://www.openrtk.org/Doxygen/DocGeo3D.html Doxygen page].


== ImagX geometry ==
== ImagX geometry ==


We provide as an example of geometry conversion the [[File:GeometryImagX.pdf]] specifications of the geometry used by the ImagX project (IBA/UCL) with the [[File:GeometryImagX.txt]] script file developed in [http://maxima.sourceforge.net Maxima] to do the conversion.
We provide as an example of geometry conversion the [[File:GeometryImagX.pdf]] specifications of the geometry used by the ImagX project (IBA/UCL) with the [[File:GeometryImagX.txt]] script file developed in [http://maxima.sourceforge.net Maxima] to do the conversion.
 
 
= Developer's corner =
= Developer's corner =


Line 197: Line 100:


* The RTK dashboard is available at [http://my.cdash.org/index.php?project=RTK RTK Dashboard]
* The RTK dashboard is available at [http://my.cdash.org/index.php?project=RTK RTK Dashboard]
* [[RTK/TestingDatasets | Documentation ]] on how to add datasets for testing (MIDAS+CDash)
* [[RTK/TestingDatasets | Documentation ]] on how to add datasets for testing (Girder+CDash)
 
= Citations =
 
The reference publication for RTK is
 
* [http://www.creatis.insa-lyon.fr/site/fr/publications/RIT-13a Rit, S.; Vilà Oliva, M.; Brousmiche, S.; Labarbe, R.; Sarrut, D. & Sharp, G. The Reconstruction Toolkit (RTK), an open-source cone-beam CT reconstruction toolkit based on the Insight Toolkit (ITK) International Conference on the Use of Computers in Radiation Therapy (ICCR), 2013].


The following articles have used and cited RTK
== Meetings ==


* [http://www.creatis.insa-lyon.fr/site/fr/publications/RIT-13 Rit, S.; Dedes, G.; Freud, N.; Sarrut, D. & Létang, J. Filtered backprojection proton CT reconstruction along most likely paths Med Phys, AAPM, 2013, 40, 031103],
* [[RTK/Meetings/OnImageQualityInStaticCBCT | July 31, 2015 - RTK user meeting on image quality in static CBCT]]
* [http://iopscience.iop.org/0031-9155/58/6/1809/ Martin, J.; McClelland, J.; Yip, C.; Thomas, C.; Hartill, C.; Ahmad, S.; O'Brien, R.; Meir, I.; Landau, D. & Hawkes, D. Building motion models of lung tumours from cone-beam CT for radiotherapy applications Phys Med Biol, Centre for Medical Image Computing, University College London WC1E 6BT, UK., 2013, 58, 1809-1822],
* [http://www.creatis.insa-lyon.fr/site/fr/publications/DELM-13 Delmon, V.; Vandemeulebroucke, J.; Pinho, R.; Vilá Oliva, M.; Sarrut, D. & Rit, S. In-room breathing motion estimation from limited projection views using a sliding deformation model International Conference on the Use of Computers in Radiation Therapy (ICCR), 2013].

Latest revision as of 16:05, 8 December 2019

Welcome to RTK

The Reconstruction Toolkit (RTK) is an open-source and cross-platform software for fast circular cone-beam CT reconstruction based on the Insight Toolkit (ITK). RTK is developed by the RTK consortium. This is the wiki documentation, other information is available here:

Main website

Project

Resources

Contact us

GettingStarted.md

See the Getting started and installation pages.

Docker

Another installation solution is to use the Docker solution provided by Thomas Baudier:

 docker pull tbaudier/rtk:v1.3.0
 docker run -ti --rm -e DISPLAY=$DISPLAY -v [Documents]:/home tbaudier/rtk:v1.3.0 bash

Information on what is installed can be reached using the commands:

 docker images
 docker ps -a

To clean it after use, you can do:

 docker rm -f [container id]
 docker rmi -f [image id]

Tutorials

Tutorial 0 - Building a HelloWorld application with RTK

RTK is a library, therefore it's meant to be integrated into application. This tutorial shows how to create a simple FirstReconstruction project that links with RTK. The source code for this tutorial is located in RTK/examples/FirstReconstruction.

  • First you need to create a CMakeLists.txt,
  • Create a FirstReconstruction.cxx file,
  • Run CMake on the FirstReconstruction directory and create a HelloWorld-bin,
  • Configure and build the project using your favorite compiler,
  • Run FirstReconstruction image.mha geometry.xml. If everything runs correctly, you should see a few messages ending with Done! and two new files in the current directory, image.mha and geometry.xml. image.mha is the reconstruction of a sphere from 360 projections and geometry.xml is the geometry file in the RTK format.

Tutorial 1 - Modifying a basic RTK application

In applications/rtktutorialapplication/, you will find a very basic RTK application that can be used as a starting point for building more complex applications. There are many existing applications in applications which can directly be used. See examples below.

Wrapping

SimpleRTK provides a wrapping mechanism to several languages such as Python and C#.

WaterPreCorrection is an example of SimpleRTK processing to correct for cupping.

FanBeam is an example of SimpleRTK processing to do 2D fan-beam reconstructions.

You can also compile them yourself.

Applications

RTK also provide a set of command line applications that are compiled if the cmake option BUILD_APPLICATIONS is turned on. Each application uses [gengetopt] to allow parsing of the command line options. The manual of each application can be obtained with the --help or -h option. They can be executed sequentially in bash scripts. We provide below links to examples of use for RTK applications.

Image quality

Summary of existing and future developments for image quality in RTK

Geometry

The description of the 3D circular geometry is based on the international standard IEC 61217 which has been designed for cone-beam imagers on isocentric radiotherapy systems, but it can be used for any 3D circular trajectory. The fixed coordinate system of RTK and the fixed coordinate system of IEC 61217 are the same. A clear understanding of the geometry is essential for the use of a tomography package. The geometry description has been written in this Doxygen page.

ImagX geometry

We provide as an example of geometry conversion the File:GeometryImagX.pdf specifications of the geometry used by the ImagX project (IBA/UCL) with the File:GeometryImagX.txt script file developed in Maxima to do the conversion.

Developer's corner

Developer's documentation

We only provide the doxygen documentation at the moment.

Coding style

RTK is based on ITK and aims at following its coding conventions. Any developer should follow these conventions when submitting new code or contributions to the existing one. We strongly recommend you to read thoroughly ITK's style guide.

Testing

Meetings