https://wiki.openrtk.org/api.php?action=feedcontributions&user=Cyril.mory&feedformat=atomOpenrtk - User contributions [en]2024-03-29T10:00:57ZUser contributionsMediaWiki 1.39.3https://wiki.openrtk.org/index.php?title=RTK_wiki_help&diff=521RTK wiki help2018-05-23T09:30:54Z<p>Cyril.mory: </p>
<hr />
<div>= Welcome to RTK =<br />
<br />
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:<br />
<br />
[http://www.openrtk.org/ Main website]<br />
<br />
[http://www.openrtk.org/RTK/project/project.html Project]<br />
<br />
[http://www.openrtk.org/RTK/resources/resources.html Resources]<br />
<br />
[http://www.openrtk.org/RTK/project/contactus.html Contact us]<br />
<br />
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.<br />
<br />
The three steps to starting to work with RTK are therefore:<br />
<br />
#Download and Build the ITK source<br />
#Download/Obtain/Get the RTK source<br />
#Build the RTK library<br />
#Write your own code that uses RTK and build it, linking to the RTK library. <br />
<br />
In the next sections we describe each of these steps. Danny Lessio has developped and shared a script that automatically downloads and compiles ITK and RTK, see the [https://github.com/dannylessio/auto-build-RTK auto-build-RTK GitHub repository].<br />
<br />
== Requirements ==<br />
In order to compile RTK you will need the following:<br />
* GIT (in order to get the software)<br />
* CMake (in order to configure RTK)<br />
* C/C++ compiler<br />
<br />
== Step 0 - Getting ITK ==<br />
'''RTK currently uses ITK > 4.12.0'''. <br />
<br />
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 4.13.0:<br />
<br />
git clone git://itk.org/ITK.git<br />
cd ITK<br />
git checkout v4.13.0<br />
<br />
Once ITK source code is downloaded you need to configure and generate the CMake files:<br />
<br />
mkdir ITK-bin<br />
cd ITK-bin<br />
ccmake ../ITK<br />
<br />
It is also recommended to use the [http://www.fftw.org FFTW] library via the options<br />
<br />
ITK_USE_FFTWD ON<br />
ITK_USE_FFTWF ON<br />
<br />
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:<br />
<br />
BUILD_DOCUMENTATION OFF<br />
BUILD_EXAMPLES OFF<br />
BUILD_TESTING OFF <br />
<br />
After generating your CMake files you are ready to start the compilation process, run:<br />
<br />
make<br />
<br />
== Step 1 - Getting RTK ==<br />
This page documents how to download RTK through [http://git-scm.com Git].<br />
Follow the ITK [[Git/Download|Git download instructions]] to install Git.<br />
<br />
To get the latest source code for RTK:<br />
git clone git://github.com/SimonRit/RTK.git<br />
<br />
== Step 2 - Building RTK ==<br />
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'<br />
<br />
mkdir RTK-bin<br />
cd RTK-bin<br />
ccmake ../RTK<br />
<br />
When CMake asks for the ITK_DIR, specify the binary directory where ITK is built and choose CMAKE_BUILD_TYPE (default: Release),<br />
<br />
ITK_DIR /path_to_directory/ITK-bin<br />
CMAKE_BUILD_TYPE Release<br />
<br />
Finally, after configuring and generating your CMake files, you can start the compilation running the following command:<br />
<br />
make<br />
<br />
== Step 3 - Running the HelloWorld application ==<br />
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<br />
<br />
BUILD_EXAMPLES ON<br />
<br />
when configuring RTK with CMake.<br />
<br />
= Docker =<br />
<br />
Another installation solution is to use the Docker solution provided by Thomas Baudier:<br />
<br />
docker pull tbaudier/rtk:v1.3.0<br />
docker run -ti --rm -e DISPLAY=$DISPLAY -v [Documents]:/home tbaudier/rtk:v1.3.0 bash<br />
<br />
Information on what is installed can be reached using the commands:<br />
<br />
docker images<br />
docker ps -a<br />
<br />
To clean it after use, you can do:<br />
<br />
docker rm -f [container id]<br />
docker rmi -f [image id]<br />
<br />
= Tutorials =<br />
<br />
== Tutorial 0 - Building a HelloWorld application with RTK ==<br />
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'''.<br />
<br />
* First you need to create a CMakeLists.txt with the following lines:<br />
<br />
# This project is designed to be built outside the RTK source tree.<br />
PROJECT(HelloWorld)<br />
<br />
# Find the RTK libraries and includes<br />
FIND_PACKAGE(RTK REQUIRED)<br />
INCLUDE(${RTK_USE_FILE})<br />
<br />
# Executable<br />
ADD_EXECUTABLE(HelloWorld HelloWorld.cxx )<br />
TARGET_LINK_LIBRARIES(HelloWorld ${RTK_LIBRARIES})<br />
TARGET_LINK_LIBRARIES(HelloWorld ${ITK_LIBRARIES})<br />
<br />
* Create a HelloWorld.cxx file<br />
<br />
#include <rtkFDKBackProjectionImageFilter.h><br />
<br />
int main(int argc, char **argv)<br />
{<br />
// Define the type of pixel and the image dimension<br />
typedef float OutputPixelType;<br />
const unsigned int Dimension = 3;<br />
<br />
// Define the type of image<br />
typedef itk::Image< OutputPixelType, Dimension > OutputImageType;<br />
<br />
// Define and allocate the FDK Back Projection Filter<br />
typedef rtk::FDKBackProjectionImageFilter<OutputImageType, OutputImageType> BPType;<br />
BPType::Pointer p = BPType::New();<br />
<br />
std::cout << "RTK Hello World!" << std::endl;<br />
<br />
return 0;<br />
}<br />
<br />
* Run CMake on the HelloWorld directory and create a HelloWorld-bin<br />
* Configure and build the project using your favorite compiler<br />
* Run the HelloWorld application. If everything runs correctly you should see "RTK Hello World!" written on the console.<br />
<br />
== Tutorial 1 - Modifying a basic RTK application ==<br />
<br />
In RTK/applications/rtktutorialapplication/, you will find a very basic RTK application that can be used as a starting point for building more complex applications.<br />
The code suggests ways to modify the application, which should help beginners get the hang of ITK and RTK.<br />
<br />
== Tutorial 2 - My first reconstruction ==<br />
[[RTK/Examples/FirstReconstruction | Reconstruct a Sphere]]<br />
<br />
= Wrapping =<br />
<br />
[[SimpleRTK]] provides a wrapping mechanism to several languages such as Python and C#.<br />
<br />
[[WaterPreCorrection]] is an example of SimpleRTK processing to correct for cupping.<br />
<br />
[[FanBeam]] is an example of SimpleRTK processing to do 2D fan-beam reconstructions.<br />
<br />
= Applications =<br />
<br />
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.<br />
<br />
* [[RTK/Scripts/FDK | FDK Shepp Logan ]]<br />
* [[RTK/Scripts/3DCG | 3D Conjugate Gradient ]]<br />
* [[RTK/Scripts/ForwardProjection | Forward projection ]]<br />
* [[RTK/Scripts/RayBoxIntersection | Ray/box projections and reconstruction ]]<br />
* [[RTK/Scripts/DrawGeometricPhantom | 3D geometric phantom ]]<br />
* [[RTK/Scripts/CreateGammexPhantom | 3D gammex phantom ]]<br />
* [[RTK/Scripts/AmsterdamShroud | Amsterdam Shroud image ]]<br />
* [[RTK/Examples/ElektaReconstruction | Reconstruct from Elekta Data]]<br />
* [[RTK/Examples/VarianReconstruction | Reconstruct from Varian Data]]<br />
* [[RTK/Examples/MCCBCTReconstruction | Motion-compensated reconstruction ]]<br />
* [[RTK/Examples/ADMMTVReconstruction | Total variation-regularized reconstruction ]]<br />
* [[RTK/Examples/ADMMWaveletsReconstruction | Daubechies wavelets-regularized reconstruction ]]<br />
* [[RTK/Examples/4DROOSTERReconstruction | 4DROOSTER: Total variation-regularized 3D + time reconstruction ]]<br />
<br />
= Image quality =<br />
<br />
[[RTK/ImageQuality | Summary of existing and future developments for image quality in RTK]]<br />
<br />
= Geometry =<br />
<br />
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].<br />
<br />
== ImagX geometry ==<br />
<br />
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.<br />
<br />
= Developer's corner =<br />
<br />
== Developer's documentation ==<br />
<br />
We only provide the [http://www.openrtk.org/Doxygen/index.html doxygen documentation] at the moment.<br />
<br />
== Coding style ==<br />
<br />
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 [http://www.itk.org/Wiki/ITK/Coding_Style_Guide ITK's style guide].<br />
<br />
== Testing ==<br />
<br />
* The RTK dashboard is available at [http://my.cdash.org/index.php?project=RTK RTK Dashboard]<br />
* [[RTK/TestingDatasets | Documentation ]] on how to add datasets for testing (MIDAS+CDash)<br />
<br />
== Meetings ==<br />
<br />
* [[RTK/Meetings/OnImageQualityInStaticCBCT | July 31, 2015 - RTK user meeting on image quality in static CBCT]]</div>Cyril.moryhttps://wiki.openrtk.org/index.php?title=RTK/Meetings/TrainingNov17&diff=516RTK/Meetings/TrainingNov172017-11-24T10:52:14Z<p>Cyril.mory: </p>
<hr />
<div>= Geometry =<br />
<br />
== Real ==<br />
<br />
Edit and analyze the [http://midas3.kitware.com/midas/download/item/318790/geometry.xml geometry file] obtained from a real Elekta Synergy acquisition. Compare to the [http://midas3.kitware.com/midas/download/item/208648/projections.tgz projection files] using the command<br />
<source lang="bash" enclose="div"><br />
vv --sequence *his<br />
</source><br />
(VV help: F1).<br />
<br />
== Simulated ==<br />
<br />
Use the command line application rtksimulatedgeometry to generate simulated geometries and analyze the outputs. (Help: rtksimulatedgeometry -h).<br />
<br />
= Basic operators =<br />
<br />
Here is a list of the RTK command lines you will have to run during the training, along with the data you will need.<br />
To start, download the following [http://midas3.kitware.com/midas/download/item/318788/muCT.mha CT data] and a relevant Cone-Beam CT [http://midas3.kitware.com/midas/download/item/318790/geometry.xml geometry file].<br />
<br />
== Forward projection ==<br />
<br />
To forward project the CT volume, following the geometry described in geometry.xml, run<br />
<br />
<source lang="bash" enclose="div"><br />
rtkforwardprojections -i muCT.mha -o projections.mha -g geometry.xml --verbose --dimension 128 --spacing 2<br />
</source><br />
<br />
Look at the result using vv<br />
<br />
<source lang="bash" enclose="div"><br />
vv projections.mha<br />
</source><br />
<br />
There are as many projections as described in the geometry.xml file. You can edit the geometry.xml file, remove all projections except one, and try again. Such a modified geometry file is available [http://midas3.kitware.com/midas/download/item/318789/singleProjectionGeometry.xml here]. Run the following command line<br />
<br />
<source lang="bash" enclose="div"><br />
rtkforwardprojections -i muCT.mha -o singleProjection.mha -g singleProjectionGeometry.xml --verbose --dimension 256 --spacing 1<br />
</source><br />
<br />
You can check with vv that the file contains only one projection<br />
<br />
<source lang="bash" enclose="div"><br />
vv singleProjection.mha<br />
</source><br />
<br />
== Back projection ==<br />
<br />
Start by back projecting a single projection. Run<br />
<br />
<source lang="bash" enclose="div"><br />
rtkbackprojections -v -p . -r singleProjection.mha -o singleBackProjection.mha -g singleProjectionGeometry.xml --dimension 128 --spacing 2<br />
</source><br />
<br />
Observe the result with vv<br />
<br />
<source lang="bash" enclose="div"><br />
vv singleBackProjection.mha<br />
</source><br />
<br />
As you can see, the projection data seems to be smeared into the volume. Now back project all projections, by running<br />
<br />
<source lang="bash" enclose="div"><br />
rtkbackprojections -v -p . -r projections.mha -o backProjection.mha -g geometry.xml --dimension 128 --spacing 2<br />
</source><br />
<br />
Look at the result with vv. In order to compare it with the original image, run <br />
<br />
<source lang="bash" enclose="div"><br />
vv backProjection.mha muCT.mha --linkall<br />
</source><br />
<br />
Click in one of the display windows, hit 'Ctrl + G' to center the view on the tumor. Hit 'w' to automatically compute reasonable window and level values. You can navigate between "muCT.mha" and "backProjection.mha" by hitting the 'Tab' key.<br />
<br />
== Using different forward and back projection algorithms ==<br />
<br />
Both rtkforwardprojections and rtkbackprojections can use several algorithms to perform the forward or back projections. For forward projections, you can try the following command lines<br />
<br />
<source lang="bash" enclose="div"><br />
rtkforwardprojections -i muCT.mha -o josephProjections.mha -g geometry.xml --fp Joseph --dimension 128 --spacing 2<br />
</source><br />
<source lang="bash" enclose="div"><br />
rtkforwardprojections -i muCT.mha -o rayCastInterpolatorProjections.mha -g geometry.xml --fp RayCastInterpolator --dimension 128 --spacing 2<br />
</source><br />
<br />
And for back projection<br />
<br />
<source lang="bash" enclose="div"><br />
rtkbackprojections -p . -r projections.mha -o voxelBasedBackProjection.mha -g geometry.xml --bp VoxelBasedBackProjection --dimension 128 --spacing 2<br />
</source><br />
<source lang="bash" enclose="div"><br />
rtkbackprojections -p . -r projections.mha -o josephBackProjection.mha -g geometry.xml --bp Joseph --dimension 128 --spacing 2<br />
</source><br />
<source lang="bash" enclose="div"><br />
rtkbackprojections -p . -r projections.mha -o normalizedJosephBackProjection.mha -g geometry.xml --bp NormalizedJoseph --dimension 128 --spacing 2<br />
</source><br />
<br />
If you have a CUDA-capable graphics card, and have compiled RTK with RTK_USE_CUDA=ON, you can also try the following<br />
<br />
<source lang="bash" enclose="div"><br />
rtkforwardprojections -i muCT.mha -o cudaRayCastProjections.mha -g geometry.xml --fp CudaRayCast<br />
</source><br />
<source lang="bash" enclose="div"><br />
rtkbackprojections -p . -r projections.mha -o cudaRayCastBackProjection.mha -g geometry.xml --bp CudaRayCast<br />
</source><br />
<source lang="bash" enclose="div"><br />
rtkbackprojections -p . -r projections.mha -o cudaBackProjection.mha -g geometry.xml --bp CudaBackProjection<br />
</source><br />
<br />
= Pre-processing =<br />
<br />
Pre-process the sequence of real .his projections <br />
* Crop<br />
* Bin<br />
* Median<br />
<br />
= 3D FBP reconstruction =<br />
<br />
== Real ==<br />
<br />
Reconstruct the sequence of (pre-processed) real projections with and without width-truncated correction.<br />
<br />
<source lang="bash" enclose="div"><br />
rtkfdk -p projections -r '.*.his' -o fdk.mha -g geometry.xml --dimension 128 --spacing 2 --binning 4,4<br />
rtkfdk -p projections -r '.*.his' -o fdk_pad.mha -g geometry.xml --dimension 128 --spacing 2 --binning 4,4 --pad 0.5<br />
</source><br />
<br />
== Simulated ==<br />
<br />
Simulate Shepp Logan projections (rtkprojectshepplogan) for a short scan and reconstruct them:<br />
<br />
<source lang="bash" enclose="div"><br />
rtksimulatedgeometry -a 220 -n 110 -o parker.xml<br />
rtkprojectshepploganphantom -g parker.xml --dimension 128 --spacing 2 -o parker.mha --phantomscale 64<br />
rtkfdk -p . -r parker.mha -o fdk_park.mha -g parker.xml --dimension 128<br />
</source><br />
<br />
Idem for width-truncated projections:<br />
<br />
<source lang="bash" enclose="div"><br />
rtksimulatedgeometry -n 110 -o widthtrunc.xml --proj_iso_x 80<br />
rtkprojectshepploganphantom -g widthtrunc.xml --dimension 128 --spacing 2 -o widthtrunc.mha --phantomscale 64<br />
rtkfdk -p . -r widthtrunc.mha -o fdk_wt.mha -g widthtrunc.xml --dimension 128<br />
</source><br />
<br />
<br />
= 3D iterative reconstruction =<br />
<br />
== Creating a very small dataset ==<br />
<br />
Various reconstruction algorithms exist, which employ forward and back projection extensively. We will now start performing real reconstructions using some of the algorithms implemented in RTK. Since these algorithms are computationally much more demanding than the standard FDK, we propose to run them with low resolution data. You will be able to re-compute them at full resolution later, since the present page will remain available to you after the training. Note that, for the regularized reconstruction techniques, you will have to re-tune the regularization parameters yourself, since they depend (among many things) on resolution.<br />
<br />
Convert and preprocess the real projections by running<br />
<br />
<source lang="bash" enclose="div"><br />
rtkprojections -p projections/ -r .*.his -o downsampledProjections.mha --binning "4, 4"<br />
</source><br />
<br />
The '--binning "4, 4"' option downsamples the projections by 4 along both axes. Since this is not enough to reach acceptable reconstruction times for the training, we will build a sub-dataset by selecting only one projection out of 5. You can do this by running <br />
<br />
<source lang="bash" enclose="div"><br />
rtksubselect -p . -r downsampledProjections.mha -g geometry.xml --out_geometry subGeometry.xml --out_proj subProjections.mha -s 5<br />
</source><br />
<br />
This creates a new geometry file and a new projections file, from which even a laptop should be able to perform iterative reconstruction in reasonable time.<br />
<br />
== Unregularized 3D iterative reconstruction algorithms ==<br />
<br />
The most popular iterative reconstruction algorithm is the Simultaneous Algebraic Reconstruction Technique (SART). Try it by running<br />
<br />
<source lang="bash" enclose="div"><br />
rtksart -p . -r subProjections.mha -g subGeometry.xml -o SART.mha --dimension 128 --spacing 3<br />
</source><br />
<br />
Another popular technique uses the conjugate gradient algorithm<br />
<br />
<source lang="bash" enclose="div"><br />
rtkconjugategradient -p . -r subProjections.mha -g subGeometry.xml -o CG.mha --dimension 128 --spacing 3 -n 10<br />
</source><br />
<br />
You can compare the results by running<br />
<br />
<source lang="bash" enclose="div"><br />
vv SART.mha CG.mha --linkall<br />
</source><br />
<br />
The SART reconstruction should be sharper than the conjugate gradient one. If you are interested in understanding the reasons for this difference, try running <br />
<br />
<source lang="bash" enclose="div"><br />
rtksart -p . -r subProjections.mha -g subGeometry.xml -o OSSART_10projsPerSubset.mha --dimension 128 --spacing 3 --nprojpersubset 10<br />
</source><br />
<br />
Visualization is improved when one masks the field-of-view of the reconstruction:<br />
<source lang="bash" enclose="div"><br />
rtkfieldofview -p . -r subProjections.mha -g subGeometry.xml -m -o FOVmask.mha --reconstruction SART.mha <br />
rtkfieldofview -p . -r subProjections.mha -g subGeometry.xml -o SART_masked.mha --reconstruction SART.mha <br />
</source><br />
<br />
The differences in image quality (sharpness, contrast, ...) and convergence speed, stability, ... between the various algorithms may be discussed briefly during the training.<br />
<br />
== Regularized 3D iterative reconstruction algorithms ==<br />
<br />
RTK also includes algorithms that perform regularization during the reconstruction. You can try for example<br />
<br />
<source lang="bash" enclose="div"><br />
rtkadmmtotalvariation -p . -r subProjections.mha -g subGeometry.xml -o admmTV.mha --dimension 128 --spacing 3 -n 10 --beta 1000 --alpha 1<br />
</source><br />
<br />
and<br />
<br />
<source lang="bash" enclose="div"><br />
rtkadmmwavelets -p . -r subProjections.mha -g subGeometry.xml -o admmWavelets.mha --dimension 128 --spacing 3 -n 10 --beta 1000 --alpha 1<br />
</source><br />
<br />
Note that these algorithms have little interest when working with such low resolution data, since most of the noise and artifacts they are meant to remove have already been eliminated by undersampling.<br />
<br />
= Dual energy CT simulation and decomposition =<br />
<br />
The following script generates noiseless line integrals through a phantom composed of a large cylinder of water and a smaller cylinder of iodine, with a concentration of 0.001 g/ml. It requires <br />
CLITK, so if you do not have a working CLITK, you can just use the files provided in the data folder.<br />
<source lang="bash" enclose="div"><br />
# Generate geometry for a single projection<br />
rtksimulatedgeometry -n 1 -o singleProjGeo.xml<br />
<br />
# Compute analytical projections of the PRH phantom<br />
for i in water iodine<br />
do<br />
rtkdrawgeometricphantom --phantom $i.txt -o vol_$i.mha --dimension 256,64,256 --spacing 1,1,1<br />
rtkforwardprojections -o proj_$i.mha -i vol_$i.mha -g singleProjGeo.xml --dimension 256,32,1 --spacing 1,1,1 --fp Joseph<br />
clitkSum -i proj_$i.mha -o proj_$i.mha -d 2<br />
done<br />
<br />
# Merge the projections into a single file<br />
clitkMergeSequence proj_water.mha proj_iodine.mha -o lineIntegrals.mha <br />
clitk4DImageToNVectorImage -i lineIntegrals.mha -o lineIntegrals.mha<br />
<br />
# Create a starting point for decompotion<br />
clitkImageCreate -o zero_proj.mha --like proj_water.mha<br />
clitkMergeSequence zero_proj.mha zero_proj.mha -o zero_proj.mha<br />
clitk4DImageToNVectorImage -i zero_proj.mha -o initial.mha<br />
</source><br />
<br />
This has generated the files lineIntegrals.mha and initial.mha (the starting point for decomposition, set to 0 everywhere). <br />
<br />
== Forward model ==<br />
<br />
This will compute the expected energy in each of the two bins of the detector, for each pixel of the projection. It is the simplest possible simulation tool to compute dual energy projections.<br />
<br />
<source lang="bash" enclose="div"><br />
# Compute dual energy projections<br />
rtkdualenergyforwardmodel -i lineIntegrals.mha -o dualEnergyProjections.mha --high highEnergyEffectiveSpectrum.mha --low lowEnergyEffectiveSpectrum.mha -a water_iodine_attenuation.mha<br />
</source><br />
<br />
== Decomposition ==<br />
<br />
And the following command computes the line integrals from the dual energy projections. It is this step that is performed on actual dual energy CT projection data extracted from a real scanner.<br />
<br />
<source lang="bash" enclose="div"><br />
# Recover line integrals<br />
rtkdualenergysimplexdecomposition -i initial.mha -o decomposed.mha --high highEnergyEffectiveSpectrum.mha --low lowEnergyEffectiveSpectrum.mha -a water_iodine_attenuation.mha --dual dualEnergyProjections.mha -n 10000 -r<br />
</source><br />
<br />
All this is done with noiseless data, but one can simulate any kind of noise on the output of the forward model, and try to perform the decomposition.</div>Cyril.moryhttps://wiki.openrtk.org/index.php?title=RTK/Meetings/TrainingNov17&diff=515RTK/Meetings/TrainingNov172017-11-24T10:36:05Z<p>Cyril.mory: Created page with "= Geometry = == Real == Edit and analyze the [http://midas3.kitware.com/midas/download/item/318790/geometry.xml geometry file] obtained from a real Elekta Synergy acquisitio..."</p>
<hr />
<div>= Geometry =<br />
<br />
== Real ==<br />
<br />
Edit and analyze the [http://midas3.kitware.com/midas/download/item/318790/geometry.xml geometry file] obtained from a real Elekta Synergy acquisition. Compare to the [http://midas3.kitware.com/midas/download/item/208648/projections.tgz projection files] using the command<br />
<source lang="bash" enclose="div"><br />
vv --sequence *his<br />
</source><br />
(VV help: F1).<br />
<br />
== Simulated ==<br />
<br />
Use the command line application rtksimulatedgeometry to generate simulated geometries and analyze the outputs. (Help: rtksimulatedgeometry -h).<br />
<br />
= Basic operators =<br />
<br />
Here is a list of the RTK command lines you will have to run during the training, along with the data you will need.<br />
To start, download the following [http://midas3.kitware.com/midas/download/item/318788/muCT.mha CT data] and a relevant Cone-Beam CT [http://midas3.kitware.com/midas/download/item/318790/geometry.xml geometry file].<br />
<br />
== Forward projection ==<br />
<br />
To forward project the CT volume, following the geometry described in geometry.xml, run<br />
<br />
<source lang="bash" enclose="div"><br />
rtkforwardprojections -i muCT.mha -o projections.mha -g geometry.xml --verbose --dimension 128 --spacing 2<br />
</source><br />
<br />
Look at the result using vv<br />
<br />
<source lang="bash" enclose="div"><br />
vv projections.mha<br />
</source><br />
<br />
There are as many projections as described in the geometry.xml file. You can edit the geometry.xml file, remove all projections except one, and try again. Such a modified geometry file is available [http://midas3.kitware.com/midas/download/item/318789/singleProjectionGeometry.xml here]. Run the following command line<br />
<br />
<source lang="bash" enclose="div"><br />
rtkforwardprojections -i muCT.mha -o singleProjection.mha -g singleProjectionGeometry.xml --verbose --dimension 256 --spacing 1<br />
</source><br />
<br />
You can check with vv that the file contains only one projection<br />
<br />
<source lang="bash" enclose="div"><br />
vv singleProjection.mha<br />
</source><br />
<br />
== Back projection ==<br />
<br />
Start by back projecting a single projection. Run<br />
<br />
<source lang="bash" enclose="div"><br />
rtkbackprojections -v -p . -r singleProjection.mha -o singleBackProjection.mha -g singleProjectionGeometry.xml --dimension 128 --spacing 2<br />
</source><br />
<br />
Observe the result with vv<br />
<br />
<source lang="bash" enclose="div"><br />
vv singleBackProjection.mha<br />
</source><br />
<br />
As you can see, the projection data seems to be smeared into the volume. Now back project all projections, by running<br />
<br />
<source lang="bash" enclose="div"><br />
rtkbackprojections -v -p . -r projections.mha -o backProjection.mha -g geometry.xml --dimension 128 --spacing 2<br />
</source><br />
<br />
Look at the result with vv. In order to compare it with the original image, run <br />
<br />
<source lang="bash" enclose="div"><br />
vv backProjection.mha muCT.mha --linkall<br />
</source><br />
<br />
Click in one of the display windows, hit 'Ctrl + G' to center the view on the tumor. Hit 'w' to automatically compute reasonable window and level values. You can navigate between "muCT.mha" and "backProjection.mha" by hitting the 'Tab' key.<br />
<br />
== Using different forward and back projection algorithms ==<br />
<br />
Both rtkforwardprojections and rtkbackprojections can use several algorithms to perform the forward or back projections. For forward projections, you can try the following command lines<br />
<br />
<source lang="bash" enclose="div"><br />
rtkforwardprojections -i muCT.mha -o josephProjections.mha -g geometry.xml --fp Joseph --dimension 128 --spacing 2<br />
</source><br />
<source lang="bash" enclose="div"><br />
rtkforwardprojections -i muCT.mha -o rayCastInterpolatorProjections.mha -g geometry.xml --fp RayCastInterpolator --dimension 128 --spacing 2<br />
</source><br />
<br />
And for back projection<br />
<br />
<source lang="bash" enclose="div"><br />
rtkbackprojections -p . -r projections.mha -o voxelBasedBackProjection.mha -g geometry.xml --bp VoxelBasedBackProjection --dimension 128 --spacing 2<br />
</source><br />
<source lang="bash" enclose="div"><br />
rtkbackprojections -p . -r projections.mha -o josephBackProjection.mha -g geometry.xml --bp Joseph --dimension 128 --spacing 2<br />
</source><br />
<source lang="bash" enclose="div"><br />
rtkbackprojections -p . -r projections.mha -o normalizedJosephBackProjection.mha -g geometry.xml --bp NormalizedJoseph --dimension 128 --spacing 2<br />
</source><br />
<br />
If you have a CUDA-capable graphics card, and have compiled RTK with RTK_USE_CUDA=ON, you can also try the following<br />
<br />
<source lang="bash" enclose="div"><br />
rtkforwardprojections -i muCT.mha -o cudaRayCastProjections.mha -g geometry.xml --fp CudaRayCast<br />
</source><br />
<source lang="bash" enclose="div"><br />
rtkbackprojections -p . -r projections.mha -o cudaRayCastBackProjection.mha -g geometry.xml --bp CudaRayCast<br />
</source><br />
<source lang="bash" enclose="div"><br />
rtkbackprojections -p . -r projections.mha -o cudaBackProjection.mha -g geometry.xml --bp CudaBackProjection<br />
</source><br />
<br />
= Pre-processing =<br />
<br />
Pre-process the sequence of real .his projections <br />
* Crop<br />
* Bin<br />
* Median<br />
<br />
= 3D FBP reconstruction =<br />
<br />
== Real ==<br />
<br />
Reconstruct the sequence of (pre-processed) real projections with and without width-truncated correction.<br />
<br />
<source lang="bash" enclose="div"><br />
rtkfdk -p projections -r '.*.his' -o fdk.mha -g geometry.xml --dimension 128 --spacing 2 --binning 4,4<br />
rtkfdk -p projections -r '.*.his' -o fdk_pad.mha -g geometry.xml --dimension 128 --spacing 2 --binning 4,4 --pad 0.5<br />
</source><br />
<br />
== Simulated ==<br />
<br />
Simulate Shepp Logan projections (rtkprojectshepplogan) for a short scan and reconstruct them:<br />
<br />
<source lang="bash" enclose="div"><br />
rtksimulatedgeometry -a 220 -n 110 -o parker.xml<br />
rtkprojectshepploganphantom -g parker.xml --dimension 128 --spacing 2 -o parker.mha --phantomscale 64<br />
rtkfdk -p . -r parker.mha -o fdk_park.mha -g parker.xml --dimension 128<br />
</source><br />
<br />
Idem for width-truncated projections:<br />
<br />
<source lang="bash" enclose="div"><br />
rtksimulatedgeometry -n 110 -o widthtrunc.xml --proj_iso_x 80<br />
rtkprojectshepploganphantom -g widthtrunc.xml --dimension 128 --spacing 2 -o widthtrunc.mha --phantomscale 64<br />
rtkfdk -p . -r widthtrunc.mha -o fdk_wt.mha -g widthtrunc.xml --dimension 128<br />
</source><br />
<br />
<br />
= 3D iterative reconstruction =<br />
<br />
== Creating a very small dataset ==<br />
<br />
Various reconstruction algorithms exist, which employ forward and back projection extensively. We will now start performing real reconstructions using some of the algorithms implemented in RTK. Since these algorithms are computationally much more demanding than the standard FDK, we propose to run them with low resolution data. You will be able to re-compute them at full resolution later, since the present page will remain available to you after the training. Note that, for the regularized reconstruction techniques, you will have to re-tune the regularization parameters yourself, since they depend (among many things) on resolution.<br />
<br />
Convert and preprocess the real projections by running<br />
<br />
<source lang="bash" enclose="div"><br />
rtkprojections -p projections/ -r .*.his -o downsampledProjections.mha --binning "4, 4"<br />
</source><br />
<br />
The '--binning "4, 4"' option downsamples the projections by 4 along both axes. Since this is not enough to reach acceptable reconstruction times for the training, we will build a sub-dataset by selecting only one projection out of 5. You can do this by running <br />
<br />
<source lang="bash" enclose="div"><br />
rtksubselect -p . -r downsampledProjections.mha -g geometry.xml --out_geometry subGeometry.xml --out_proj subProjections.mha -s 5<br />
</source><br />
<br />
This creates a new geometry file and a new projections file, from which even a laptop should be able to perform iterative reconstruction in reasonable time.<br />
<br />
== Unregularized 3D iterative reconstruction algorithms ==<br />
<br />
The most popular iterative reconstruction algorithm is the Simultaneous Algebraic Reconstruction Technique (SART). Try it by running<br />
<br />
<source lang="bash" enclose="div"><br />
rtksart -p . -r subProjections.mha -g subGeometry.xml -o SART.mha --dimension 128 --spacing 3<br />
</source><br />
<br />
Another popular technique uses the conjugate gradient algorithm<br />
<br />
<source lang="bash" enclose="div"><br />
rtkconjugategradient -p . -r subProjections.mha -g subGeometry.xml -o CG.mha --dimension 128 --spacing 3 -n 10<br />
</source><br />
<br />
You can compare the results by running<br />
<br />
<source lang="bash" enclose="div"><br />
vv SART.mha CG.mha --linkall<br />
</source><br />
<br />
The SART reconstruction should be sharper than the conjugate gradient one. If you are interested in understanding the reasons for this difference, try running <br />
<br />
<source lang="bash" enclose="div"><br />
rtksart -p . -r subProjections.mha -g subGeometry.xml -o OSSART_10projsPerSubset.mha --dimension 128 --spacing 3 --nprojpersubset 10<br />
</source><br />
<br />
Visualization is improved when one masks the field-of-view of the reconstruction:<br />
<source lang="bash" enclose="div"><br />
rtkfieldofview -p . -r subProjections.mha -g subGeometry.xml -m -o FOVmask.mha --reconstruction SART.mha <br />
rtkfieldofview -p . -r subProjections.mha -g subGeometry.xml -o SART_masked.mha --reconstruction SART.mha <br />
</source><br />
<br />
The differences in image quality (sharpness, contrast, ...) and convergence speed, stability, ... between the various algorithms may be discussed briefly during the training.<br />
<br />
== Regularized 3D iterative reconstruction algorithms ==<br />
<br />
RTK also includes algorithms that perform regularization during the reconstruction. You can try for example<br />
<br />
<source lang="bash" enclose="div"><br />
rtkadmmtotalvariation -p . -r subProjections.mha -g subGeometry.xml -o admmTV.mha --dimension 128 --spacing 3 -n 10 --beta 1000 --alpha 1<br />
</source><br />
<br />
and<br />
<br />
<source lang="bash" enclose="div"><br />
rtkadmmwavelets -p . -r subProjections.mha -g subGeometry.xml -o admmWavelets.mha --dimension 128 --spacing 3 -n 10 --beta 1000 --alpha 1<br />
</source><br />
<br />
Note that these algorithms have little interest when working with such low resolution data, since most of the noise and artifacts they are meant to remove have already been eliminated by undersampling.<br />
<br />
= 4D iterative reconstruction =<br />
<br />
The 4D reconstruction applications may take a long time to compute. If you do not have a CUDA-capable GPU, you may want to skip them and take the reconstruction results directly from the USB key you received at the beginning of the training. If you do have a CUDA-capable GPU and have compiled RTK with RTK_USE_CUDA=ON, you can add <br />
<br />
<source lang="bash" enclose="div"><br />
--fp CudaRayCast --bp CudaVoxelBased<br />
</source><br />
<br />
to the reconstruction command lines in order to use it.<br />
<br />
== Extracting respiratory phase ==<br />
<br />
RTK includes a tool to extract the phase of respiratory motion from the projection data. It uses an intermediate image built from the stack of projections, called the "shroud". Run<br />
<br />
<source lang="bash" enclose="div"><br />
rtkamsterdamshroud -p . -r .*.his -o shroud.mhd<br />
</source><br />
<br />
and open the shroud image with vv:<br />
<br />
<source lang="bash" enclose="div"><br />
vv shroud.mhd<br />
</source><br />
<br />
You will notice that a periodic signal is visible in the image. Before we try to retrieve this signal's phase, we need to remove the parts of the image affected by low frequency noise. Try<br />
<br />
<source lang="bash" enclose="div"><br />
rtkamsterdamshroud -p . -r .*.his -o cshroud.mhd --lowercrop "0, 270, 0" --upper "0, 112, 0"<br />
</source><br />
<br />
The cropped shroud can be viewed with vv:<br />
<br />
<source lang="bash" enclose="div"><br />
vv cshroud.mhd<br />
</source><br />
<br />
This cropped shroud will be used to extract a phase signal, with another RTK command. Run<br />
<br />
<source lang="bash" enclose="div"><br />
rtkextractshroudsignal -i cshroud.mhd -o signal.txt -p cphase.txt<br />
</source><br />
<br />
If you have Python installed, you can download [http://midas3.kitware.com/midas/download/item/318791/showPeaksOverShroud.py this script] and run it from your working directory. It will generate an image with the cropped shroud in background and the detected minima in foreground, in red.<br />
<br />
== Unregularized iterative 4D reconstruction ==<br />
<br />
RTK includes several algorithms for 4D reconstruction. Similarly to 3D, you can try them with the following commands<br />
<br />
<source lang="bash" enclose="div"><br />
rtkfourdsart -p . -r downsampledProjections.mha -g geometry.xml -o 4DSART.mha --signal cphase.txt --dimension 128 --spacing 3<br />
</source><br />
<source lang="bash" enclose="div"><br />
rtkfourdconjugategradient -p . -r downsampledProjections.mha -g geometry.xml -o 4DCG.mha --signal cphase.txt --dimension 128 --spacing 3<br />
</source><br />
<br />
== Regularized iterative 4D reconstruction ==<br />
<br />
Just like in 3D reconstruction, regularity conditions can be added in 4D reconstruction. Actually, 4D reconstruction even allows more regularization: since the whole respiratory cycle is reconstructed at once, regularization along time can be applied. RTK includes an application to perform regularized 4D reconstruction, called ROOSTER. <br />
It requires a motion mask, which you can download [http://midas3.kitware.com/midas/download/bitstream/457407/mm_50_in_cbct_coordinates.mha here].<br />
You can try ROOSTER by running<br />
<br />
<source lang="bash" enclose="div"><br />
rtkfourdrooster -p . -r downsampledProjections.mha -g geometry.xml -o 4DROOSTER.mha --signal cphase.txt --dimension 128 --spacing 3 --gamma_time 0.0005 --gamma_space 0.0001 --motionmask mm_50_in_cbct_coordinates.mha<br />
</source></div>Cyril.moryhttps://wiki.openrtk.org/index.php?title=SimpleRTK&diff=511SimpleRTK2017-07-11T12:45:28Z<p>Cyril.mory: </p>
<hr />
<div>= Introduction =<br />
SimpleRTK provides a simple interface to RTK in a variety of languages. For now only Python and C# binding have been tested and are supported but other languages should also work, e.g., R, Ruby and Java. SimpleRTK is provided as part of RTK making it easier to configure, build and use. Note that SimpleRTK is derived from the SimpleITK project for the Insight Toolkit, however it is distributed separately and independently.<br />
<br />
= Building RTK with SimpleRTK =<br />
SimpleRTK uses Swig to generate the wrapping for different languages. As the version of Swig should be controlled, SimpleRTK will automatically download the right version of Swig and its dependencies for the different platforms. However you can always point to the installed version of Swig if you'd like to, but this is not recommended. You will need the development libraries of python (python-devel packages) for the compilation of SimpleRTK to succeed.<br />
<br />
Here are the simple steps to build and configure wrapping for RTK:<br />
# Run CMake on RTK as you normally do<br />
# Check the option BUILD_SIMPLERTK (default is OFF)<br />
# Enable WRAP_PYTHON and/or WRAP_CSHARP (On Windows)<br />
# Configure<br />
# Build as usual. Note that building will download the require libraries so you should have an internet connection enabled.<br />
<br />
Note that the configuration and generation step can take some time as CMake has to generate the necessary classes.<br />
<br />
= Python installation =<br />
To install the built python package into the system Python:<br />
<br />
cd SimpleRTK-build/Wrapping<br />
sudo python PythonPackage/setup.py install<br />
<br />
The PYTHONPATH variable must be set appropriately to let Python know where the module is. The PATH variable must be set to let the system find the ITK and RTK libraries.<br />
<br />
If you want to install the built python package to a directory that does not require root privileges (e.g., on a lab cluster), you can specify an install directory, for example with $HOME/mypython and python 2.7:<br />
<br />
mkdir -p $HOME/mypython/lib/python2.7/site-packages<br />
export PYTHONPATH=$HOME/mypython/lib/python2.7/site-packages:$PYTHONPATH<br />
cd SimpleRTK-build/Wrapping<br />
python PythonPackage/setup.py install --prefix=$HOME/mypython<br />
<br />
Alternatively, a Python virtual environment can be created and the distribution installed there.<br />
If you build the "dist" target a Python egg will be created in the "Wrapping/dist" directory. Building Python wheels can be enabled with a CMake flag.<br />
<br />
= Generating Python Wheels =<br />
SimpleRTK can be packaged for PIP (http://pythonwheels.com/). In order to do so, please follow the following instructions:<br />
<br />
== Windows ==<br />
# Compile SimpleRTK as usual<br />
# Open the project solution file in the RTK-bin/SimpleRTK-build/SimpleRTK.sln<br />
# Compile the dist target<br />
# SimpleRTK-*.whl file is generated in the Wrapping/Python/build directory<br />
<br />
== Linux ==<br />
* Compile SimpleRTK as usual<br />
* Run the following commands:<br />
cd RTK-bin/SimpleRTK-build<br />
make dist<br />
* If necessary you might want to use Python virtual environment for generating the packages<br />
ccmake .<br />
Turn SRTK_PYTHON_USE_VIRTUALENV to ON<br />
make<br />
make dist<br />
* The package are generated in the SimpleRTK-build/Wrapping/Python/dist directory<br />
<br />
= Testing SimpleRTK =<br />
A simple example is located in Utilities/SimpleRTK/Examples/RTKFirstReconstruction.py and shows how to use SimpleRTK<br />
<br />
<source lang="python"><br />
#!/usr/bin/env python<br />
from __future__ import print_function<br />
import SimpleRTK as srtk<br />
import sys<br />
import os<br />
import matplotlib.pyplot as plt<br />
import matplotlib.cm as cm<br />
<br />
if len ( sys.argv ) < 2:<br />
print( "Usage: RTKFirstReconstruction <output>" )<br />
sys.exit ( 1 )<br />
<br />
# Defines the RTK geometry object<br />
geometry = srtk.ThreeDCircularProjectionGeometry()<br />
numberOfProjections = 360<br />
firstAngle = 0<br />
angularArc = 360<br />
sid = 600 # source to isocenter distance in mm<br />
sdd = 1200 # source to detector distance in mm<br />
isox = 0 # X coordinate on the projection image of isocenter<br />
isoy = 0 # Y coordinate on the projection image of isocenter<br />
for x in range(0,numberOfProjections):<br />
angle = firstAngle + x * angularArc / numberOfProjections<br />
geometry.AddProjection(sid,sdd,angle,isox,isoy)<br />
<br />
constantImageSource = srtk.ConstantImageSource()<br />
origin = [ -127.5, -127.5, 0. ]<br />
sizeOutput = [ 256, 256, numberOfProjections ]<br />
spacing = [ 1.0, 1.0, 1.0 ]<br />
constantImageSource.SetOrigin( origin )<br />
constantImageSource.SetSpacing( spacing )<br />
constantImageSource.SetSize( sizeOutput )<br />
constantImageSource.SetConstant(0.0)<br />
source = constantImageSource.Execute()<br />
<br />
rei = srtk.RayEllipsoidIntersectionImageFilter()<br />
semiprincipalaxis = [ 50, 50, 50]<br />
center = [ 0, 0, 0]<br />
# Set GrayScale value, axes, center...<br />
rei.SetDensity(20)<br />
rei.SetAngle(0)<br />
rei.SetCenter(center)<br />
rei.SetAxis(semiprincipalaxis)<br />
rei.SetGeometry( geometry )<br />
reiImage = rei.Execute(source)<br />
<br />
# Create reconstructed image<br />
constantImageSource2 = srtk.ConstantImageSource()<br />
origin = [ -63.5, -63.5, -63.5 ]<br />
sizeOutput = [ 128, 128, 128 ]<br />
constantImageSource2.SetOrigin( origin )<br />
constantImageSource2.SetSpacing( spacing )<br />
constantImageSource2.SetSize( sizeOutput )<br />
constantImageSource2.SetConstant(0.0)<br />
source2 = constantImageSource2.Execute()<br />
<br />
print("Performing reconstruction")<br />
feldkamp = srtk.FDKConeBeamReconstructionFilter()<br />
feldkamp.SetGeometry( geometry );<br />
feldkamp.SetTruncationCorrection(0.0);<br />
feldkamp.SetHannCutFrequency(0.0);<br />
image = feldkamp.Execute(source2,reiImage) <br />
<br />
print("Masking field-of-view")<br />
fov = srtk.FieldOfViewImageFilter()<br />
fov.SetGeometry(geometry)<br />
fov.SetProjectionsStack(reiImage)<br />
image = fov.Execute(image)<br />
<br />
plt.imshow(srtk.GetArrayFromImage(image[:,64,:]), cmap = cm.Greys_r)<br />
plt.show()<br />
<br />
writer = srtk.ImageFileWriter()<br />
writer.SetFileName ( sys.argv[1] )<br />
writer.Execute ( image );<br />
</source><br />
<br />
The example displays the central slice of a reconstructed sphere:<br />
<br />
[[File:spherepy.png|600px]]<br />
<br />
= SimpleRTK with SimpleITK =<br />
Even if SimpleRTK is based on SimpleITK, the basic object types (images, transforms) are different and there is no direct compatibility between the two toolkits. However, it is fairly straightforward to pass the image data from RTK to ITK using the following example<br />
<br />
sitk.GetImageFromArray( srtk.GetArrayFromImage( image ) )<br />
<br />
but meta-information (spacing, origin, direction, etc.) is then discarded. If you need the information, you can use the function<br />
<br />
sitkImage.CopyInformation( source )<br />
<br />
= Extending SimpleRTK =<br />
Adding new classes to SimpleRTK should be fairly straightforward. In this section, we cover how to add common types as well as filters. Note that common types should only be added when necessary.<br />
<br />
The file located in Wrapping/SimpleRTK.i is the main SWIG file and new types and manually wrapped files should be added there.<br />
<br />
== Common Type ==<br />
One example is for the ThreeDCircularProjectionGeometry object. The code is located in utilities/SimpleRTK/Code/Common.<br />
This class in the namespace rtk::simple provides a PIMPL class implementation of the object as well as a conversion from SimpleRTK to RTK itself to expose the necessary functions.<br />
<br />
== Filters ==<br />
Filters are implemented using a json description for simplicity. The best way is to look into already wrapped filters in the: utilities/SimpleRTK/Code/BasicFilters/json directory.<br />
<br />
Here we provide a description of the current JSON format.<br />
<source lang="javascript"><br />
{<br />
# Name of the class to be create. This would be prefixed by srtk. <br />
"name" : "FDKConeBeamReconstructionFilter",<br />
<br />
# File that indicates the template to use. This should be RTKImageFilter for image filters<br />
"template_code_filename" : "RTKImageFilter",<br />
<br />
# File that indicates the template to use for the test.<br />
"template_test_filename" : "ImageFilter",<br />
<br />
# Number of inputs to the filter.<br />
"number_of_inputs" : 2,<br />
<br />
# Documentation for the class, if any.<br />
"doc" : "",<br />
<br />
# Type of output image. This creates a typedef OutputImageType. Here we set it to the input image.<br />
"output_image_type" : "TImageType",<br />
<br />
# List of supported Pixel types<br />
"pixel_types" : "RealPixelIDTypeList",<br />
<br />
# Definition of the RTK filter<br />
"filter_type" : "rtk::FDKConeBeamReconstructionFilter<InputImageType>",<br />
<br />
# Array of include files.<br />
"include_files" : [<br />
"srtkThreeDCircularProjectionGeometry.h"<br />
],<br />
</source><br />
<br />
The next section describes the member functions. Each member function has a name and a type.<br />
The Set...() and Get...() functions are automatically generated. <br />
<br />
<source lang="javascript"><br />
"members" : [<br />
{<br />
# Name of the variable to be Set/Get<br />
"name" : "Geometry",<br />
<br />
# Type of the variable<br />
"type" : "ThreeDCircularProjectionGeometry*",<br />
<br />
# Default value of the variable<br />
"default" : "0",<br />
<br />
# Internal Simple RTK type of the function<br />
"itk_type" : "ThreeDCircularProjectionGeometry",<br />
<br />
# Casting from the itk_type to the internal type<br />
"custom_itk_cast" : "filter->SetGeometry( this->m_Geometry->GetRTKBase() );\n",<br />
<br />
# Documentation for the member function<br />
"doc" : "",<br />
"briefdescriptionSet" : "",<br />
"detaileddescriptionSet" : "Set the object pointer to projection geometry.",<br />
"briefdescriptionGet" : "",<br />
"detaileddescriptionGet" : "Get the object pointer to projection geometry."<br />
}<br />
],<br />
</source><br />
<br />
At the end of the file we add the description of the class for documentation purposes.<br />
<br />
<source lang="javascript"><br />
"briefdescription" : "Brief description of the filter",<br />
"detaileddescription" : "Detailed description of the filter"<br />
}<br />
</source><br />
<br />
'''Note that you might need to rebuild the solution in order for CMake to take the changes into account.''' Another solution is to manually delete the file SimpleRTK-prefix/src/SimpleRTK-stamp/SimpleRTK-configure.<br />
The code generated is located in the "SimpleRTK-build/Code/BasicFilters" of your build tree.<br />
<br />
= Matlab =<br />
SimpleRTK does not include Matlab wrappings. However, Matlab allows [http://fr.mathworks.com/help/matlab/call-python-libraries.html calling Python libraries] since recent versions. This is a simple example written to simulate and display a sinogram in Matlab:<br />
<br />
<source lang="matlab"><br />
g = py.SimpleRTK.ThreeDCircularProjectionGeometry();<br />
for i=0:359,<br />
g.AddProjection(500,1000,i);<br />
end<br />
<br />
size = [512,1,360];<br />
<br />
const = py.SimpleRTK.ConstantImageSource();<br />
const.SetSpacing(py.list([1,1,1]))<br />
const.SetSize(py.list(int32(size)))<br />
const.SetOrigin(py.list([-255.5,0,0]))<br />
proj = const.Execute()<br />
<br />
sl = py.SimpleRTK.SheppLoganPhantomFilter()<br />
sl.SetPhantomScale(80)<br />
sl.SetGeometry(g)<br />
proj = sl.Execute(proj)<br />
npproj = py.SimpleRTK.GetArrayFromImage(proj)<br />
<br />
proj = double(py.array.array('d', npproj.flatten()));<br />
<br />
imagesc(squeeze(reshape(proj, size)))<br />
colormap gray<br />
</source></div>Cyril.moryhttps://wiki.openrtk.org/index.php?title=RTK/Examples/4DROOSTERReconstruction&diff=473RTK/Examples/4DROOSTERReconstruction2016-02-18T10:27:32Z<p>Cyril.mory: /* Motion-Aware 4D ROOSTER (MA-ROOSTER) */</p>
<hr />
<div>RTK provides a tool to reconstruct a 3D + time image which does not require explicit motion estimation. Instead, it uses total variation regularization along both space and time. The implementation is based on a paper that we have published ([http://www.creatis.insa-lyon.fr/site/fr/publications/MORY-14 article]). You should read the article to understand the basics of the algorithm before trying to use the software.<br />
<br />
The algorithm requires a set of projection images with the associated RTK geometry, the respiratory phase of each projection image and a motion mask in which the region of the space where movement is expected is set to 1 and the rest is set to 0. Each piece of data is described in more details below and can be downloaded from [http://midas3.kitware.com/midas/folder/10278 MIDAS]. It is assumed that the breathing motion is periodic, which implies that the mechanical state of the chest depends only on the respiratory phase.<br />
<br />
= Projection images =<br />
<br />
This example is illustrated with a set of projection images of the [http://www.creatis.insa-lyon.fr/rio/popi-model_original_page POPI patient]. You can [http://midas3.kitware.com/midas/download/item/208648/projections.tgz download the projections] and the required tables of the Elekta database, [http://midas3.kitware.com/midas/download/item/208650/FRAME.DBF FRAME.DBF] and [http://midas3.kitware.com/midas/download/item/208649/IMAGE.DBF IMAGE.DBF]. The dataset is first used to reconstruct a blurry image:<br />
<br />
<source lang="bash"><br />
# Convert Elekta database to RTK geometry<br />
rtkelektasynergygeometry \<br />
-o geometry.rtk \<br />
-f FRAME.DBF \<br />
-i IMAGE.DBF \<br />
-u 1.3.46.423632.141000.1169042526.68<br />
<br />
# Reconstruct a 3D volume from all projection images. <br />
# We implicitly assume that the patient's chest is static, which is wrong. <br />
# Therefore the reconstruction will be blurry. This blurry reconstruction is <br />
# not required for 4D ROOSTER, but there is usually no other way to generate <br />
# a motion mask, which is required. Additionally, the blurry reconstruction <br />
# can be used to initialize the 4D ROOSTER reconstruction. <br />
rtkfdk \<br />
-p . \<br />
-r .*.his \<br />
-o fdk.mha \<br />
-g geometry.rtk \<br />
--hann 0.5 \<br />
--pad 1.0 \<br />
--dimension 160 \<br />
--spacing 2<br />
<br />
</source><br />
<br />
You should obtain something like that with [http://vv.creatis.insa-lyon.fr/ VV]:<br />
<br />
[[File:blurred.jpg]]<br />
<br />
= Motion mask =<br />
<br />
The next piece of data is a 3D motion mask: a volume that contains only zeros, where no movement is expected to occur, and ones, where movement is expected. Typically, during breathing, the whole chest moves, so it is safe to use the [http://midas3.kitware.com/midas/download/item/318731/PatientMask.mha patient mask] (red+green). However, restricting the movement to a smaller region, e.g. the rib cage, can help reconstruct this region more accurately and mitigate artifacts, so we might want to use the [http://midas3.kitware.com/midas/download/item/318730/MotionMask.mha rib cage mask] (red):<br />
<br />
[[File:mm.jpg]]<br />
<br />
= Respiratory signal =<br />
<br />
The 4D ROOSTER algorithm requires that we associate each projection image with the instant of the respiratory cycle at which it has been acquired. We used the Amsterdam shroud solution of Lambert Zijp (described [http://www.creatis.insa-lyon.fr/site/fr/publications/RIT-12a here]) which is implemented in RTK<br />
<br />
<source lang="bash"><br />
rtkamsterdamshroud --path . \<br />
--regexp '.*.his' \<br />
--output shroud.mha \<br />
--unsharp 650<br />
rtkextractshroudsignal --input shroud.mha \<br />
--output signal.txt \<br />
--phase sphase.txt<br />
</source><br />
<br />
to get the phase signal. Note that the phase must go from 0 to 1 where 0.3 corresponds to 30% in the respiratory cycle, i.e., frame 3 if you have a 10-frames 4D reconstruction or frame 6 if you have a 20-frames 4D reconstruction. The [http://midas3.kitware.com/midas/download/item/208655/sphase.txt resulting phase] is in green on top of the blue respiratory signal and the detected end-exhale peaks:<br />
<br />
[[File:signal.gif]]<br />
<br />
= 4D ROOSTER for cone-beam CT reconstruction =<br />
<br />
We now have all the pieces to perform a 3D + time reconstruction. The algorithm will perform "niter" iterations of the main loop, and run three inner loops at each iteration:<br />
* conjugate gradient reconstruction with "cgiter" iterations<br />
* total-variation regularization in space, with parameter "gamma_space" (the higher, the more regularized) and "tviter" iterations<br />
* total-variation regularization in time, with parameter "gamma_time" (the higher, the more regularized) and "tviter" iterations<br />
The number of iterations suggested here should work in most situations. The parameters gamma_space and gamma_time, on the other hand, must be adjusted carefully for each type of datasets (and, unfortunately, for each resolution). Unlike in analytical reconstruction methods like FDK, with 4D ROOSTER it is also very important that the reconstruction volume contains the whole patient's chest. You should therefore adapt the "dimension", "spacing" and "origin" parameters carefully, based on what you have observed on the blurry FDK reconstruction.<br />
<br />
<source lang="bash"><br />
# Reconstruct from all projection images with 4D ROOSTER<br />
rtkfourdrooster \<br />
-p . \<br />
-r .*.his \<br />
-o rooster.mha \<br />
-g geometry.rtk \<br />
--signal sphase.txt \ <br />
--motionmask MotionMask.mha \<br />
--gamma_time 0.0001 \<br />
--gamma_space 0.0001 \<br />
--niter 30 \<br />
--cgiter 4 \<br />
--tviter 10 \<br />
--spacing 2 \<br />
--dimension 160 \<br />
--frames 5<br />
</source><br />
<br />
Depending on the resolution you choose, and even on powerful computers, the reconstruction time can range from a few minutes (very low resolution, typically 32³ * 5, only for tests) to many hours (standard resolution, typically 256³ * 10). To speed things up, it is recommended to use the CUDA version of the forward and back projectors by running this command instead:<br />
<br />
<source lang="bash"><br />
# Reconstruct from all projection images with 4D ROOSTER, using CUDA forward and back projectors<br />
rtkfourdrooster \<br />
-p . \<br />
-r .*.his \<br />
-o rooster.mha \<br />
-g geometry.rtk \<br />
--signal sphase.txt \ <br />
--motionmask MotionMask.mha \<br />
--fp CudaRayCast \<br />
--bp CudaVoxelBased \<br />
--gamma_time 0.0001 \<br />
--gamma_space 0.0001 \<br />
--niter 30 \<br />
--cgiter 4 \<br />
--tviter 10 \<br />
--spacing 2 \<br />
--dimension 160 \<br />
--frames 5<br />
</source><br />
<br />
With a recent GPU, this should allow you to perform a standard resolution reconstruction in less than one hour.<br />
<br />
Note that the reconstructed volume in this example does not fully contain the attenuating object, causing hyper-attenuation artifacts on the borders of the result. To avoid these artifacts, reconstruct a larger volume (--dimension 256) should be fine. Note that you will have to resize your motion mask as well, as 3D the motion mask is expected to have the same size, spacing and origin as the first 3 dimensions of the 4D output.<br />
<br />
= Motion-Aware 4D ROOSTER (MA-ROOSTER) =<br />
<br />
4D ROOSTER doesn't require explicit motion information, but can take advantage of it to guide TV-regularization if motion information is available. Please refer to the tutorial on Motion-Compensated FDK to learn how to obtain a valid 4D Displacement Vector Field (DVF). Once you have it, simply adding the option --dvf "4D_DVF_Filename" to the list of rtkfourdrooster arguments will run MA-ROOSTER instead of 4D ROOSTER. <br />
<br />
<source lang="bash"><br />
# Reconstruct from all projection images with MA ROOSTER<br />
rtkfourdrooster \<br />
-p . \<br />
-r .*.his \<br />
-o rooster.mha \<br />
-g geometry.rtk \<br />
--signal sphase.txt \ <br />
--motionmask MotionMask.mha \<br />
--gamma_time 0.0001 \<br />
--gamma_space 0.0001 \<br />
--niter 30 \<br />
--cgiter 4 \<br />
--tviter 10 \<br />
--spacing 2 \<br />
--dimension 160 \<br />
--frames 5 \<br />
--dvf deformationField_4D.mhd<br />
</source><br />
<br />
Making use of the motion information adds to computation time. If you have compiled RTK with RTK_USE_CUDA = ON and have a working and CUDA-enabled nVidia GPU, it will automatically be used to speed up that part of the process.<br />
<br />
The article in which the theoretical foundations of MA-ROOSTER are presented (link to be added) contains results obtained on two patients. If you wish to reproduce these results, you can download all the necessary data here:<br />
* Original projections, log-transformed projections with the table removed, motion mask, respiratory signal, and transform matrices to change from CT to CBCT coordinates and back<br />
** [https://midas3.kitware.com/midas/download/item/319553/CBCT.zip Patient 1]<br />
** [https://midas3.kitware.com/midas/download/item/319557/CBCT.zip Patient 2]<br />
* Inverse-consistent 4D Displacement Vector Fields, to the end-exhale phase and from the end-exhale phase<br />
** [https://midas3.kitware.com/midas/download/item/319554/DVFs.zip Patient 1]<br />
** [https://midas3.kitware.com/midas/download/item/319555/DVFs.zip Patient 2]<br />
<br />
Extract the data of each patient in a separate folder. From the folder containing the data of patient 1, run the following command line:<br />
<br />
<source lang="bash"><br />
# Reconstruct patient 1 with MA ROOSTER<br />
rtkfourdrooster \<br />
-p . \<br />
-r correctedProjs.mha \<br />
-o marooster.mha \<br />
-g geom.xml \<br />
--signal cphase.txt \ <br />
--motionmask dilated_resampled_mm.mhd \<br />
--gamma_time 0.0002 \<br />
--gamma_space 0.00005 \<br />
--niter 10 \<br />
--cgiter 4 \<br />
--tviter 10 \<br />
--spacing "1, 1, 1, 1" \<br />
--dimension "220, 280, 370, 10" \<br />
--origin "-140, -140, -75, 0" \<br />
--frames 10 \<br />
--dvf toPhase50_4D.mhd \<br />
--idvf fromPhase50_4D.mhd<br />
</source><br />
<br />
From the folder containing the data of patient 2, run the following command line (only the dimension and origin parameters are different):<br />
<br />
<source lang="bash"><br />
# Reconstruct patient 2 with MA ROOSTER<br />
rtkfourdrooster \<br />
-p . \<br />
-r correctedProjs.mha \<br />
-o marooster.mha \<br />
-g geom.xml \<br />
--signal cphase.txt \ <br />
--motionmask dilated_resampled_mm.mhd \<br />
--gamma_time 0.0002 \<br />
--gamma_space 0.00005 \<br />
--niter 10 \<br />
--cgiter 4 \<br />
--tviter 10 \<br />
--spacing "1, 1, 1, 1" \<br />
--dimension "285, 270, 307, 10" \<br />
--origin "-167.5, -135, -205, 0" \<br />
--frames 10 \<br />
--dvf toPhase50_4D.mhd \<br />
--idvf fromPhase50_4D.mhd<br />
</source><br />
<br />
Note the option "--idvf", which allows to provide the inverse DVF. It is used to inverse warp the 4D reconstruction after the temporal regularization. MA-ROOSTER will work with and without the inverse DVF, and yield almost the same results in both cases. Not using the inverse DVF is approximately two times slower, as it requires MA-ROOSTER to perform the inverse warping by an iterative method.<br />
<br />
Again, if you have a CUDA-enabled GPU (in this case with at least 3 GB of VRAM), and have compiled RTK with RTK_USE_CUDA = ON, you can add the "--bp CudaVoxelBased" and "--fp CudaRayCast" to speed up the computation by performing the forward and back projections on the GPU.<br />
<br />
You do not need the 4D planning CT data to perform the MA-ROOSTER reconstructions. It is only required to compute the DVFs, which can be downloaded above. We do provide it anyway, in case you want to use your own method, or the one described in Motion-Compensated FDK, to extract a DVF from it:<br />
* 4D planning CT<br />
** [https://midas3.kitware.com/midas/download/item/319552/planningCT.zip Patient 1]<br />
** [https://midas3.kitware.com/midas/download/item/319556/planningCT.zip Patient 2]</div>Cyril.moryhttps://wiki.openrtk.org/index.php?title=RTK/Examples/4DROOSTERReconstruction&diff=472RTK/Examples/4DROOSTERReconstruction2016-02-18T10:26:40Z<p>Cyril.mory: </p>
<hr />
<div>RTK provides a tool to reconstruct a 3D + time image which does not require explicit motion estimation. Instead, it uses total variation regularization along both space and time. The implementation is based on a paper that we have published ([http://www.creatis.insa-lyon.fr/site/fr/publications/MORY-14 article]). You should read the article to understand the basics of the algorithm before trying to use the software.<br />
<br />
The algorithm requires a set of projection images with the associated RTK geometry, the respiratory phase of each projection image and a motion mask in which the region of the space where movement is expected is set to 1 and the rest is set to 0. Each piece of data is described in more details below and can be downloaded from [http://midas3.kitware.com/midas/folder/10278 MIDAS]. It is assumed that the breathing motion is periodic, which implies that the mechanical state of the chest depends only on the respiratory phase.<br />
<br />
= Projection images =<br />
<br />
This example is illustrated with a set of projection images of the [http://www.creatis.insa-lyon.fr/rio/popi-model_original_page POPI patient]. You can [http://midas3.kitware.com/midas/download/item/208648/projections.tgz download the projections] and the required tables of the Elekta database, [http://midas3.kitware.com/midas/download/item/208650/FRAME.DBF FRAME.DBF] and [http://midas3.kitware.com/midas/download/item/208649/IMAGE.DBF IMAGE.DBF]. The dataset is first used to reconstruct a blurry image:<br />
<br />
<source lang="bash"><br />
# Convert Elekta database to RTK geometry<br />
rtkelektasynergygeometry \<br />
-o geometry.rtk \<br />
-f FRAME.DBF \<br />
-i IMAGE.DBF \<br />
-u 1.3.46.423632.141000.1169042526.68<br />
<br />
# Reconstruct a 3D volume from all projection images. <br />
# We implicitly assume that the patient's chest is static, which is wrong. <br />
# Therefore the reconstruction will be blurry. This blurry reconstruction is <br />
# not required for 4D ROOSTER, but there is usually no other way to generate <br />
# a motion mask, which is required. Additionally, the blurry reconstruction <br />
# can be used to initialize the 4D ROOSTER reconstruction. <br />
rtkfdk \<br />
-p . \<br />
-r .*.his \<br />
-o fdk.mha \<br />
-g geometry.rtk \<br />
--hann 0.5 \<br />
--pad 1.0 \<br />
--dimension 160 \<br />
--spacing 2<br />
<br />
</source><br />
<br />
You should obtain something like that with [http://vv.creatis.insa-lyon.fr/ VV]:<br />
<br />
[[File:blurred.jpg]]<br />
<br />
= Motion mask =<br />
<br />
The next piece of data is a 3D motion mask: a volume that contains only zeros, where no movement is expected to occur, and ones, where movement is expected. Typically, during breathing, the whole chest moves, so it is safe to use the [http://midas3.kitware.com/midas/download/item/318731/PatientMask.mha patient mask] (red+green). However, restricting the movement to a smaller region, e.g. the rib cage, can help reconstruct this region more accurately and mitigate artifacts, so we might want to use the [http://midas3.kitware.com/midas/download/item/318730/MotionMask.mha rib cage mask] (red):<br />
<br />
[[File:mm.jpg]]<br />
<br />
= Respiratory signal =<br />
<br />
The 4D ROOSTER algorithm requires that we associate each projection image with the instant of the respiratory cycle at which it has been acquired. We used the Amsterdam shroud solution of Lambert Zijp (described [http://www.creatis.insa-lyon.fr/site/fr/publications/RIT-12a here]) which is implemented in RTK<br />
<br />
<source lang="bash"><br />
rtkamsterdamshroud --path . \<br />
--regexp '.*.his' \<br />
--output shroud.mha \<br />
--unsharp 650<br />
rtkextractshroudsignal --input shroud.mha \<br />
--output signal.txt \<br />
--phase sphase.txt<br />
</source><br />
<br />
to get the phase signal. Note that the phase must go from 0 to 1 where 0.3 corresponds to 30% in the respiratory cycle, i.e., frame 3 if you have a 10-frames 4D reconstruction or frame 6 if you have a 20-frames 4D reconstruction. The [http://midas3.kitware.com/midas/download/item/208655/sphase.txt resulting phase] is in green on top of the blue respiratory signal and the detected end-exhale peaks:<br />
<br />
[[File:signal.gif]]<br />
<br />
= 4D ROOSTER for cone-beam CT reconstruction =<br />
<br />
We now have all the pieces to perform a 3D + time reconstruction. The algorithm will perform "niter" iterations of the main loop, and run three inner loops at each iteration:<br />
* conjugate gradient reconstruction with "cgiter" iterations<br />
* total-variation regularization in space, with parameter "gamma_space" (the higher, the more regularized) and "tviter" iterations<br />
* total-variation regularization in time, with parameter "gamma_time" (the higher, the more regularized) and "tviter" iterations<br />
The number of iterations suggested here should work in most situations. The parameters gamma_space and gamma_time, on the other hand, must be adjusted carefully for each type of datasets (and, unfortunately, for each resolution). Unlike in analytical reconstruction methods like FDK, with 4D ROOSTER it is also very important that the reconstruction volume contains the whole patient's chest. You should therefore adapt the "dimension", "spacing" and "origin" parameters carefully, based on what you have observed on the blurry FDK reconstruction.<br />
<br />
<source lang="bash"><br />
# Reconstruct from all projection images with 4D ROOSTER<br />
rtkfourdrooster \<br />
-p . \<br />
-r .*.his \<br />
-o rooster.mha \<br />
-g geometry.rtk \<br />
--signal sphase.txt \ <br />
--motionmask MotionMask.mha \<br />
--gamma_time 0.0001 \<br />
--gamma_space 0.0001 \<br />
--niter 30 \<br />
--cgiter 4 \<br />
--tviter 10 \<br />
--spacing 2 \<br />
--dimension 160 \<br />
--frames 5<br />
</source><br />
<br />
Depending on the resolution you choose, and even on powerful computers, the reconstruction time can range from a few minutes (very low resolution, typically 32³ * 5, only for tests) to many hours (standard resolution, typically 256³ * 10). To speed things up, it is recommended to use the CUDA version of the forward and back projectors by running this command instead:<br />
<br />
<source lang="bash"><br />
# Reconstruct from all projection images with 4D ROOSTER, using CUDA forward and back projectors<br />
rtkfourdrooster \<br />
-p . \<br />
-r .*.his \<br />
-o rooster.mha \<br />
-g geometry.rtk \<br />
--signal sphase.txt \ <br />
--motionmask MotionMask.mha \<br />
--fp CudaRayCast \<br />
--bp CudaVoxelBased \<br />
--gamma_time 0.0001 \<br />
--gamma_space 0.0001 \<br />
--niter 30 \<br />
--cgiter 4 \<br />
--tviter 10 \<br />
--spacing 2 \<br />
--dimension 160 \<br />
--frames 5<br />
</source><br />
<br />
With a recent GPU, this should allow you to perform a standard resolution reconstruction in less than one hour.<br />
<br />
Note that the reconstructed volume in this example does not fully contain the attenuating object, causing hyper-attenuation artifacts on the borders of the result. To avoid these artifacts, reconstruct a larger volume (--dimension 256) should be fine. Note that you will have to resize your motion mask as well, as 3D the motion mask is expected to have the same size, spacing and origin as the first 3 dimensions of the 4D output.<br />
<br />
= Motion-Aware 4D ROOSTER (MA-ROOSTER) =<br />
<br />
4D ROOSTER doesn't require explicit motion information, but can take advantage of it to guide TV-regularization if motion information is available. Please refer to the tutorial on Motion-Compensated FDK to learn how to obtain a valid 4D Displacement Vector Field (DVF). Once you have it, simply adding the option --dvf "4D_DVF_Filename" to the list of rtkfourdrooster arguments will run MA-ROOSTER instead of 4D ROOSTER. <br />
<br />
<source lang="bash"><br />
# Reconstruct from all projection images with MA ROOSTER<br />
rtkfourdrooster \<br />
-p . \<br />
-r .*.his \<br />
-o rooster.mha \<br />
-g geometry.rtk \<br />
--signal sphase.txt \ <br />
--motionmask MotionMask.mha \<br />
--gamma_time 0.0001 \<br />
--gamma_space 0.0001 \<br />
--niter 30 \<br />
--cgiter 4 \<br />
--tviter 10 \<br />
--spacing 2 \<br />
--dimension 160 \<br />
--frames 5 \<br />
--dvf deformationField_4D.mhd<br />
</source><br />
<br />
Making use of the motion information adds to computation time. If you have compiled RTK with RTK_USE_CUDA = ON and have a working and CUDA-enabled nVidia GPU, it will automatically be used to speed up that part of the process.<br />
<br />
The article in which the theoretical foundations of MA-ROOSTER are presented (link to be added) contains results obtained on two patients. If you wish to reproduce these results, you can download all the necessary data here:<br />
* Original projections, log-transformed projections with the table removed, motion mask, respiratory signal, and transform matrices to change from CT to CBCT coordinates and back<br />
** [https://midas3.kitware.com/midas/download/item/319553/CBCT.zip Patient 1]<br />
** [https://midas3.kitware.com/midas/download/item/319557/CBCT.zip Patient 2]<br />
* Inverse-consistent 4D Displacement Vector Fields, to the end-exhale phase and from the end-exhale phase<br />
** [https://midas3.kitware.com/midas/download/item/319554/DVFs.zip Patient 1]<br />
** [https://midas3.kitware.com/midas/download/item/319555/DVFs.zip Patient 2]<br />
<br />
Extract the data of each patient in a separate folder. From the folder containing the data of patient 1, run the following command line:<br />
<br />
<source lang="bash"><br />
# Reconstruct patient 1 with MA ROOSTER<br />
rtkfourdrooster \<br />
-p . \<br />
-r correctedProjs.mha \<br />
-o marooster.mha \<br />
-g geom.xml \<br />
--signal cphase.txt \ <br />
--motionmask dilated_resampled_mm.mhd \<br />
--gamma_time 0.0002 \<br />
--gamma_space 0.00005 \<br />
--niter 10 \<br />
--cgiter 4 \<br />
--tviter 10 \<br />
--spacing "1, 1, 1, 1" \<br />
--dimension "220, 280, 370, 10" \<br />
--origin "-140, -140, -75, 0" \<br />
--frames 10 \<br />
--dvf toPhase50_4D.mhd \<br />
--idvf fromPhase50_4D.mhd<br />
</source><br />
<br />
From the folder containing the data of patient 2, run the following command line (only the dimension and origin parameters are different):<br />
<br />
<source lang="bash"><br />
# Reconstruct patient 2 with MA ROOSTER<br />
rtkfourdrooster \<br />
-p . \<br />
-r correctedProjs.mha \<br />
-o marooster.mha \<br />
-g geom.xml \<br />
--signal cphase.txt \ <br />
--motionmask dilated_resampled_mm.mhd \<br />
--gamma_time 0.0002 \<br />
--gamma_space 0.00005 \<br />
--niter 10 \<br />
--cgiter 4 \<br />
--tviter 10 \<br />
--spacing "1, 1, 1, 1" \<br />
--dimension "285, 270, 307, 10" \<br />
--origin "-167.5, -135, -205, 0" \<br />
--frames 10 \<br />
--dvf toPhase50_4D.mhd \<br />
--idvf fromPhase50_4D.mhd<br />
</source><br />
<br />
Note the new option "--idvf", which allows to provide the inverse DVF. It is used to inverse warp the 4D reconstruction after the temporal regularization. MA-ROOSTER will work with and without the inverse DVF, and yield almost the same results in both cases. Not using the inverse DVF is approximately two times slower, as it requires MA-ROOSTER to perform the inverse warping by an iterative method.<br />
<br />
Again, if you have a CUDA-enabled GPU (in this case with at least 3 GB of VRAM), and have compiled RTK with RTK_USE_CUDA = ON, you can add the "--bp CudaVoxelBased" and "--fp CudaRayCast" to speed up the computation by performing the forward and back projections on the GPU.<br />
<br />
You do not need the 4D planning CT data to perform the MA-ROOSTER reconstructions. It is only required to compute the DVFs, which can be downloaded above. We do provide it anyway, in case you want to use your own method, or the one described in Motion-Compensated FDK, to extract a DVF from it:<br />
* 4D planning CT<br />
** [https://midas3.kitware.com/midas/download/item/319552/planningCT.zip Patient 1]<br />
** [https://midas3.kitware.com/midas/download/item/319556/planningCT.zip Patient 2]</div>Cyril.moryhttps://wiki.openrtk.org/index.php?title=RTK/Examples/4DROOSTERReconstruction&diff=471RTK/Examples/4DROOSTERReconstruction2016-02-18T10:18:37Z<p>Cyril.mory: /* Motion-Aware 4D ROOSTER (MA-ROOSTER) */</p>
<hr />
<div>RTK provides a tool to reconstruct a 3D + time image which does not require explicit motion estimation. Instead, it uses total variation regularization along both space and time. The implementation is based on a paper that we have published ([http://www.creatis.insa-lyon.fr/site/fr/publications/MORY-14 article]). You should read the article to understand the basics of the algorithm before trying to use the software.<br />
<br />
The algorithm requires a set of projection images with the associated RTK geometry, the respiratory phase of each projection image and a motion mask in which the region of the space where movement is expected is set to 1 and the rest is set to 0. Each piece of data is described in more details below and can be downloaded from [http://midas3.kitware.com/midas/folder/10278 MIDAS]. It is assumed that the breathing motion is periodic, which implies that the mechanical state of the chest depends only on the respiratory phase.<br />
<br />
= Projection images =<br />
<br />
This example is illustrated with a set of projection images of the [http://www.creatis.insa-lyon.fr/rio/popi-model_original_page POPI patient]. You can [http://midas3.kitware.com/midas/download/item/208648/projections.tgz download the projections] and the required tables of the Elekta database, [http://midas3.kitware.com/midas/download/item/208650/FRAME.DBF FRAME.DBF] and [http://midas3.kitware.com/midas/download/item/208649/IMAGE.DBF IMAGE.DBF]. The dataset is first used to reconstruct a blurry image:<br />
<br />
<source lang="bash"><br />
# Convert Elekta database to RTK geometry<br />
rtkelektasynergygeometry \<br />
-o geometry.rtk \<br />
-f FRAME.DBF \<br />
-i IMAGE.DBF \<br />
-u 1.3.46.423632.141000.1169042526.68<br />
<br />
# Reconstruct a 3D volume from all projection images. <br />
# We implicitly assume that the patient's chest is static, which is wrong. <br />
# Therefore the reconstruction will be blurry. This blurry reconstruction is <br />
# not required for 4D ROOSTER, but there is usually no other way to generate <br />
# a motion mask, which is required. Additionally, the blurry reconstruction <br />
# can be used to initialize the 4D ROOSTER reconstruction. <br />
rtkfdk \<br />
-p . \<br />
-r .*.his \<br />
-o fdk.mha \<br />
-g geometry.rtk \<br />
--hann 0.5 \<br />
--pad 1.0 \<br />
--dimension 160 \<br />
--spacing 2<br />
<br />
</source><br />
<br />
You should obtain something like that with [http://vv.creatis.insa-lyon.fr/ VV]:<br />
<br />
[[File:blurred.jpg]]<br />
<br />
= Motion mask =<br />
<br />
The next piece of data is a 3D motion mask: a volume that contains only zeros, where no movement is expected to occur, and ones, where movement is expected. Typically, during breathing, the whole chest moves, so it is safe to use the [http://midas3.kitware.com/midas/download/item/318731/PatientMask.mha patient mask] (red+green). However, restricting the movement to a smaller region, e.g. the rib cage, can help reconstruct this region more accurately and mitigate artifacts, so we might want to use the [http://midas3.kitware.com/midas/download/item/318730/MotionMask.mha rib cage mask] (red):<br />
<br />
[[File:mm.jpg]]<br />
<br />
= Respiratory signal =<br />
<br />
The 4D ROOSTER algorithm requires that we associate each projection image with the instant of the respiratory cycle at which it has been acquired. We used the Amsterdam shroud solution of Lambert Zijp (described [http://www.creatis.insa-lyon.fr/site/fr/publications/RIT-12a here]) which is implemented in RTK<br />
<br />
<source lang="bash"><br />
rtkamsterdamshroud --path . \<br />
--regexp '.*.his' \<br />
--output shroud.mha \<br />
--unsharp 650<br />
rtkextractshroudsignal --input shroud.mha \<br />
--output signal.txt \<br />
--phase sphase.txt<br />
</source><br />
<br />
to get the phase signal. Note that the phase must go from 0 to 1 where 0.3 corresponds to 30% in the respiratory cycle, i.e., frame 3 if you have a 10-frames 4D reconstruction or frame 6 if you have a 20-frames 4D reconstruction. The [http://midas3.kitware.com/midas/download/item/208655/sphase.txt resulting phase] is in green on top of the blue respiratory signal and the detected end-exhale peaks:<br />
<br />
[[File:signal.gif]]<br />
<br />
= 4D ROOSTER for cone-beam CT reconstruction =<br />
<br />
We now have all the pieces to perform a 3D + time reconstruction. The algorithm will perform "niter" iterations of the main loop, and run three inner loops at each iteration:<br />
* conjugate gradient reconstruction with "cgiter" iterations<br />
* total-variation regularization in space, with parameter "gamma_space" (the higher, the more regularized) and "tviter" iterations<br />
* total-variation regularization in time, with parameter "gamma_time" (the higher, the more regularized) and "tviter" iterations<br />
The number of iterations suggested here should work in most situations. The parameters gamma_space and gamma_time, on the other hand, must be adjusted carefully for each type of datasets (and, unfortunately, for each resolution). Unlike in analytical reconstruction methods like FDK, with 4D ROOSTER it is also very important that the reconstruction volume contains the whole patient's chest. You should therefore adapt the "dimension", "spacing" and "origin" parameters carefully, based on what you have observed on the blurry FDK reconstruction.<br />
<br />
<source lang="bash"><br />
# Reconstruct from all projection images with 4D ROOSTER<br />
rtkfourdrooster \<br />
-p . \<br />
-r .*.his \<br />
-o rooster.mha \<br />
-g geometry.rtk \<br />
--signal sphase.txt \ <br />
--motionmask MotionMask.mha \<br />
--gamma_time 0.0001 \<br />
--gamma_space 0.0001 \<br />
--niter 30 \<br />
--cgiter 4 \<br />
--tviter 10 \<br />
--spacing 2 \<br />
--dimension 160 \<br />
--frames 5<br />
</source><br />
<br />
Depending on the resolution you choose, and even on powerful computers, the reconstruction time can range from a few minutes (very low resolution, typically 32³ * 5, only for tests) to many hours (standard resolution, typically 256³ * 10). To speed things up, it is recommended to use the CUDA version of the forward and back projectors by running this command instead:<br />
<br />
<source lang="bash"><br />
# Reconstruct from all projection images with 4D ROOSTER, using CUDA forward and back projectors<br />
rtkfourdrooster \<br />
-p . \<br />
-r .*.his \<br />
-o rooster.mha \<br />
-g geometry.rtk \<br />
--signal sphase.txt \ <br />
--motionmask MotionMask.mha \<br />
--fp CudaRayCast \<br />
--bp CudaVoxelBased \<br />
--gamma_time 0.0001 \<br />
--gamma_space 0.0001 \<br />
--niter 30 \<br />
--cgiter 4 \<br />
--tviter 10 \<br />
--spacing 2 \<br />
--dimension 160 \<br />
--frames 5<br />
</source><br />
<br />
With a recent GPU, this should allow you to perform a standard resolution reconstruction in less than one hour.<br />
<br />
Note that the reconstructed volume in this example does not fully contain the attenuating object, causing hyper-attenuation artifacts on the borders of the result. To avoid these artifacts, reconstruct a larger volume (--dimension 256) should be fine. Note that you will have to resize your motion mask as well, as 3D the motion mask is expected to have the same size, spacing and origin as the first 3 dimensions of the 4D output.<br />
<br />
= Motion-Aware 4D ROOSTER (MA-ROOSTER) =<br />
<br />
4D ROOSTER doesn't require explicit motion information, but can take advantage of it to guide TV-regularization if motion information is available. Please refer to the tutorial on Motion-Compensated FDK to learn how to obtain a valid 4D Displacement Vector Field (DVF). Once you have it, simply adding the option --dvf "4D_DVF_Filename" to the list of rtkfourdrooster arguments will run MA-ROOSTER instead of 4D ROOSTER. <br />
<br />
<source lang="bash"><br />
# Reconstruct from all projection images with MA ROOSTER<br />
rtkfourdrooster \<br />
-p . \<br />
-r .*.his \<br />
-o rooster.mha \<br />
-g geometry.rtk \<br />
--signal sphase.txt \ <br />
--motionmask MotionMask.mha \<br />
--gamma_time 0.0001 \<br />
--gamma_space 0.0001 \<br />
--niter 30 \<br />
--cgiter 4 \<br />
--tviter 10 \<br />
--spacing 2 \<br />
--dimension 160 \<br />
--frames 5 \<br />
--dvf deformationField_4D.mhd<br />
</source><br />
<br />
Making use of the motion information adds to computation time. If you have compiled RTK with RTK_USE_CUDA = ON and have a working and CUDA-enabled nVidia GPU, it will automatically be used to speed up that part of the process.<br />
<br />
The article in which the theoretical foundations of MA-ROOSTER are presented (link to be added) contains results obtained on two patients. If you wish to reproduce these results, you can download all the necessary data here:<br />
* Original projections, log-transformed projections with the table removed, motion mask, respiratory signal, and transform matrices to change from CT to CBCT coordinates and back<br />
** Patient 1<br />
** Patient 2<br />
* Inverse-consistent 4D Displacement Vector Fields, to the end-exhale phase and from the end-exhale phase<br />
** Patient 1<br />
** Patient 2<br />
<br />
Extract the data of each patient in a separate folder. From the folder containing the data of patient 1, run the following command line:<br />
<br />
<source lang="bash"><br />
# Reconstruct patient 1 with MA ROOSTER<br />
rtkfourdrooster \<br />
-p . \<br />
-r correctedProjs.mha \<br />
-o marooster.mha \<br />
-g geom.xml \<br />
--signal cphase.txt \ <br />
--motionmask dilated_resampled_mm.mhd \<br />
--gamma_time 0.0002 \<br />
--gamma_space 0.00005 \<br />
--niter 10 \<br />
--cgiter 4 \<br />
--tviter 10 \<br />
--spacing "1, 1, 1, 1" \<br />
--dimension "220, 280, 370, 10" \<br />
--origin "-140, -140, -75, 0" \<br />
--frames 10 \<br />
--dvf toPhase50_4D.mhd \<br />
--idvf fromPhase50_4D.mhd<br />
</source><br />
<br />
From the folder containing the data of patient 2, run the following command line (only the dimension and origin parameters are different):<br />
<br />
<source lang="bash"><br />
# Reconstruct patient 2 with MA ROOSTER<br />
rtkfourdrooster \<br />
-p . \<br />
-r correctedProjs.mha \<br />
-o marooster.mha \<br />
-g geom.xml \<br />
--signal cphase.txt \ <br />
--motionmask dilated_resampled_mm.mhd \<br />
--gamma_time 0.0002 \<br />
--gamma_space 0.00005 \<br />
--niter 10 \<br />
--cgiter 4 \<br />
--tviter 10 \<br />
--spacing "1, 1, 1, 1" \<br />
--dimension "285, 270, 307, 10" \<br />
--origin "-167.5, -135, -205, 0" \<br />
--frames 10 \<br />
--dvf toPhase50_4D.mhd \<br />
--idvf fromPhase50_4D.mhd<br />
</source><br />
<br />
Note the new option "--idvf", which allows to provide the inverse DVF. It is used to inverse warp the 4D reconstruction after the temporal regularization. MA-ROOSTER will work with and without the inverse DVF, and yield almost the same results in both cases. Not using the inverse DVF is approximately two times slower, as it requires MA-ROOSTER to perform the inverse warping by an iterative method.<br />
<br />
Again, if you have a CUDA-enabled GPU (in this case with at least 3 GB of VRAM), and have compiled RTK with RTK_USE_CUDA = ON, you can add the "--bp CudaVoxelBased" and "--fp CudaRayCast" to speed up the computation by performing the forward and back projections on the GPU.<br />
<br />
You do not need the 4D planning CT data to perform the MA-ROOSTER reconstructions. It is only required to compute the DVFs, which can be downloaded above. We do provide it anyway, in case you want to use your own method, or the one described in Motion-Compensated FDK, to extract a DVF from it:<br />
* 4D planning CT<br />
** Patient 1<br />
** Patient 2</div>Cyril.moryhttps://wiki.openrtk.org/index.php?title=RTK/Examples/4DROOSTERReconstruction&diff=470RTK/Examples/4DROOSTERReconstruction2016-02-18T10:11:31Z<p>Cyril.mory: /* Motion-Aware 4D ROOSTER (MA-ROOSTER) */</p>
<hr />
<div>RTK provides a tool to reconstruct a 3D + time image which does not require explicit motion estimation. Instead, it uses total variation regularization along both space and time. The implementation is based on a paper that we have published ([http://www.creatis.insa-lyon.fr/site/fr/publications/MORY-14 article]). You should read the article to understand the basics of the algorithm before trying to use the software.<br />
<br />
The algorithm requires a set of projection images with the associated RTK geometry, the respiratory phase of each projection image and a motion mask in which the region of the space where movement is expected is set to 1 and the rest is set to 0. Each piece of data is described in more details below and can be downloaded from [http://midas3.kitware.com/midas/folder/10278 MIDAS]. It is assumed that the breathing motion is periodic, which implies that the mechanical state of the chest depends only on the respiratory phase.<br />
<br />
= Projection images =<br />
<br />
This example is illustrated with a set of projection images of the [http://www.creatis.insa-lyon.fr/rio/popi-model_original_page POPI patient]. You can [http://midas3.kitware.com/midas/download/item/208648/projections.tgz download the projections] and the required tables of the Elekta database, [http://midas3.kitware.com/midas/download/item/208650/FRAME.DBF FRAME.DBF] and [http://midas3.kitware.com/midas/download/item/208649/IMAGE.DBF IMAGE.DBF]. The dataset is first used to reconstruct a blurry image:<br />
<br />
<source lang="bash"><br />
# Convert Elekta database to RTK geometry<br />
rtkelektasynergygeometry \<br />
-o geometry.rtk \<br />
-f FRAME.DBF \<br />
-i IMAGE.DBF \<br />
-u 1.3.46.423632.141000.1169042526.68<br />
<br />
# Reconstruct a 3D volume from all projection images. <br />
# We implicitly assume that the patient's chest is static, which is wrong. <br />
# Therefore the reconstruction will be blurry. This blurry reconstruction is <br />
# not required for 4D ROOSTER, but there is usually no other way to generate <br />
# a motion mask, which is required. Additionally, the blurry reconstruction <br />
# can be used to initialize the 4D ROOSTER reconstruction. <br />
rtkfdk \<br />
-p . \<br />
-r .*.his \<br />
-o fdk.mha \<br />
-g geometry.rtk \<br />
--hann 0.5 \<br />
--pad 1.0 \<br />
--dimension 160 \<br />
--spacing 2<br />
<br />
</source><br />
<br />
You should obtain something like that with [http://vv.creatis.insa-lyon.fr/ VV]:<br />
<br />
[[File:blurred.jpg]]<br />
<br />
= Motion mask =<br />
<br />
The next piece of data is a 3D motion mask: a volume that contains only zeros, where no movement is expected to occur, and ones, where movement is expected. Typically, during breathing, the whole chest moves, so it is safe to use the [http://midas3.kitware.com/midas/download/item/318731/PatientMask.mha patient mask] (red+green). However, restricting the movement to a smaller region, e.g. the rib cage, can help reconstruct this region more accurately and mitigate artifacts, so we might want to use the [http://midas3.kitware.com/midas/download/item/318730/MotionMask.mha rib cage mask] (red):<br />
<br />
[[File:mm.jpg]]<br />
<br />
= Respiratory signal =<br />
<br />
The 4D ROOSTER algorithm requires that we associate each projection image with the instant of the respiratory cycle at which it has been acquired. We used the Amsterdam shroud solution of Lambert Zijp (described [http://www.creatis.insa-lyon.fr/site/fr/publications/RIT-12a here]) which is implemented in RTK<br />
<br />
<source lang="bash"><br />
rtkamsterdamshroud --path . \<br />
--regexp '.*.his' \<br />
--output shroud.mha \<br />
--unsharp 650<br />
rtkextractshroudsignal --input shroud.mha \<br />
--output signal.txt \<br />
--phase sphase.txt<br />
</source><br />
<br />
to get the phase signal. Note that the phase must go from 0 to 1 where 0.3 corresponds to 30% in the respiratory cycle, i.e., frame 3 if you have a 10-frames 4D reconstruction or frame 6 if you have a 20-frames 4D reconstruction. The [http://midas3.kitware.com/midas/download/item/208655/sphase.txt resulting phase] is in green on top of the blue respiratory signal and the detected end-exhale peaks:<br />
<br />
[[File:signal.gif]]<br />
<br />
= 4D ROOSTER for cone-beam CT reconstruction =<br />
<br />
We now have all the pieces to perform a 3D + time reconstruction. The algorithm will perform "niter" iterations of the main loop, and run three inner loops at each iteration:<br />
* conjugate gradient reconstruction with "cgiter" iterations<br />
* total-variation regularization in space, with parameter "gamma_space" (the higher, the more regularized) and "tviter" iterations<br />
* total-variation regularization in time, with parameter "gamma_time" (the higher, the more regularized) and "tviter" iterations<br />
The number of iterations suggested here should work in most situations. The parameters gamma_space and gamma_time, on the other hand, must be adjusted carefully for each type of datasets (and, unfortunately, for each resolution). Unlike in analytical reconstruction methods like FDK, with 4D ROOSTER it is also very important that the reconstruction volume contains the whole patient's chest. You should therefore adapt the "dimension", "spacing" and "origin" parameters carefully, based on what you have observed on the blurry FDK reconstruction.<br />
<br />
<source lang="bash"><br />
# Reconstruct from all projection images with 4D ROOSTER<br />
rtkfourdrooster \<br />
-p . \<br />
-r .*.his \<br />
-o rooster.mha \<br />
-g geometry.rtk \<br />
--signal sphase.txt \ <br />
--motionmask MotionMask.mha \<br />
--gamma_time 0.0001 \<br />
--gamma_space 0.0001 \<br />
--niter 30 \<br />
--cgiter 4 \<br />
--tviter 10 \<br />
--spacing 2 \<br />
--dimension 160 \<br />
--frames 5<br />
</source><br />
<br />
Depending on the resolution you choose, and even on powerful computers, the reconstruction time can range from a few minutes (very low resolution, typically 32³ * 5, only for tests) to many hours (standard resolution, typically 256³ * 10). To speed things up, it is recommended to use the CUDA version of the forward and back projectors by running this command instead:<br />
<br />
<source lang="bash"><br />
# Reconstruct from all projection images with 4D ROOSTER, using CUDA forward and back projectors<br />
rtkfourdrooster \<br />
-p . \<br />
-r .*.his \<br />
-o rooster.mha \<br />
-g geometry.rtk \<br />
--signal sphase.txt \ <br />
--motionmask MotionMask.mha \<br />
--fp CudaRayCast \<br />
--bp CudaVoxelBased \<br />
--gamma_time 0.0001 \<br />
--gamma_space 0.0001 \<br />
--niter 30 \<br />
--cgiter 4 \<br />
--tviter 10 \<br />
--spacing 2 \<br />
--dimension 160 \<br />
--frames 5<br />
</source><br />
<br />
With a recent GPU, this should allow you to perform a standard resolution reconstruction in less than one hour.<br />
<br />
Note that the reconstructed volume in this example does not fully contain the attenuating object, causing hyper-attenuation artifacts on the borders of the result. To avoid these artifacts, reconstruct a larger volume (--dimension 256) should be fine. Note that you will have to resize your motion mask as well, as 3D the motion mask is expected to have the same size, spacing and origin as the first 3 dimensions of the 4D output.<br />
<br />
= Motion-Aware 4D ROOSTER (MA-ROOSTER) =<br />
<br />
4D ROOSTER doesn't require explicit motion information, but can take advantage of it to guide TV-regularization if motion information is available. Please refer to the tutorial on Motion-Compensated FDK to learn how to obtain a valid 4D Displacement Vector Field (DVF). Once you have it, simply adding the option --dvf "4D_DVF_Filename" to the list of rtkfourdrooster arguments will run MA-ROOSTER instead of 4D ROOSTER. <br />
<br />
<source lang="bash"><br />
# Reconstruct from all projection images with MA ROOSTER<br />
rtkfourdrooster \<br />
-p . \<br />
-r .*.his \<br />
-o rooster.mha \<br />
-g geometry.rtk \<br />
--signal sphase.txt \ <br />
--motionmask MotionMask.mha \<br />
--gamma_time 0.0001 \<br />
--gamma_space 0.0001 \<br />
--niter 30 \<br />
--cgiter 4 \<br />
--tviter 10 \<br />
--spacing 2 \<br />
--dimension 160 \<br />
--frames 5 \<br />
--dvf deformationField_4D.mhd<br />
</source><br />
<br />
Making use of the motion information adds to computation time. If you have compiled RTK with RTK_USE_CUDA = ON and have a working and CUDA-enabled nVidia GPU, it will automatically be used to speed up that part of the process.<br />
<br />
The article in which the theoretical foundations of MA-ROOSTER are presented (link to be added) contains results obtained on two patients. If you wish to reproduce these results, you can download all the necessary data here:<br />
* Original projections, log-transformed projections with the table removed, motion mask, respiratory signal, and transform matrices to change from CT to CBCT coordinates and back<br />
** Patient 1<br />
** Patient 2<br />
* Inverse-consistent 4D Displacement Vector Fields, to the end-exhale phase and from the end-exhale phase<br />
** Patient 1<br />
** Patient 2<br />
<br />
Extract the data of each patient in a separate folder. From the folder containing the data of patient 1, run the following command line:<br />
<br />
<source lang="bash"><br />
# Reconstruct patient 1 with MA ROOSTER<br />
rtkfourdrooster \<br />
-p . \<br />
-r correctedProjs.mha \<br />
-o marooster.mha \<br />
-g geom.xml \<br />
--signal cphase.txt \ <br />
--motionmask dilated_resampled_mm.mhd \<br />
--gamma_time 0.0002 \<br />
--gamma_space 0.00005 \<br />
--niter 10 \<br />
--cgiter 4 \<br />
--tviter 10 \<br />
--spacing "1, 1, 1, 1" \<br />
--dimension "220, 280, 370, 10" \<br />
--origin "-140, -140, -75, 0" \<br />
--frames 10 \<br />
--dvf toPhase50_4D.mhd \<br />
--idvf fromPhase50_4D.mhd<br />
</source><br />
<br />
From the folder containing the data of patient 2, run the following command line (only the dimension and origin parameters are different):<br />
<br />
<source lang="bash"><br />
# Reconstruct patient 2 with MA ROOSTER<br />
rtkfourdrooster \<br />
-p . \<br />
-r correctedProjs.mha \<br />
-o marooster.mha \<br />
-g geom.xml \<br />
--signal cphase.txt \ <br />
--motionmask dilated_resampled_mm.mhd \<br />
--gamma_time 0.0002 \<br />
--gamma_space 0.00005 \<br />
--niter 10 \<br />
--cgiter 4 \<br />
--tviter 10 \<br />
--spacing "1, 1, 1, 1" \<br />
--dimension "285, 270, 307, 10" \<br />
--origin "-167.5, -135, -205, 0" \<br />
--frames 10 \<br />
--dvf toPhase50_4D.mhd \<br />
--idvf fromPhase50_4D.mhd<br />
</source><br />
<br />
Again, if you have a CUDA-enabled GPU (in this case with at least 3 GB of VRAM), and have compiled RTK with RTK_USE_CUDA = ON, you can add the "--bp CudaVoxelBased" and "--fp CudaRayCast" to speed up the computation by performing the forward and back projections on the GPU.<br />
<br />
You do not actually need the 4D planning CT data to perform the MA-ROOSTER reconstructions. It is only required to compute the DVFs, which can be downloaded above. We do provide it anyway, in case you want to use your own method, or the one described in Motion-Compensated FDK, to extract a DVF from it:<br />
* 4D planning CT<br />
** Patient 1<br />
** Patient 2</div>Cyril.moryhttps://wiki.openrtk.org/index.php?title=RTK/Examples/4DROOSTERReconstruction&diff=469RTK/Examples/4DROOSTERReconstruction2016-02-18T10:10:57Z<p>Cyril.mory: /* Motion-Aware 4D ROOSTER (MA-ROOSTER) */</p>
<hr />
<div>RTK provides a tool to reconstruct a 3D + time image which does not require explicit motion estimation. Instead, it uses total variation regularization along both space and time. The implementation is based on a paper that we have published ([http://www.creatis.insa-lyon.fr/site/fr/publications/MORY-14 article]). You should read the article to understand the basics of the algorithm before trying to use the software.<br />
<br />
The algorithm requires a set of projection images with the associated RTK geometry, the respiratory phase of each projection image and a motion mask in which the region of the space where movement is expected is set to 1 and the rest is set to 0. Each piece of data is described in more details below and can be downloaded from [http://midas3.kitware.com/midas/folder/10278 MIDAS]. It is assumed that the breathing motion is periodic, which implies that the mechanical state of the chest depends only on the respiratory phase.<br />
<br />
= Projection images =<br />
<br />
This example is illustrated with a set of projection images of the [http://www.creatis.insa-lyon.fr/rio/popi-model_original_page POPI patient]. You can [http://midas3.kitware.com/midas/download/item/208648/projections.tgz download the projections] and the required tables of the Elekta database, [http://midas3.kitware.com/midas/download/item/208650/FRAME.DBF FRAME.DBF] and [http://midas3.kitware.com/midas/download/item/208649/IMAGE.DBF IMAGE.DBF]. The dataset is first used to reconstruct a blurry image:<br />
<br />
<source lang="bash"><br />
# Convert Elekta database to RTK geometry<br />
rtkelektasynergygeometry \<br />
-o geometry.rtk \<br />
-f FRAME.DBF \<br />
-i IMAGE.DBF \<br />
-u 1.3.46.423632.141000.1169042526.68<br />
<br />
# Reconstruct a 3D volume from all projection images. <br />
# We implicitly assume that the patient's chest is static, which is wrong. <br />
# Therefore the reconstruction will be blurry. This blurry reconstruction is <br />
# not required for 4D ROOSTER, but there is usually no other way to generate <br />
# a motion mask, which is required. Additionally, the blurry reconstruction <br />
# can be used to initialize the 4D ROOSTER reconstruction. <br />
rtkfdk \<br />
-p . \<br />
-r .*.his \<br />
-o fdk.mha \<br />
-g geometry.rtk \<br />
--hann 0.5 \<br />
--pad 1.0 \<br />
--dimension 160 \<br />
--spacing 2<br />
<br />
</source><br />
<br />
You should obtain something like that with [http://vv.creatis.insa-lyon.fr/ VV]:<br />
<br />
[[File:blurred.jpg]]<br />
<br />
= Motion mask =<br />
<br />
The next piece of data is a 3D motion mask: a volume that contains only zeros, where no movement is expected to occur, and ones, where movement is expected. Typically, during breathing, the whole chest moves, so it is safe to use the [http://midas3.kitware.com/midas/download/item/318731/PatientMask.mha patient mask] (red+green). However, restricting the movement to a smaller region, e.g. the rib cage, can help reconstruct this region more accurately and mitigate artifacts, so we might want to use the [http://midas3.kitware.com/midas/download/item/318730/MotionMask.mha rib cage mask] (red):<br />
<br />
[[File:mm.jpg]]<br />
<br />
= Respiratory signal =<br />
<br />
The 4D ROOSTER algorithm requires that we associate each projection image with the instant of the respiratory cycle at which it has been acquired. We used the Amsterdam shroud solution of Lambert Zijp (described [http://www.creatis.insa-lyon.fr/site/fr/publications/RIT-12a here]) which is implemented in RTK<br />
<br />
<source lang="bash"><br />
rtkamsterdamshroud --path . \<br />
--regexp '.*.his' \<br />
--output shroud.mha \<br />
--unsharp 650<br />
rtkextractshroudsignal --input shroud.mha \<br />
--output signal.txt \<br />
--phase sphase.txt<br />
</source><br />
<br />
to get the phase signal. Note that the phase must go from 0 to 1 where 0.3 corresponds to 30% in the respiratory cycle, i.e., frame 3 if you have a 10-frames 4D reconstruction or frame 6 if you have a 20-frames 4D reconstruction. The [http://midas3.kitware.com/midas/download/item/208655/sphase.txt resulting phase] is in green on top of the blue respiratory signal and the detected end-exhale peaks:<br />
<br />
[[File:signal.gif]]<br />
<br />
= 4D ROOSTER for cone-beam CT reconstruction =<br />
<br />
We now have all the pieces to perform a 3D + time reconstruction. The algorithm will perform "niter" iterations of the main loop, and run three inner loops at each iteration:<br />
* conjugate gradient reconstruction with "cgiter" iterations<br />
* total-variation regularization in space, with parameter "gamma_space" (the higher, the more regularized) and "tviter" iterations<br />
* total-variation regularization in time, with parameter "gamma_time" (the higher, the more regularized) and "tviter" iterations<br />
The number of iterations suggested here should work in most situations. The parameters gamma_space and gamma_time, on the other hand, must be adjusted carefully for each type of datasets (and, unfortunately, for each resolution). Unlike in analytical reconstruction methods like FDK, with 4D ROOSTER it is also very important that the reconstruction volume contains the whole patient's chest. You should therefore adapt the "dimension", "spacing" and "origin" parameters carefully, based on what you have observed on the blurry FDK reconstruction.<br />
<br />
<source lang="bash"><br />
# Reconstruct from all projection images with 4D ROOSTER<br />
rtkfourdrooster \<br />
-p . \<br />
-r .*.his \<br />
-o rooster.mha \<br />
-g geometry.rtk \<br />
--signal sphase.txt \ <br />
--motionmask MotionMask.mha \<br />
--gamma_time 0.0001 \<br />
--gamma_space 0.0001 \<br />
--niter 30 \<br />
--cgiter 4 \<br />
--tviter 10 \<br />
--spacing 2 \<br />
--dimension 160 \<br />
--frames 5<br />
</source><br />
<br />
Depending on the resolution you choose, and even on powerful computers, the reconstruction time can range from a few minutes (very low resolution, typically 32³ * 5, only for tests) to many hours (standard resolution, typically 256³ * 10). To speed things up, it is recommended to use the CUDA version of the forward and back projectors by running this command instead:<br />
<br />
<source lang="bash"><br />
# Reconstruct from all projection images with 4D ROOSTER, using CUDA forward and back projectors<br />
rtkfourdrooster \<br />
-p . \<br />
-r .*.his \<br />
-o rooster.mha \<br />
-g geometry.rtk \<br />
--signal sphase.txt \ <br />
--motionmask MotionMask.mha \<br />
--fp CudaRayCast \<br />
--bp CudaVoxelBased \<br />
--gamma_time 0.0001 \<br />
--gamma_space 0.0001 \<br />
--niter 30 \<br />
--cgiter 4 \<br />
--tviter 10 \<br />
--spacing 2 \<br />
--dimension 160 \<br />
--frames 5<br />
</source><br />
<br />
With a recent GPU, this should allow you to perform a standard resolution reconstruction in less than one hour.<br />
<br />
Note that the reconstructed volume in this example does not fully contain the attenuating object, causing hyper-attenuation artifacts on the borders of the result. To avoid these artifacts, reconstruct a larger volume (--dimension 256) should be fine. Note that you will have to resize your motion mask as well, as 3D the motion mask is expected to have the same size, spacing and origin as the first 3 dimensions of the 4D output.<br />
<br />
= Motion-Aware 4D ROOSTER (MA-ROOSTER) =<br />
<br />
4D ROOSTER doesn't require explicit motion information, but can take advantage of it to guide TV-regularization if motion information is available. Please refer to the tutorial on Motion-Compensated FDK to learn how to obtain a valid 4D Displacement Vector Field (DVF). Once you have it, simply adding the option --dvf "4D_DVF_Filename" to the list of rtkfourdrooster arguments will run MA-ROOSTER instead of 4D ROOSTER. <br />
<br />
<source lang="bash"><br />
# Reconstruct from all projection images with MA ROOSTER<br />
rtkfourdrooster \<br />
-p . \<br />
-r .*.his \<br />
-o rooster.mha \<br />
-g geometry.rtk \<br />
--signal sphase.txt \ <br />
--motionmask MotionMask.mha \<br />
--gamma_time 0.0001 \<br />
--gamma_space 0.0001 \<br />
--niter 30 \<br />
--cgiter 4 \<br />
--tviter 10 \<br />
--spacing 2 \<br />
--dimension 160 \<br />
--frames 5 \<br />
--dvf deformationField_4D.mhd<br />
</source><br />
<br />
Making use of the motion information adds to computation time. If you have compiled RTK with RTK_USE_CUDA = ON and have a working and CUDA-enabled nVidia GPU, it will automatically be used to speed up that part of the process.<br />
<br />
The article in which the theoretical foundations of MA-ROOSTER are presented (link to be added) contains results obtained on two patients. If you wish to reproduce these results, you can download all the necessary data here:<br />
* Original projections, log-transformed projections with the table removed, motion mask, respiratory signal, and transform matrices to change from CT to CBCT coordinates and back<br />
** Patient 1<br />
** Patient 2<br />
* Inverse-consistent 4D Displacement Vector Fields, to the end-exhale phase and from the end-exhale phase<br />
** Patient 1<br />
** Patient 2<br />
<br />
Extract the data of each patient in a separate folder. From the folder containing the data of patient 1, run the following command line:<br />
<br />
<source lang="bash"><br />
# Reconstruct patient 1 with MA ROOSTER<br />
rtkfourdrooster \<br />
-p . \<br />
-r correctedProjs.mha \<br />
-o marooster.mha \<br />
-g geom.xml \<br />
--signal cphase.txt \ <br />
--motionmask dilated_resampled_mm.mhd \<br />
--gamma_time 0.0002 \<br />
--gamma_space 0.00005 \<br />
--niter 10 \<br />
--cgiter 4 \<br />
--tviter 10 \<br />
--spacing "1, 1, 1, 1" \<br />
--dimension "220, 280, 370, 10" \<br />
--origin "-140, -140, -75, 0" \<br />
--frames 10 \<br />
--dvf toPhase50_4D.mhd \<br />
--idvf fromPhase50_4D.mhd<br />
</source><br />
<br />
From the folder containing the data of patient 2, run the following command line (only the dimension and origin parameters are different):<br />
<br />
<source lang="bash"><br />
# Reconstruct patient 1 with MA ROOSTER<br />
rtkfourdrooster \<br />
-p . \<br />
-r correctedProjs.mha \<br />
-o marooster.mha \<br />
-g geom.xml \<br />
--signal cphase.txt \ <br />
--motionmask dilated_resampled_mm.mhd \<br />
--gamma_time 0.0002 \<br />
--gamma_space 0.00005 \<br />
--niter 10 \<br />
--cgiter 4 \<br />
--tviter 10 \<br />
--spacing "1, 1, 1, 1" \<br />
--dimension "285, 270, 307, 10" \<br />
--origin "-167.5, -135, -205, 0" \<br />
--frames 10 \<br />
--dvf toPhase50_4D.mhd \<br />
--idvf fromPhase50_4D.mhd<br />
</source><br />
<br />
Again, if you have a CUDA-enabled GPU (in this case with at least 3 GB of VRAM), and have compiled RTK with RTK_USE_CUDA = ON, you can add the "--bp CudaVoxelBased" and "--fp CudaRayCast" to speed up the computation by performing the forward and back projections on the GPU.<br />
<br />
You do not actually need the 4D planning CT data to perform the MA-ROOSTER reconstructions. It is only required to compute the DVFs, which can be downloaded above. We do provide it anyway, in case you want to use your own method, or the one described in Motion-Compensated FDK, to extract a DVF from it:<br />
* 4D planning CT<br />
** Patient 1<br />
** Patient 2</div>Cyril.moryhttps://wiki.openrtk.org/index.php?title=RTK/Examples/4DROOSTERReconstruction&diff=468RTK/Examples/4DROOSTERReconstruction2016-02-18T09:45:12Z<p>Cyril.mory: /* Motion-Aware 4D ROOSTER (MA-ROOSTER) */</p>
<hr />
<div>RTK provides a tool to reconstruct a 3D + time image which does not require explicit motion estimation. Instead, it uses total variation regularization along both space and time. The implementation is based on a paper that we have published ([http://www.creatis.insa-lyon.fr/site/fr/publications/MORY-14 article]). You should read the article to understand the basics of the algorithm before trying to use the software.<br />
<br />
The algorithm requires a set of projection images with the associated RTK geometry, the respiratory phase of each projection image and a motion mask in which the region of the space where movement is expected is set to 1 and the rest is set to 0. Each piece of data is described in more details below and can be downloaded from [http://midas3.kitware.com/midas/folder/10278 MIDAS]. It is assumed that the breathing motion is periodic, which implies that the mechanical state of the chest depends only on the respiratory phase.<br />
<br />
= Projection images =<br />
<br />
This example is illustrated with a set of projection images of the [http://www.creatis.insa-lyon.fr/rio/popi-model_original_page POPI patient]. You can [http://midas3.kitware.com/midas/download/item/208648/projections.tgz download the projections] and the required tables of the Elekta database, [http://midas3.kitware.com/midas/download/item/208650/FRAME.DBF FRAME.DBF] and [http://midas3.kitware.com/midas/download/item/208649/IMAGE.DBF IMAGE.DBF]. The dataset is first used to reconstruct a blurry image:<br />
<br />
<source lang="bash"><br />
# Convert Elekta database to RTK geometry<br />
rtkelektasynergygeometry \<br />
-o geometry.rtk \<br />
-f FRAME.DBF \<br />
-i IMAGE.DBF \<br />
-u 1.3.46.423632.141000.1169042526.68<br />
<br />
# Reconstruct a 3D volume from all projection images. <br />
# We implicitly assume that the patient's chest is static, which is wrong. <br />
# Therefore the reconstruction will be blurry. This blurry reconstruction is <br />
# not required for 4D ROOSTER, but there is usually no other way to generate <br />
# a motion mask, which is required. Additionally, the blurry reconstruction <br />
# can be used to initialize the 4D ROOSTER reconstruction. <br />
rtkfdk \<br />
-p . \<br />
-r .*.his \<br />
-o fdk.mha \<br />
-g geometry.rtk \<br />
--hann 0.5 \<br />
--pad 1.0 \<br />
--dimension 160 \<br />
--spacing 2<br />
<br />
</source><br />
<br />
You should obtain something like that with [http://vv.creatis.insa-lyon.fr/ VV]:<br />
<br />
[[File:blurred.jpg]]<br />
<br />
= Motion mask =<br />
<br />
The next piece of data is a 3D motion mask: a volume that contains only zeros, where no movement is expected to occur, and ones, where movement is expected. Typically, during breathing, the whole chest moves, so it is safe to use the [http://midas3.kitware.com/midas/download/item/318731/PatientMask.mha patient mask] (red+green). However, restricting the movement to a smaller region, e.g. the rib cage, can help reconstruct this region more accurately and mitigate artifacts, so we might want to use the [http://midas3.kitware.com/midas/download/item/318730/MotionMask.mha rib cage mask] (red):<br />
<br />
[[File:mm.jpg]]<br />
<br />
= Respiratory signal =<br />
<br />
The 4D ROOSTER algorithm requires that we associate each projection image with the instant of the respiratory cycle at which it has been acquired. We used the Amsterdam shroud solution of Lambert Zijp (described [http://www.creatis.insa-lyon.fr/site/fr/publications/RIT-12a here]) which is implemented in RTK<br />
<br />
<source lang="bash"><br />
rtkamsterdamshroud --path . \<br />
--regexp '.*.his' \<br />
--output shroud.mha \<br />
--unsharp 650<br />
rtkextractshroudsignal --input shroud.mha \<br />
--output signal.txt \<br />
--phase sphase.txt<br />
</source><br />
<br />
to get the phase signal. Note that the phase must go from 0 to 1 where 0.3 corresponds to 30% in the respiratory cycle, i.e., frame 3 if you have a 10-frames 4D reconstruction or frame 6 if you have a 20-frames 4D reconstruction. The [http://midas3.kitware.com/midas/download/item/208655/sphase.txt resulting phase] is in green on top of the blue respiratory signal and the detected end-exhale peaks:<br />
<br />
[[File:signal.gif]]<br />
<br />
= 4D ROOSTER for cone-beam CT reconstruction =<br />
<br />
We now have all the pieces to perform a 3D + time reconstruction. The algorithm will perform "niter" iterations of the main loop, and run three inner loops at each iteration:<br />
* conjugate gradient reconstruction with "cgiter" iterations<br />
* total-variation regularization in space, with parameter "gamma_space" (the higher, the more regularized) and "tviter" iterations<br />
* total-variation regularization in time, with parameter "gamma_time" (the higher, the more regularized) and "tviter" iterations<br />
The number of iterations suggested here should work in most situations. The parameters gamma_space and gamma_time, on the other hand, must be adjusted carefully for each type of datasets (and, unfortunately, for each resolution). Unlike in analytical reconstruction methods like FDK, with 4D ROOSTER it is also very important that the reconstruction volume contains the whole patient's chest. You should therefore adapt the "dimension", "spacing" and "origin" parameters carefully, based on what you have observed on the blurry FDK reconstruction.<br />
<br />
<source lang="bash"><br />
# Reconstruct from all projection images with 4D ROOSTER<br />
rtkfourdrooster \<br />
-p . \<br />
-r .*.his \<br />
-o rooster.mha \<br />
-g geometry.rtk \<br />
--signal sphase.txt \ <br />
--motionmask MotionMask.mha \<br />
--gamma_time 0.0001 \<br />
--gamma_space 0.0001 \<br />
--niter 30 \<br />
--cgiter 4 \<br />
--tviter 10 \<br />
--spacing 2 \<br />
--dimension 160 \<br />
--frames 5<br />
</source><br />
<br />
Depending on the resolution you choose, and even on powerful computers, the reconstruction time can range from a few minutes (very low resolution, typically 32³ * 5, only for tests) to many hours (standard resolution, typically 256³ * 10). To speed things up, it is recommended to use the CUDA version of the forward and back projectors by running this command instead:<br />
<br />
<source lang="bash"><br />
# Reconstruct from all projection images with 4D ROOSTER, using CUDA forward and back projectors<br />
rtkfourdrooster \<br />
-p . \<br />
-r .*.his \<br />
-o rooster.mha \<br />
-g geometry.rtk \<br />
--signal sphase.txt \ <br />
--motionmask MotionMask.mha \<br />
--fp CudaRayCast \<br />
--bp CudaVoxelBased \<br />
--gamma_time 0.0001 \<br />
--gamma_space 0.0001 \<br />
--niter 30 \<br />
--cgiter 4 \<br />
--tviter 10 \<br />
--spacing 2 \<br />
--dimension 160 \<br />
--frames 5<br />
</source><br />
<br />
With a recent GPU, this should allow you to perform a standard resolution reconstruction in less than one hour.<br />
<br />
Note that the reconstructed volume in this example does not fully contain the attenuating object, causing hyper-attenuation artifacts on the borders of the result. To avoid these artifacts, reconstruct a larger volume (--dimension 256) should be fine. Note that you will have to resize your motion mask as well, as 3D the motion mask is expected to have the same size, spacing and origin as the first 3 dimensions of the 4D output.<br />
<br />
= Motion-Aware 4D ROOSTER (MA-ROOSTER) =<br />
<br />
4D ROOSTER doesn't require explicit motion information, but can take advantage of it to guide TV-regularization if motion information is available. Please refer to the tutorial on Motion-Compensated FDK to learn how to obtain a valid 4D Displacement Vector Field (DVF). Once you have it, simply adding the option --dvf "4D_DVF_Filename" to the list of rtkfourdrooster arguments will run MA-ROOSTER instead of 4D ROOSTER. <br />
<br />
<source lang="bash"><br />
# Reconstruct from all projection images with MA ROOSTER<br />
rtkfourdrooster \<br />
-p . \<br />
-r .*.his \<br />
-o rooster.mha \<br />
-g geometry.rtk \<br />
--signal sphase.txt \ <br />
--motionmask MotionMask.mha \<br />
--gamma_time 0.0001 \<br />
--gamma_space 0.0001 \<br />
--niter 30 \<br />
--cgiter 4 \<br />
--tviter 10 \<br />
--spacing 2 \<br />
--dimension 160 \<br />
--frames 5 \<br />
--dvf deformationField_4D.mhd<br />
</source><br />
<br />
Making use of the motion information adds to computation time. If you have compiled RTK with RTK_USE_CUDA = ON and have a working and CUDA-enabled nVidia GPU, it will automatically be used to speed up that part of the process.<br />
<br />
The article in which the theoretical foundations of MA-ROOSTER are presented (link to be added) contains results obtained on two patients. If you wish to reproduce these results, you can download all the necessary data here:<br />
* Original projections, log-transformed projections with the table removed, motion mask, respiratory signal, and transform matrices to change from CT to CBCT coordinates and back<br />
** Patient 1<br />
** Patient 2<br />
* 4D planning CT<br />
** Patient 1<br />
** Patient 2<br />
* Inverse-consistent 4D Displacement Vector Fields, to the end-exhale phase and from the end-exhale phase<br />
** Patient 1<br />
** Patient 2</div>Cyril.moryhttps://wiki.openrtk.org/index.php?title=RTK/Examples/4DROOSTERReconstruction&diff=467RTK/Examples/4DROOSTERReconstruction2016-02-18T09:40:21Z<p>Cyril.mory: /* Motion-Aware 4D ROOSTER (MA-ROOSTER) */</p>
<hr />
<div>RTK provides a tool to reconstruct a 3D + time image which does not require explicit motion estimation. Instead, it uses total variation regularization along both space and time. The implementation is based on a paper that we have published ([http://www.creatis.insa-lyon.fr/site/fr/publications/MORY-14 article]). You should read the article to understand the basics of the algorithm before trying to use the software.<br />
<br />
The algorithm requires a set of projection images with the associated RTK geometry, the respiratory phase of each projection image and a motion mask in which the region of the space where movement is expected is set to 1 and the rest is set to 0. Each piece of data is described in more details below and can be downloaded from [http://midas3.kitware.com/midas/folder/10278 MIDAS]. It is assumed that the breathing motion is periodic, which implies that the mechanical state of the chest depends only on the respiratory phase.<br />
<br />
= Projection images =<br />
<br />
This example is illustrated with a set of projection images of the [http://www.creatis.insa-lyon.fr/rio/popi-model_original_page POPI patient]. You can [http://midas3.kitware.com/midas/download/item/208648/projections.tgz download the projections] and the required tables of the Elekta database, [http://midas3.kitware.com/midas/download/item/208650/FRAME.DBF FRAME.DBF] and [http://midas3.kitware.com/midas/download/item/208649/IMAGE.DBF IMAGE.DBF]. The dataset is first used to reconstruct a blurry image:<br />
<br />
<source lang="bash"><br />
# Convert Elekta database to RTK geometry<br />
rtkelektasynergygeometry \<br />
-o geometry.rtk \<br />
-f FRAME.DBF \<br />
-i IMAGE.DBF \<br />
-u 1.3.46.423632.141000.1169042526.68<br />
<br />
# Reconstruct a 3D volume from all projection images. <br />
# We implicitly assume that the patient's chest is static, which is wrong. <br />
# Therefore the reconstruction will be blurry. This blurry reconstruction is <br />
# not required for 4D ROOSTER, but there is usually no other way to generate <br />
# a motion mask, which is required. Additionally, the blurry reconstruction <br />
# can be used to initialize the 4D ROOSTER reconstruction. <br />
rtkfdk \<br />
-p . \<br />
-r .*.his \<br />
-o fdk.mha \<br />
-g geometry.rtk \<br />
--hann 0.5 \<br />
--pad 1.0 \<br />
--dimension 160 \<br />
--spacing 2<br />
<br />
</source><br />
<br />
You should obtain something like that with [http://vv.creatis.insa-lyon.fr/ VV]:<br />
<br />
[[File:blurred.jpg]]<br />
<br />
= Motion mask =<br />
<br />
The next piece of data is a 3D motion mask: a volume that contains only zeros, where no movement is expected to occur, and ones, where movement is expected. Typically, during breathing, the whole chest moves, so it is safe to use the [http://midas3.kitware.com/midas/download/item/318731/PatientMask.mha patient mask] (red+green). However, restricting the movement to a smaller region, e.g. the rib cage, can help reconstruct this region more accurately and mitigate artifacts, so we might want to use the [http://midas3.kitware.com/midas/download/item/318730/MotionMask.mha rib cage mask] (red):<br />
<br />
[[File:mm.jpg]]<br />
<br />
= Respiratory signal =<br />
<br />
The 4D ROOSTER algorithm requires that we associate each projection image with the instant of the respiratory cycle at which it has been acquired. We used the Amsterdam shroud solution of Lambert Zijp (described [http://www.creatis.insa-lyon.fr/site/fr/publications/RIT-12a here]) which is implemented in RTK<br />
<br />
<source lang="bash"><br />
rtkamsterdamshroud --path . \<br />
--regexp '.*.his' \<br />
--output shroud.mha \<br />
--unsharp 650<br />
rtkextractshroudsignal --input shroud.mha \<br />
--output signal.txt \<br />
--phase sphase.txt<br />
</source><br />
<br />
to get the phase signal. Note that the phase must go from 0 to 1 where 0.3 corresponds to 30% in the respiratory cycle, i.e., frame 3 if you have a 10-frames 4D reconstruction or frame 6 if you have a 20-frames 4D reconstruction. The [http://midas3.kitware.com/midas/download/item/208655/sphase.txt resulting phase] is in green on top of the blue respiratory signal and the detected end-exhale peaks:<br />
<br />
[[File:signal.gif]]<br />
<br />
= 4D ROOSTER for cone-beam CT reconstruction =<br />
<br />
We now have all the pieces to perform a 3D + time reconstruction. The algorithm will perform "niter" iterations of the main loop, and run three inner loops at each iteration:<br />
* conjugate gradient reconstruction with "cgiter" iterations<br />
* total-variation regularization in space, with parameter "gamma_space" (the higher, the more regularized) and "tviter" iterations<br />
* total-variation regularization in time, with parameter "gamma_time" (the higher, the more regularized) and "tviter" iterations<br />
The number of iterations suggested here should work in most situations. The parameters gamma_space and gamma_time, on the other hand, must be adjusted carefully for each type of datasets (and, unfortunately, for each resolution). Unlike in analytical reconstruction methods like FDK, with 4D ROOSTER it is also very important that the reconstruction volume contains the whole patient's chest. You should therefore adapt the "dimension", "spacing" and "origin" parameters carefully, based on what you have observed on the blurry FDK reconstruction.<br />
<br />
<source lang="bash"><br />
# Reconstruct from all projection images with 4D ROOSTER<br />
rtkfourdrooster \<br />
-p . \<br />
-r .*.his \<br />
-o rooster.mha \<br />
-g geometry.rtk \<br />
--signal sphase.txt \ <br />
--motionmask MotionMask.mha \<br />
--gamma_time 0.0001 \<br />
--gamma_space 0.0001 \<br />
--niter 30 \<br />
--cgiter 4 \<br />
--tviter 10 \<br />
--spacing 2 \<br />
--dimension 160 \<br />
--frames 5<br />
</source><br />
<br />
Depending on the resolution you choose, and even on powerful computers, the reconstruction time can range from a few minutes (very low resolution, typically 32³ * 5, only for tests) to many hours (standard resolution, typically 256³ * 10). To speed things up, it is recommended to use the CUDA version of the forward and back projectors by running this command instead:<br />
<br />
<source lang="bash"><br />
# Reconstruct from all projection images with 4D ROOSTER, using CUDA forward and back projectors<br />
rtkfourdrooster \<br />
-p . \<br />
-r .*.his \<br />
-o rooster.mha \<br />
-g geometry.rtk \<br />
--signal sphase.txt \ <br />
--motionmask MotionMask.mha \<br />
--fp CudaRayCast \<br />
--bp CudaVoxelBased \<br />
--gamma_time 0.0001 \<br />
--gamma_space 0.0001 \<br />
--niter 30 \<br />
--cgiter 4 \<br />
--tviter 10 \<br />
--spacing 2 \<br />
--dimension 160 \<br />
--frames 5<br />
</source><br />
<br />
With a recent GPU, this should allow you to perform a standard resolution reconstruction in less than one hour.<br />
<br />
Note that the reconstructed volume in this example does not fully contain the attenuating object, causing hyper-attenuation artifacts on the borders of the result. To avoid these artifacts, reconstruct a larger volume (--dimension 256) should be fine. Note that you will have to resize your motion mask as well, as 3D the motion mask is expected to have the same size, spacing and origin as the first 3 dimensions of the 4D output.<br />
<br />
= Motion-Aware 4D ROOSTER (MA-ROOSTER) =<br />
<br />
4D ROOSTER doesn't require explicit motion information, but can take advantage of it to guide TV-regularization if motion information is available. Please refer to the tutorial on Motion-Compensated FDK to learn how to obtain a valid 4D Displacement Vector Field (DVF). Once you have it, simply adding the option --dvf "4D_DVF_Filename" to the list of rtkfourdrooster arguments will run MA-ROOSTER instead of 4D ROOSTER. <br />
<br />
<source lang="bash"><br />
# Reconstruct from all projection images with MA ROOSTER<br />
rtkfourdrooster \<br />
-p . \<br />
-r .*.his \<br />
-o rooster.mha \<br />
-g geometry.rtk \<br />
--signal sphase.txt \ <br />
--motionmask MotionMask.mha \<br />
--gamma_time 0.0001 \<br />
--gamma_space 0.0001 \<br />
--niter 30 \<br />
--cgiter 4 \<br />
--tviter 10 \<br />
--spacing 2 \<br />
--dimension 160 \<br />
--frames 5 \<br />
--dvf deformationField_4D.mhd<br />
</source><br />
<br />
Making use of the motion information adds to computation time. If you have compiled RTK with RTK_USE_CUDA = ON and have a working and CUDA-enabled nVidia GPU, it will automatically be used to speed up that part of the process.<br />
<br />
The article in which the theoretical foundations of MA-ROOSTER are presented (link to be added) contains results obtained on two patients. If you wish to reproduce these results, you can download all the necessary data here:</div>Cyril.moryhttps://wiki.openrtk.org/index.php?title=RTK/Examples/4DROOSTERReconstruction&diff=466RTK/Examples/4DROOSTERReconstruction2016-02-18T09:27:34Z<p>Cyril.mory: /* Motion-Compensated 4D ROOSTER (MA-ROOSTER) */</p>
<hr />
<div>RTK provides a tool to reconstruct a 3D + time image which does not require explicit motion estimation. Instead, it uses total variation regularization along both space and time. The implementation is based on a paper that we have published ([http://www.creatis.insa-lyon.fr/site/fr/publications/MORY-14 article]). You should read the article to understand the basics of the algorithm before trying to use the software.<br />
<br />
The algorithm requires a set of projection images with the associated RTK geometry, the respiratory phase of each projection image and a motion mask in which the region of the space where movement is expected is set to 1 and the rest is set to 0. Each piece of data is described in more details below and can be downloaded from [http://midas3.kitware.com/midas/folder/10278 MIDAS]. It is assumed that the breathing motion is periodic, which implies that the mechanical state of the chest depends only on the respiratory phase.<br />
<br />
= Projection images =<br />
<br />
This example is illustrated with a set of projection images of the [http://www.creatis.insa-lyon.fr/rio/popi-model_original_page POPI patient]. You can [http://midas3.kitware.com/midas/download/item/208648/projections.tgz download the projections] and the required tables of the Elekta database, [http://midas3.kitware.com/midas/download/item/208650/FRAME.DBF FRAME.DBF] and [http://midas3.kitware.com/midas/download/item/208649/IMAGE.DBF IMAGE.DBF]. The dataset is first used to reconstruct a blurry image:<br />
<br />
<source lang="bash"><br />
# Convert Elekta database to RTK geometry<br />
rtkelektasynergygeometry \<br />
-o geometry.rtk \<br />
-f FRAME.DBF \<br />
-i IMAGE.DBF \<br />
-u 1.3.46.423632.141000.1169042526.68<br />
<br />
# Reconstruct a 3D volume from all projection images. <br />
# We implicitly assume that the patient's chest is static, which is wrong. <br />
# Therefore the reconstruction will be blurry. This blurry reconstruction is <br />
# not required for 4D ROOSTER, but there is usually no other way to generate <br />
# a motion mask, which is required. Additionally, the blurry reconstruction <br />
# can be used to initialize the 4D ROOSTER reconstruction. <br />
rtkfdk \<br />
-p . \<br />
-r .*.his \<br />
-o fdk.mha \<br />
-g geometry.rtk \<br />
--hann 0.5 \<br />
--pad 1.0 \<br />
--dimension 160 \<br />
--spacing 2<br />
<br />
</source><br />
<br />
You should obtain something like that with [http://vv.creatis.insa-lyon.fr/ VV]:<br />
<br />
[[File:blurred.jpg]]<br />
<br />
= Motion mask =<br />
<br />
The next piece of data is a 3D motion mask: a volume that contains only zeros, where no movement is expected to occur, and ones, where movement is expected. Typically, during breathing, the whole chest moves, so it is safe to use the [http://midas3.kitware.com/midas/download/item/318731/PatientMask.mha patient mask] (red+green). However, restricting the movement to a smaller region, e.g. the rib cage, can help reconstruct this region more accurately and mitigate artifacts, so we might want to use the [http://midas3.kitware.com/midas/download/item/318730/MotionMask.mha rib cage mask] (red):<br />
<br />
[[File:mm.jpg]]<br />
<br />
= Respiratory signal =<br />
<br />
The 4D ROOSTER algorithm requires that we associate each projection image with the instant of the respiratory cycle at which it has been acquired. We used the Amsterdam shroud solution of Lambert Zijp (described [http://www.creatis.insa-lyon.fr/site/fr/publications/RIT-12a here]) which is implemented in RTK<br />
<br />
<source lang="bash"><br />
rtkamsterdamshroud --path . \<br />
--regexp '.*.his' \<br />
--output shroud.mha \<br />
--unsharp 650<br />
rtkextractshroudsignal --input shroud.mha \<br />
--output signal.txt \<br />
--phase sphase.txt<br />
</source><br />
<br />
to get the phase signal. Note that the phase must go from 0 to 1 where 0.3 corresponds to 30% in the respiratory cycle, i.e., frame 3 if you have a 10-frames 4D reconstruction or frame 6 if you have a 20-frames 4D reconstruction. The [http://midas3.kitware.com/midas/download/item/208655/sphase.txt resulting phase] is in green on top of the blue respiratory signal and the detected end-exhale peaks:<br />
<br />
[[File:signal.gif]]<br />
<br />
= 4D ROOSTER for cone-beam CT reconstruction =<br />
<br />
We now have all the pieces to perform a 3D + time reconstruction. The algorithm will perform "niter" iterations of the main loop, and run three inner loops at each iteration:<br />
* conjugate gradient reconstruction with "cgiter" iterations<br />
* total-variation regularization in space, with parameter "gamma_space" (the higher, the more regularized) and "tviter" iterations<br />
* total-variation regularization in time, with parameter "gamma_time" (the higher, the more regularized) and "tviter" iterations<br />
The number of iterations suggested here should work in most situations. The parameters gamma_space and gamma_time, on the other hand, must be adjusted carefully for each type of datasets (and, unfortunately, for each resolution). Unlike in analytical reconstruction methods like FDK, with 4D ROOSTER it is also very important that the reconstruction volume contains the whole patient's chest. You should therefore adapt the "dimension", "spacing" and "origin" parameters carefully, based on what you have observed on the blurry FDK reconstruction.<br />
<br />
<source lang="bash"><br />
# Reconstruct from all projection images with 4D ROOSTER<br />
rtkfourdrooster \<br />
-p . \<br />
-r .*.his \<br />
-o rooster.mha \<br />
-g geometry.rtk \<br />
--signal sphase.txt \ <br />
--motionmask MotionMask.mha \<br />
--gamma_time 0.0001 \<br />
--gamma_space 0.0001 \<br />
--niter 30 \<br />
--cgiter 4 \<br />
--tviter 10 \<br />
--spacing 2 \<br />
--dimension 160 \<br />
--frames 5<br />
</source><br />
<br />
Depending on the resolution you choose, and even on powerful computers, the reconstruction time can range from a few minutes (very low resolution, typically 32³ * 5, only for tests) to many hours (standard resolution, typically 256³ * 10). To speed things up, it is recommended to use the CUDA version of the forward and back projectors by running this command instead:<br />
<br />
<source lang="bash"><br />
# Reconstruct from all projection images with 4D ROOSTER, using CUDA forward and back projectors<br />
rtkfourdrooster \<br />
-p . \<br />
-r .*.his \<br />
-o rooster.mha \<br />
-g geometry.rtk \<br />
--signal sphase.txt \ <br />
--motionmask MotionMask.mha \<br />
--fp CudaRayCast \<br />
--bp CudaVoxelBased \<br />
--gamma_time 0.0001 \<br />
--gamma_space 0.0001 \<br />
--niter 30 \<br />
--cgiter 4 \<br />
--tviter 10 \<br />
--spacing 2 \<br />
--dimension 160 \<br />
--frames 5<br />
</source><br />
<br />
With a recent GPU, this should allow you to perform a standard resolution reconstruction in less than one hour.<br />
<br />
Note that the reconstructed volume in this example does not fully contain the attenuating object, causing hyper-attenuation artifacts on the borders of the result. To avoid these artifacts, reconstruct a larger volume (--dimension 256) should be fine. Note that you will have to resize your motion mask as well, as 3D the motion mask is expected to have the same size, spacing and origin as the first 3 dimensions of the 4D output.<br />
<br />
= Motion-Aware 4D ROOSTER (MA-ROOSTER) =<br />
<br />
4D ROOSTER doesn't require explicit motion information, but can take advantage of it to guide TV-regularization if motion information is available. Please refer to the tutorial on Motion-Compensated FDK to learn how to obtain a valid 4D Displacement Vector Field (DVF). Once you have it, simply adding the option --dvf "4D_DVF_Filename" to the list of rtkfourdrooster arguments will run MA-ROOSTER instead of 4D ROOSTER. <br />
<br />
<source lang="bash"><br />
# Reconstruct from all projection images with MA ROOSTER<br />
rtkfourdrooster \<br />
-p . \<br />
-r .*.his \<br />
-o rooster.mha \<br />
-g geometry.rtk \<br />
--signal sphase.txt \ <br />
--motionmask MotionMask.mha \<br />
--gamma_time 0.0001 \<br />
--gamma_space 0.0001 \<br />
--niter 30 \<br />
--cgiter 4 \<br />
--tviter 10 \<br />
--spacing 2 \<br />
--dimension 160 \<br />
--frames 5 \<br />
--dvf deformationField_4D.mhd<br />
</source><br />
<br />
Making use of the motion information adds to computation time. If you have compiled RTK with RTK_USE_CUDA = ON and have a working and CUDA-enabled nVidia GPU, it will automatically be used to speed up that part of the process.</div>Cyril.moryhttps://wiki.openrtk.org/index.php?title=SimpleRTK&diff=454SimpleRTK2016-01-05T09:12:02Z<p>Cyril.mory: /* Building RTK with SimpleRTK */</p>
<hr />
<div>= Introduction =<br />
SimpleRTK provides a simple interface to RTK in a variety of languages. For now only Python and C# binding have been tested and are supported but other languages should also work, e.g., R, Ruby and Java. SimpleRTK is provided as part of RTK making it easier to configure, build and use. Note that SimpleRTK is derived from the SimpleITK project for the Insight Toolkit, however it is distributed separately and independently.<br />
<br />
= Building RTK with SimpleRTK =<br />
SimpleRTK uses Swig to generate the wrapping for different languages. As the version of Swig should be controlled, SimpleRTK will automatically download the right version of Swig and its dependencies for the different platforms. However you can always point to the installed version of Swig if you'd like to, but this is not recommended. You will need the development libraries of python (python-devel packages) for the compilation of SimpleRTK to succeed.<br />
<br />
Here are the simple steps to build and configure wrapping for RTK:<br />
# Run CMake on RTK as you normally do<br />
# Check the option BUILD_SIMPLERTK (default is OFF)<br />
# Ename WRAP_PYTHON and/or WRAP_CSHARP (On Windows)<br />
# Configure<br />
# Build as usual. Note that building will download the require libraries so you should have an internet connection enabled.<br />
<br />
Note that the configuration and generation step can take some time as CMake has to generate the necessary classes.<br />
<br />
= Python installation =<br />
To install the built python package into the system Python:<br />
<br />
cd SimpleRTK-build/Wrapping<br />
sudo python PythonPackage/setup.py install<br />
<br />
Alternatively, a Python virtual environment can be created and the distribution installed there.<br />
If you build the "dist" target a Python egg will be created in the "Wrapping/dist" directory. Building Python wheels can be enabled with a CMake flag.<br />
<br />
= Testing SimpleRTK =<br />
A simple example is located in Utilities/SimpleRTK/Examples/RTKFirstReconstruction.py and shows how to use SimpleRTK<br />
<br />
<source lang="python"><br />
#!/usr/bin/env python<br />
from __future__ import print_function<br />
import SimpleRTK as srtk<br />
import sys<br />
import os<br />
import matplotlib.pyplot as plt<br />
import matplotlib.cm as cm<br />
<br />
if len ( sys.argv ) < 2:<br />
print( "Usage: RTKFirstReconstruction <output>" )<br />
sys.exit ( 1 )<br />
<br />
# Defines the RTK geometry object<br />
geometry = srtk.ThreeDCircularProjectionGeometry()<br />
numberOfProjections = 360<br />
firstAngle = 0<br />
angularArc = 360<br />
sid = 600 # source to isocenter distance in mm<br />
sdd = 1200 # source to detector distance in mm<br />
isox = 0 # X coordinate on the projection image of isocenter<br />
isoy = 0 # Y coordinate on the projection image of isocenter<br />
for x in range(0,numberOfProjections):<br />
angle = firstAngle + x * angularArc / numberOfProjections<br />
geometry.AddProjection(sid,sdd,angle,isox,isoy)<br />
<br />
constantImageSource = srtk.ConstantImageSource()<br />
origin = [ -127.5, -127.5, 0. ]<br />
sizeOutput = [ 256, 256, numberOfProjections ]<br />
spacing = [ 1.0, 1.0, 1.0 ]<br />
constantImageSource.SetOrigin( origin )<br />
constantImageSource.SetSpacing( spacing )<br />
constantImageSource.SetSize( sizeOutput )<br />
constantImageSource.SetConstant(0.0)<br />
source = constantImageSource.Execute()<br />
<br />
rei = srtk.RayEllipsoidIntersectionImageFilter()<br />
semiprincipalaxis = [ 50, 50, 50]<br />
center = [ 0, 0, 0]<br />
# Set GrayScale value, axes, center...<br />
rei.SetDensity(20)<br />
rei.SetAngle(0)<br />
rei.SetCenter(center)<br />
rei.SetAxis(semiprincipalaxis)<br />
rei.SetGeometry( geometry )<br />
reiImage = rei.Execute(source)<br />
<br />
# Create reconstructed image<br />
constantImageSource2 = srtk.ConstantImageSource()<br />
origin = [ -63.5, -63.5, -63.5 ]<br />
sizeOutput = [ 128, 128, 128 ]<br />
constantImageSource2.SetOrigin( origin )<br />
constantImageSource2.SetSpacing( spacing )<br />
constantImageSource2.SetSize( sizeOutput )<br />
constantImageSource2.SetConstant(0.0)<br />
source2 = constantImageSource2.Execute()<br />
<br />
print("Performing reconstruction")<br />
feldkamp = srtk.FDKConeBeamReconstructionFilter()<br />
feldkamp.SetGeometry( geometry );<br />
feldkamp.SetTruncationCorrection(0.0);<br />
feldkamp.SetHannCutFrequency(0.0);<br />
image = feldkamp.Execute(source2,reiImage) <br />
<br />
plt.imshow(srtk.GetArrayFromImage(image[:,64,:]), cmap = cm.Greys_r)<br />
plt.show()<br />
<br />
pixelID = image.GetPixelIDValue()<br />
caster = srtk.CastImageFilter()<br />
caster.SetOutputPixelType( pixelID )<br />
image = caster.Execute( image )<br />
<br />
writer = srtk.ImageFileWriter()<br />
writer.SetFileName ( sys.argv[1] )<br />
writer.Execute ( image );<br />
</source><br />
<br />
The example displays the central slice of a reconstructed sphere:<br />
<br />
[[File:spherepy.png|600px]]<br />
<br />
= SimpleRTK with SimpleITK =<br />
Even if SimpleRTK is based on SimpleITK, the basic object types (images, transforms) are different and there is no direct compatibility between the two toolkits. However, it is fairly straightforward to pass the image data from RTK to ITK using the following example<br />
<br />
sitk.GetImageFromArray( srtk.GetArrayFromImage( image ) )<br />
<br />
but meta-information (spacing, origin, direction, etc.) is then discarded. If you need the information, you can use the function<br />
<br />
sitkImage.CopyInformation( source )<br />
<br />
= Extending SimpleRTK =<br />
Adding new classes to SimpleRTK should be fairly straightforward. In this section, we cover how to add common types as well as filters. Note that common types should only be added when necessary.<br />
<br />
The file located in Wrapping/SimpleRTK.i is the main SWIG file and new types and manually wrapped files should be added there.<br />
<br />
== Common Type ==<br />
One example is for the ThreeDCircularProjectionGeometry object. The code is located in utilities/SimpleRTK/Code/Common.<br />
This class in the namespace rtk::simple provides a PIMPL class implementation of the object as well as a conversion from SimpleRTK to RTK itself to expose the necessary functions.<br />
<br />
== Filters ==<br />
Filters are implemented using a json description for simplicity. The best way is to look into already wrapped filters in the: utilities/SimpleRTK/Code/BasicFilters/json directory.<br />
<br />
Here we provide a description of the current JSON format.<br />
<source lang="javascript"><br />
{<br />
# Name of the class to be create. This would be prefixed by srtk. <br />
"name" : "FDKConeBeamReconstructionFilter",<br />
<br />
# File that indicates the template to use. This should be RTKImageFilter for image filters<br />
"template_code_filename" : "RTKImageFilter",<br />
<br />
# File that indicates the template to use for the test.<br />
"template_test_filename" : "ImageFilter",<br />
<br />
# Number of inputs to the filter.<br />
"number_of_inputs" : 2,<br />
<br />
# Documentation for the class, if any.<br />
"doc" : "",<br />
<br />
# Type of output image. This creates a typedef OutputImageType. Here we set it to the input image.<br />
"output_image_type" : "TImageType",<br />
<br />
# List of supported Pixel types<br />
"pixel_types" : "RealPixelIDTypeList",<br />
<br />
# Definition of the RTK filter<br />
"filter_type" : "rtk::FDKConeBeamReconstructionFilter<InputImageType>",<br />
<br />
# Array of include files.<br />
"include_files" : [<br />
"srtkThreeDCircularProjectionGeometry.h"<br />
],<br />
</source><br />
<br />
The next section describes the member functions. Each member function has a name and a type.<br />
The Set...() and Get...() functions are automatically generated. <br />
<br />
<source lang="javascript"><br />
"members" : [<br />
{<br />
# Name of the variable to be Set/Get<br />
"name" : "Geometry",<br />
<br />
# Type of the variable<br />
"type" : "ThreeDCircularProjectionGeometry*",<br />
<br />
# Default value of the variable<br />
"default" : "0",<br />
<br />
# Internal Simple RTK type of the function<br />
"itk_type" : "ThreeDCircularProjectionGeometry",<br />
<br />
# Casting from the itk_type to the internal type<br />
"custom_itk_cast" : "filter->SetGeometry( this->m_Geometry->GetRTKBase() );\n",<br />
<br />
# Documentation for the member function<br />
"doc" : "",<br />
"briefdescriptionSet" : "",<br />
"detaileddescriptionSet" : "Set the object pointer to projection geometry.",<br />
"briefdescriptionGet" : "",<br />
"detaileddescriptionGet" : "Get the object pointer to projection geometry."<br />
}<br />
],<br />
</source><br />
<br />
At the end of the file we add the description of the class for documentation purposes.<br />
<br />
<source lang="javascript"><br />
"briefdescription" : "Brief description of the filter",<br />
"detaileddescription" : "Detailed description of the filter"<br />
}<br />
</source><br />
<br />
'''Note that you might need to rebuild the solution in order for CMake to take the changes into account.''' Another solution is to manually delete the file SimpleRTK-prefix/src/SimpleRTK-stamp/SimpleRTK-configure.<br />
The code generated is located in the "SimpleRTK-build/Code/BasicFilters" of your build tree.</div>Cyril.moryhttps://wiki.openrtk.org/index.php?title=RTK_wiki_help&diff=453RTK wiki help2016-01-05T09:10:12Z<p>Cyril.mory: /* Tutorial 1 - Modifying a basic RTK application */</p>
<hr />
<div>= Welcome to RTK =<br />
<br />
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:<br />
<br />
[http://www.openrtk.org/ Main website]<br />
<br />
[http://www.openrtk.org/RTK/project/project.html Project]<br />
<br />
[http://www.openrtk.org/RTK/resources/resources.html Resources]<br />
<br />
[http://www.openrtk.org/RTK/project/contactus.html Contact us]<br />
<br />
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.<br />
<br />
The three steps to starting to work with RTK are therefore:<br />
<br />
#Download and Build the ITK source<br />
#Download/Obtain/Get the RTK source<br />
#Build the RTK library<br />
#Write your own code that uses RTK and build it, linking to the RTK library. <br />
<br />
In the next sections we describe each of these steps.<br />
<br />
== Requirements ==<br />
In order to compile RTK you will need the following:<br />
* GIT (in order to get the software)<br />
* CMake (in order to configure RTK)<br />
* C/C++ compiler<br />
<br />
== Step 0 - Getting ITK ==<br />
'''RTK currently uses ITK > 4.2.0'''. <br />
<br />
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 4.5.1:<br />
<br />
git clone git://itk.org/ITK.git<br />
cd ITK<br />
git checkout v4.5.1<br />
<br />
Once ITK source code is downloaded you need to configure and generate the CMake files:<br />
<br />
mkdir ITK-bin<br />
cd ITK-bin<br />
ccmake ../ITK<br />
<br />
RTK requires the following option<br />
<br />
Module_ITKReview ON<br />
<br />
It is also recommended to use the [http://www.fftw.org FFTW] library via the options<br />
<br />
ITK_USE_FFTWD ON<br />
ITK_USE_FFTWF ON<br />
<br />
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:<br />
<br />
BUILD_DOCUMENTATION OFF<br />
BUILD_EXAMPLES OFF<br />
BUILD_TESTING OFF <br />
<br />
After generating your CMake files you are ready to start the compilation process, run:<br />
<br />
make<br />
<br />
== Step 1 - Getting RTK ==<br />
This page documents how to download RTK through [http://git-scm.com Git].<br />
Follow the ITK [[Git/Download|Git download instructions]] to install Git.<br />
<br />
To get the latest source code for RTK:<br />
git clone git://github.com/SimonRit/RTK.git<br />
<br />
== Step 2 - Building RTK ==<br />
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'<br />
<br />
mkdir RTK-bin<br />
cd RTK-bin<br />
ccmake ../RTK<br />
<br />
When CMake asks for the ITK_DIR, specify the binary directory where ITK is built and choose CMAKE_BUILD_TYPE (default: Release),<br />
<br />
ITK_DIR /path_to_directory/ITK-bin<br />
CMAKE_BUILD_TYPE Release<br />
<br />
Finally, after configuring and generating your CMake files, you can start the compilation running the following command:<br />
<br />
make<br />
<br />
== Step 3 - Running the HelloWorld application ==<br />
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<br />
<br />
BUILD_EXAMPLES ON<br />
<br />
when configuring RTK with CMake.<br />
<br />
= Tutorials =<br />
<br />
== Tutorial 0 - Building a HelloWorld application with RTK ==<br />
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'''.<br />
<br />
* First you need to create a CMakeLists.txt with the following lines:<br />
<br />
# This project is designed to be built outside the RTK source tree.<br />
PROJECT(HelloWorld)<br />
<br />
# Find the RTK libraries and includes<br />
FIND_PACKAGE(RTK REQUIRED)<br />
INCLUDE(${RTK_USE_FILE})<br />
<br />
# Executable<br />
ADD_EXECUTABLE(HelloWorld HelloWorld.cxx )<br />
TARGET_LINK_LIBRARIES(HelloWorld ${RTK_LIBRARIES})<br />
TARGET_LINK_LIBRARIES(HelloWorld ${ITK_LIBRARIES})<br />
<br />
* Create a HelloWorld.cxx file<br />
<br />
#include <rtkFDKBackProjectionImageFilter.h><br />
<br />
int main(int argc, char **argv)<br />
{<br />
// Define the type of pixel and the image dimension<br />
typedef float OutputPixelType;<br />
const unsigned int Dimension = 3;<br />
<br />
// Define the type of image<br />
typedef itk::Image< OutputPixelType, Dimension > OutputImageType;<br />
<br />
// Define and allocate the FDK Back Projection Filter<br />
typedef rtk::FDKBackProjectionImageFilter<OutputImageType, OutputImageType> BPType;<br />
BPType::Pointer p = BPType::New();<br />
<br />
std::cout << "RTK Hello World!" << std::endl;<br />
<br />
return 0;<br />
}<br />
<br />
* Run CMake on the HelloWorld directory and create a HelloWorld-bin<br />
* Configure and build the project using your favorite compiler<br />
* Run the HelloWorld application. If everything runs correctly you should see "RTK Hello World!" written on the console.<br />
<br />
== Tutorial 1 - Modifying a basic RTK application ==<br />
<br />
In RTK/applications/rtktutorialapplication/, you will find a very basic RTK application that can be used as a starting point for building more complex applications.<br />
The code suggests ways to modify the application, which should help beginners get the hang of ITK and RTK.<br />
<br />
== Tutorial 2 - My first reconstruction ==<br />
[[RTK/Examples/FirstReconstruction | Reconstruct a Sphere]]<br />
<br />
= Wrapping =<br />
<br />
[[SimpleRTK]] provides a wrapping mechanism to several languages such as Python and C#.<br />
<br />
= Applications =<br />
<br />
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.<br />
<br />
* [[RTK/Scripts/FDK | FDK Shepp Logan ]]<br />
* [[RTK/Scripts/3DCG | 3D Conjugate Gradient ]]<br />
* [[RTK/Scripts/ForwardProjection | Forward projection ]]<br />
* [[RTK/Scripts/RayBoxIntersection | Ray/box projections and reconstruction ]]<br />
* [[RTK/Scripts/DrawGeometricPhantom | 3D geometric phantom ]]<br />
* [[RTK/Scripts/CreateGammexPhantom | 3D gammex phantom ]]<br />
* [[RTK/Scripts/AmsterdamShroud | Amsterdam Shroud image ]]<br />
* [[RTK/Examples/ElektaReconstruction | Reconstruct from Elekta Data]]<br />
* [[RTK/Examples/VarianReconstruction | Reconstruct from Varian Data]]<br />
* [[RTK/Examples/MCCBCTReconstruction | Motion-compensated reconstruction ]]<br />
* [[RTK/Examples/ADMMTVReconstruction | Total variation-regularized reconstruction ]]<br />
* [[RTK/Examples/ADMMWaveletsReconstruction | Daubechies wavelets-regularized reconstruction ]]<br />
* [[RTK/Examples/4DROOSTERReconstruction | 4DROOSTER: Total variation-regularized 3D + time reconstruction ]]<br />
<br />
= Image quality =<br />
<br />
[[RTK/ImageQuality | Summary of existing and future developments for image quality in RTK]]<br />
<br />
= Geometry =<br />
<br />
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].<br />
<br />
== ImagX geometry ==<br />
<br />
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.<br />
<br />
= Developer's corner =<br />
<br />
== Developer's documentation ==<br />
<br />
We only provide the [http://www.openrtk.org/Doxygen/index.html doxygen documentation] at the moment.<br />
<br />
== Coding style ==<br />
<br />
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 [http://www.itk.org/Wiki/ITK/Coding_Style_Guide ITK's style guide].<br />
<br />
== Testing ==<br />
<br />
* The RTK dashboard is available at [http://my.cdash.org/index.php?project=RTK RTK Dashboard]<br />
* [[RTK/TestingDatasets | Documentation ]] on how to add datasets for testing (MIDAS+CDash)<br />
<br />
== Meetings ==<br />
<br />
* [[RTK/Meetings/OnImageQualityInStaticCBCT | July 31, 2015 - RTK user meeting on image quality in static CBCT]]</div>Cyril.moryhttps://wiki.openrtk.org/index.php?title=RTK_wiki_help&diff=452RTK wiki help2016-01-05T09:09:34Z<p>Cyril.mory: /* Tutorial 1 - Modifying a simple RTK application */</p>
<hr />
<div>= Welcome to RTK =<br />
<br />
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:<br />
<br />
[http://www.openrtk.org/ Main website]<br />
<br />
[http://www.openrtk.org/RTK/project/project.html Project]<br />
<br />
[http://www.openrtk.org/RTK/resources/resources.html Resources]<br />
<br />
[http://www.openrtk.org/RTK/project/contactus.html Contact us]<br />
<br />
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.<br />
<br />
The three steps to starting to work with RTK are therefore:<br />
<br />
#Download and Build the ITK source<br />
#Download/Obtain/Get the RTK source<br />
#Build the RTK library<br />
#Write your own code that uses RTK and build it, linking to the RTK library. <br />
<br />
In the next sections we describe each of these steps.<br />
<br />
== Requirements ==<br />
In order to compile RTK you will need the following:<br />
* GIT (in order to get the software)<br />
* CMake (in order to configure RTK)<br />
* C/C++ compiler<br />
<br />
== Step 0 - Getting ITK ==<br />
'''RTK currently uses ITK > 4.2.0'''. <br />
<br />
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 4.5.1:<br />
<br />
git clone git://itk.org/ITK.git<br />
cd ITK<br />
git checkout v4.5.1<br />
<br />
Once ITK source code is downloaded you need to configure and generate the CMake files:<br />
<br />
mkdir ITK-bin<br />
cd ITK-bin<br />
ccmake ../ITK<br />
<br />
RTK requires the following option<br />
<br />
Module_ITKReview ON<br />
<br />
It is also recommended to use the [http://www.fftw.org FFTW] library via the options<br />
<br />
ITK_USE_FFTWD ON<br />
ITK_USE_FFTWF ON<br />
<br />
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:<br />
<br />
BUILD_DOCUMENTATION OFF<br />
BUILD_EXAMPLES OFF<br />
BUILD_TESTING OFF <br />
<br />
After generating your CMake files you are ready to start the compilation process, run:<br />
<br />
make<br />
<br />
== Step 1 - Getting RTK ==<br />
This page documents how to download RTK through [http://git-scm.com Git].<br />
Follow the ITK [[Git/Download|Git download instructions]] to install Git.<br />
<br />
To get the latest source code for RTK:<br />
git clone git://github.com/SimonRit/RTK.git<br />
<br />
== Step 2 - Building RTK ==<br />
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'<br />
<br />
mkdir RTK-bin<br />
cd RTK-bin<br />
ccmake ../RTK<br />
<br />
When CMake asks for the ITK_DIR, specify the binary directory where ITK is built and choose CMAKE_BUILD_TYPE (default: Release),<br />
<br />
ITK_DIR /path_to_directory/ITK-bin<br />
CMAKE_BUILD_TYPE Release<br />
<br />
Finally, after configuring and generating your CMake files, you can start the compilation running the following command:<br />
<br />
make<br />
<br />
== Step 3 - Running the HelloWorld application ==<br />
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<br />
<br />
BUILD_EXAMPLES ON<br />
<br />
when configuring RTK with CMake.<br />
<br />
= Tutorials =<br />
<br />
== Tutorial 0 - Building a HelloWorld application with RTK ==<br />
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'''.<br />
<br />
* First you need to create a CMakeLists.txt with the following lines:<br />
<br />
# This project is designed to be built outside the RTK source tree.<br />
PROJECT(HelloWorld)<br />
<br />
# Find the RTK libraries and includes<br />
FIND_PACKAGE(RTK REQUIRED)<br />
INCLUDE(${RTK_USE_FILE})<br />
<br />
# Executable<br />
ADD_EXECUTABLE(HelloWorld HelloWorld.cxx )<br />
TARGET_LINK_LIBRARIES(HelloWorld ${RTK_LIBRARIES})<br />
TARGET_LINK_LIBRARIES(HelloWorld ${ITK_LIBRARIES})<br />
<br />
* Create a HelloWorld.cxx file<br />
<br />
#include <rtkFDKBackProjectionImageFilter.h><br />
<br />
int main(int argc, char **argv)<br />
{<br />
// Define the type of pixel and the image dimension<br />
typedef float OutputPixelType;<br />
const unsigned int Dimension = 3;<br />
<br />
// Define the type of image<br />
typedef itk::Image< OutputPixelType, Dimension > OutputImageType;<br />
<br />
// Define and allocate the FDK Back Projection Filter<br />
typedef rtk::FDKBackProjectionImageFilter<OutputImageType, OutputImageType> BPType;<br />
BPType::Pointer p = BPType::New();<br />
<br />
std::cout << "RTK Hello World!" << std::endl;<br />
<br />
return 0;<br />
}<br />
<br />
* Run CMake on the HelloWorld directory and create a HelloWorld-bin<br />
* Configure and build the project using your favorite compiler<br />
* Run the HelloWorld application. If everything runs correctly you should see "RTK Hello World!" written on the console.<br />
<br />
== Tutorial 1 - Modifying a basic RTK application ==<br />
<br />
In RTK/applications/rtktutorialapplication/, you will find a very basic RTK application that can be used as a starting point for building more complex applications.<br />
The code suggests ways to modify the application, which should help beginners get the grip of ITK and RTK.<br />
<br />
== Tutorial 2 - My first reconstruction ==<br />
[[RTK/Examples/FirstReconstruction | Reconstruct a Sphere]]<br />
<br />
= Wrapping =<br />
<br />
[[SimpleRTK]] provides a wrapping mechanism to several languages such as Python and C#.<br />
<br />
= Applications =<br />
<br />
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.<br />
<br />
* [[RTK/Scripts/FDK | FDK Shepp Logan ]]<br />
* [[RTK/Scripts/3DCG | 3D Conjugate Gradient ]]<br />
* [[RTK/Scripts/ForwardProjection | Forward projection ]]<br />
* [[RTK/Scripts/RayBoxIntersection | Ray/box projections and reconstruction ]]<br />
* [[RTK/Scripts/DrawGeometricPhantom | 3D geometric phantom ]]<br />
* [[RTK/Scripts/CreateGammexPhantom | 3D gammex phantom ]]<br />
* [[RTK/Scripts/AmsterdamShroud | Amsterdam Shroud image ]]<br />
* [[RTK/Examples/ElektaReconstruction | Reconstruct from Elekta Data]]<br />
* [[RTK/Examples/VarianReconstruction | Reconstruct from Varian Data]]<br />
* [[RTK/Examples/MCCBCTReconstruction | Motion-compensated reconstruction ]]<br />
* [[RTK/Examples/ADMMTVReconstruction | Total variation-regularized reconstruction ]]<br />
* [[RTK/Examples/ADMMWaveletsReconstruction | Daubechies wavelets-regularized reconstruction ]]<br />
* [[RTK/Examples/4DROOSTERReconstruction | 4DROOSTER: Total variation-regularized 3D + time reconstruction ]]<br />
<br />
= Image quality =<br />
<br />
[[RTK/ImageQuality | Summary of existing and future developments for image quality in RTK]]<br />
<br />
= Geometry =<br />
<br />
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].<br />
<br />
== ImagX geometry ==<br />
<br />
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.<br />
<br />
= Developer's corner =<br />
<br />
== Developer's documentation ==<br />
<br />
We only provide the [http://www.openrtk.org/Doxygen/index.html doxygen documentation] at the moment.<br />
<br />
== Coding style ==<br />
<br />
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 [http://www.itk.org/Wiki/ITK/Coding_Style_Guide ITK's style guide].<br />
<br />
== Testing ==<br />
<br />
* The RTK dashboard is available at [http://my.cdash.org/index.php?project=RTK RTK Dashboard]<br />
* [[RTK/TestingDatasets | Documentation ]] on how to add datasets for testing (MIDAS+CDash)<br />
<br />
== Meetings ==<br />
<br />
* [[RTK/Meetings/OnImageQualityInStaticCBCT | July 31, 2015 - RTK user meeting on image quality in static CBCT]]</div>Cyril.moryhttps://wiki.openrtk.org/index.php?title=RTK/Scripts/3DCG&diff=451RTK/Scripts/3DCG2015-12-16T11:38:17Z<p>Cyril.mory: </p>
<hr />
<div><div class="floatcenter">[[File:sinogram.png|200px]] [[File:overlay.png|200px]]</div><br />
<br />
This script uses the file [http://midas3.kitware.com/midas/download?items=27326 SheppLogan.txt] as input.<br />
<br />
<source lang="bash" enclose="div"><br />
# Create a simulated geometry<br />
rtksimulatedgeometry -n 180 -o geometry.xml<br />
# You may add "--arc 200" to make the scan short or "--proj_iso_x 200" to offset the detector<br />
<br />
# Create projections of the phantom file<br />
rtkprojectgeometricphantom -g geometry.xml -o projections.mha --spacing 2 --dimension 256 --phantomfile SheppLogan.txt<br />
<br />
# Reconstruct<br />
rtkconjugategradient -p . -r projections.mha -o 3dcg.mha -g geometry.xml --spacing 2 --dimension 256 -n 20<br />
<br />
# Create a reference volume for comparison<br />
rtkdrawgeometricphantom --spacing 2 --dimension 256 --phantomfile SheppLogan.txt -o ref.mha<br />
</source><br />
<br />
In the presence of noise, all projection data may not be equally reliable. The conjugate gradient algorithm can be modified to take this into account, and each pixel of the projections can be associated with a weight. The higher the weight, the more reliable the pixel data. Download [http://midas3.kitware.com/midas/download/item/318854/noisyLineIntegrals.mha noisy projections] and [http://midas3.kitware.com/midas/download/item/318853/weightsmap.mha the associated weights], as well as [http://midas3.kitware.com/midas/download/item/318852/geom.xml the geometry], and run the following to compare the regular least squares reconstruction (without weights) and the weighted least squares reconstruction.<br />
<br />
<source lang="bash" enclose="div"><br />
# Perform least squares reconstruction<br />
rtkconjugategradient -p . -r noisyLineIntegrals.mha -o LeastSquares.mha -g geom.xml -n 20<br />
<br />
# Perform weighted least squares reconstruction<br />
rtkconjugategradient -p . -r noisyLineIntegrals.mha -o WeightedLeastSquares.mha -g geom.xml -w weightsmap.mha -n 20<br />
</source><br />
<br />
Taking the weights into account slows down convergence. This can be corrected by using a preconditioner in the conjugate gradient algorithm. The preconditioner is computed automatically from the weights map, you just need to activate the flag :<br />
<br />
<source lang="bash" enclose="div"><br />
# Perform preconditioned conjugate gradient reconstruction with weighted least squares cost function<br />
rtkconjugategradient -p . -r noisyLineIntegrals.mha -o WeightedLeastSquares.mha -g geom.xml -w weightsmap.mha -n 20 --preconditioned<br />
</source></div>Cyril.moryhttps://wiki.openrtk.org/index.php?title=RTK/Scripts/3DCG&diff=450RTK/Scripts/3DCG2015-12-16T10:50:26Z<p>Cyril.mory: Created page with "<div class="floatcenter">200px 200px</div> This script uses the file [http://midas3.kitware.com/midas/download?items=27326 SheppLog..."</p>
<hr />
<div><div class="floatcenter">[[File:sinogram.png|200px]] [[File:overlay.png|200px]]</div><br />
<br />
This script uses the file [http://midas3.kitware.com/midas/download?items=27326 SheppLogan.txt] as input.<br />
<br />
<source lang="bash" enclose="div"><br />
# Create a simulated geometry<br />
rtksimulatedgeometry -n 180 -o geometry.xml<br />
# You may add "--arc 200" to make the scan short or "--proj_iso_x 200" to offset the detector<br />
<br />
# Create projections of the phantom file<br />
rtkprojectgeometricphantom -g geometry.xml -o projections.mha --spacing 2 --dimension 256 --phantomfile SheppLogan.txt<br />
<br />
# Reconstruct<br />
rtkconjugategradient -p . -r projections.mha -o 3dcg.mha -g geometry.xml --spacing 2 --dimension 256 -n 20<br />
<br />
# Create a reference volume for comparison<br />
rtkdrawgeometricphantom --spacing 2 --dimension 256 --phantomfile SheppLogan.txt -o ref.mha<br />
</source></div>Cyril.moryhttps://wiki.openrtk.org/index.php?title=RTK_wiki_help&diff=449RTK wiki help2015-12-16T10:49:11Z<p>Cyril.mory: /* Applications */</p>
<hr />
<div>= Welcome to RTK =<br />
<br />
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:<br />
<br />
[http://www.openrtk.org/ Main website]<br />
<br />
[http://www.openrtk.org/RTK/project/project.html Project]<br />
<br />
[http://www.openrtk.org/RTK/resources/resources.html Resources]<br />
<br />
[http://www.openrtk.org/RTK/project/contactus.html Contact us]<br />
<br />
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.<br />
<br />
The three steps to starting to work with RTK are therefore:<br />
<br />
#Download and Build the ITK source<br />
#Download/Obtain/Get the RTK source<br />
#Build the RTK library<br />
#Write your own code that uses RTK and build it, linking to the RTK library. <br />
<br />
In the next sections we describe each of these steps.<br />
<br />
== Requirements ==<br />
In order to compile RTK you will need the following:<br />
* GIT (in order to get the software)<br />
* CMake (in order to configure RTK)<br />
* C/C++ compiler<br />
<br />
== Step 0 - Getting ITK ==<br />
'''RTK currently uses ITK > 4.2.0'''. <br />
<br />
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 4.5.1:<br />
<br />
git clone git://itk.org/ITK.git<br />
cd ITK<br />
git checkout v4.5.1<br />
<br />
Once ITK source code is downloaded you need to configure and generate the CMake files:<br />
<br />
mkdir ITK-bin<br />
cd ITK-bin<br />
ccmake ../ITK<br />
<br />
RTK requires the following option<br />
<br />
Module_ITKReview ON<br />
<br />
It is also recommended to use the [http://www.fftw.org FFTW] library via the options<br />
<br />
ITK_USE_FFTWD ON<br />
ITK_USE_FFTWF ON<br />
<br />
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:<br />
<br />
BUILD_DOCUMENTATION OFF<br />
BUILD_EXAMPLES OFF<br />
BUILD_TESTING OFF <br />
<br />
After generating your CMake files you are ready to start the compilation process, run:<br />
<br />
make<br />
<br />
== Step 1 - Getting RTK ==<br />
This page documents how to download RTK through [http://git-scm.com Git].<br />
Follow the ITK [[Git/Download|Git download instructions]] to install Git.<br />
<br />
To get the latest source code for RTK:<br />
git clone git://github.com/SimonRit/RTK.git<br />
<br />
== Step 2 - Building RTK ==<br />
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'<br />
<br />
mkdir RTK-bin<br />
cd RTK-bin<br />
ccmake ../RTK<br />
<br />
When CMake asks for the ITK_DIR, specify the binary directory where ITK is built and choose CMAKE_BUILD_TYPE (default: Release),<br />
<br />
ITK_DIR /path_to_directory/ITK-bin<br />
CMAKE_BUILD_TYPE Release<br />
<br />
Finally, after configuring and generating your CMake files, you can start the compilation running the following command:<br />
<br />
make<br />
<br />
== Step 3 - Running the HelloWorld application ==<br />
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<br />
<br />
BUILD_EXAMPLES ON<br />
<br />
when configuring RTK with CMake.<br />
<br />
= Tutorials =<br />
<br />
== Tutorial 0 - Building a HelloWorld application with RTK ==<br />
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'''.<br />
<br />
* First you need to create a CMakeLists.txt with the following lines:<br />
<br />
# This project is designed to be built outside the RTK source tree.<br />
PROJECT(HelloWorld)<br />
<br />
# Find the RTK libraries and includes<br />
FIND_PACKAGE(RTK REQUIRED)<br />
INCLUDE(${RTK_USE_FILE})<br />
<br />
# Executable<br />
ADD_EXECUTABLE(HelloWorld HelloWorld.cxx )<br />
TARGET_LINK_LIBRARIES(HelloWorld ${RTK_LIBRARIES})<br />
TARGET_LINK_LIBRARIES(HelloWorld ${ITK_LIBRARIES})<br />
<br />
* Create a HelloWorld.cxx file<br />
<br />
#include <rtkFDKBackProjectionImageFilter.h><br />
<br />
int main(int argc, char **argv)<br />
{<br />
// Define the type of pixel and the image dimension<br />
typedef float OutputPixelType;<br />
const unsigned int Dimension = 3;<br />
<br />
// Define the type of image<br />
typedef itk::Image< OutputPixelType, Dimension > OutputImageType;<br />
<br />
// Define and allocate the FDK Back Projection Filter<br />
typedef rtk::FDKBackProjectionImageFilter<OutputImageType, OutputImageType> BPType;<br />
BPType::Pointer p = BPType::New();<br />
<br />
std::cout << "RTK Hello World!" << std::endl;<br />
<br />
return 0;<br />
}<br />
<br />
* Run CMake on the HelloWorld directory and create a HelloWorld-bin<br />
* Configure and build the project using your favorite compiler<br />
* Run the HelloWorld application. If everything runs correctly you should see "RTK Hello World!" written on the console.<br />
<br />
== Tutorial 1 - Modifying a simple RTK application ==<br />
<br />
In RTK/applications/rtktutorialapplication/, you will find a very simple RTK application that can be used as a starting point for building more complex applications.<br />
The code suggests ways to modify the application, which should help beginners get the grip of ITK and RTK. <br />
<br />
== Tutorial 2 - My first reconstruction ==<br />
[[RTK/Examples/FirstReconstruction | Reconstruct a Sphere]]<br />
<br />
= Wrapping =<br />
<br />
[[SimpleRTK]] provides a wrapping mechanism to several languages such as Python and C#.<br />
<br />
= Applications =<br />
<br />
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.<br />
<br />
* [[RTK/Scripts/FDK | FDK Shepp Logan ]]<br />
* [[RTK/Scripts/3DCG | 3D Conjugate Gradient ]]<br />
* [[RTK/Scripts/ForwardProjection | Forward projection ]]<br />
* [[RTK/Scripts/RayBoxIntersection | Ray/box projections and reconstruction ]]<br />
* [[RTK/Scripts/DrawGeometricPhantom | 3D geometric phantom ]]<br />
* [[RTK/Scripts/CreateGammexPhantom | 3D gammex phantom ]]<br />
* [[RTK/Scripts/AmsterdamShroud | Amsterdam Shroud image ]]<br />
* [[RTK/Examples/ElektaReconstruction | Reconstruct from Elekta Data]]<br />
* [[RTK/Examples/VarianReconstruction | Reconstruct from Varian Data]]<br />
* [[RTK/Examples/MCCBCTReconstruction | Motion-compensated reconstruction ]]<br />
* [[RTK/Examples/ADMMTVReconstruction | Total variation-regularized reconstruction ]]<br />
* [[RTK/Examples/ADMMWaveletsReconstruction | Daubechies wavelets-regularized reconstruction ]]<br />
* [[RTK/Examples/4DROOSTERReconstruction | 4DROOSTER: Total variation-regularized 3D + time reconstruction ]]<br />
<br />
= Image quality =<br />
<br />
[[RTK/ImageQuality | Summary of existing and future developments for image quality in RTK]]<br />
<br />
= Geometry =<br />
<br />
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].<br />
<br />
== ImagX geometry ==<br />
<br />
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.<br />
<br />
= Developer's corner =<br />
<br />
== Developer's documentation ==<br />
<br />
We only provide the [http://www.openrtk.org/Doxygen/index.html doxygen documentation] at the moment.<br />
<br />
== Coding style ==<br />
<br />
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 [http://www.itk.org/Wiki/ITK/Coding_Style_Guide ITK's style guide].<br />
<br />
== Testing ==<br />
<br />
* The RTK dashboard is available at [http://my.cdash.org/index.php?project=RTK RTK Dashboard]<br />
* [[RTK/TestingDatasets | Documentation ]] on how to add datasets for testing (MIDAS+CDash)<br />
<br />
== Meetings ==<br />
<br />
* [[RTK/Meetings/OnImageQualityInStaticCBCT | July 31, 2015 - RTK user meeting on image quality in static CBCT]]</div>Cyril.moryhttps://wiki.openrtk.org/index.php?title=RTK/Meetings/TrainingNov15&diff=431RTK/Meetings/TrainingNov152015-10-26T16:01:16Z<p>Cyril.mory: /* Regularized iterative 4D reconstruction */</p>
<hr />
<div>= Basic operators =<br />
<br />
Here is a list of the RTK command lines you will have to run during the training, along with the data you will need.<br />
To start, download the following [http://midas3.kitware.com/midas/download/item/318788/muCT.mha CT data] and a relevant Cone-Beam CT [http://midas3.kitware.com/midas/download/item/318790/geometry.xml geometry file].<br />
<br />
== Forward projection ==<br />
<br />
To forward project the CT volume, following the geometry described in geometry.xml, run<br />
<br />
<source lang="bash" enclose="div"><br />
rtkforwardprojections -i muCT.mha -o projections.mha -g geometry.xml<br />
</source><br />
<br />
Look at the result using vv<br />
<br />
<source lang="bash" enclose="div"><br />
vv projections.mha<br />
</source><br />
<br />
There are as many projections as described in the geometry.xml file. You can edit the geometry.xml file, remove all projections except one, and try again. Such a modified geometry file is available [http://midas3.kitware.com/midas/download/item/318789/singleProjectionGeometry.xml here]. Run the following command line<br />
<br />
<source lang="bash" enclose="div"><br />
rtkforwardprojections -i muCT.mha -o singleProjection.mha -g singleProjectionGeometry.xml<br />
</source><br />
<br />
You can check with vv that the file contains only one projection<br />
<br />
<source lang="bash" enclose="div"><br />
vv singleProjection.mha<br />
</source><br />
<br />
== Back projection ==<br />
<br />
Start by back projecting a single projection. Run<br />
<br />
<source lang="bash" enclose="div"><br />
rtkbackprojections -p . -r singleProjection.mha -o singleBackProjection.mha -g singleProjectionGeometry.xml<br />
</source><br />
<br />
Observe the result with vv<br />
<br />
<source lang="bash" enclose="div"><br />
vv singleBackProjection.mha<br />
</source><br />
<br />
As you can see, the projection data seems to be smeared into the volume. Now back project all projections, by running<br />
<br />
<source lang="bash" enclose="div"><br />
rtkbackprojections -p . -r projections.mha -o backProjection.mha -g geometry.xml<br />
</source><br />
<br />
Look at the result with vv. In order to compare it with the original image, run <br />
<br />
<source lang="bash" enclose="div"><br />
vv backProjection.mha muCT.mha --linkall<br />
</source><br />
<br />
Click in one of the display windows, hit 'Ctrl + G' to center the view on the tumor. Hit 'w' to automatically compute reasonable window and level values. You can navigate between "muCT.mha" and "backProjection.mha" by hitting the 'Tab' key.<br />
<br />
== Using different forward and back projection algorithms ==<br />
<br />
Both rtkforwardprojections and rtkbackprojections can use several algorithms to perform the forward or back projections. For forward projections, you can try the following command lines<br />
<br />
<source lang="bash" enclose="div"><br />
rtkforwardprojections -i muCT.mha -o josephProjections.mha -g geometry.xml --fp Joseph<br />
</source><br />
<source lang="bash" enclose="div"><br />
rtkforwardprojections -i muCT.mha -o rayCastInterpolatorProjections.mha -g geometry.xml --fp RayCastInterpolator<br />
</source><br />
<br />
And for back projection<br />
<br />
<source lang="bash" enclose="div"><br />
rtkbackprojections -p . -r projections.mha -o voxelBasedBackProjection.mha -g geometry.xml --bp VoxelBasedBackProjection<br />
</source><br />
<source lang="bash" enclose="div"><br />
rtkbackprojections -p . -r projections.mha -o josephBackProjection.mha -g geometry.xml --bp Joseph<br />
</source><br />
<source lang="bash" enclose="div"><br />
rtkbackprojections -p . -r projections.mha -o normalizedJosephBackProjection.mha -g geometry.xml --bp NormalizedJoseph<br />
</source><br />
<br />
If you have a CUDA-capable graphics card, and have compiled RTK with RTK_USE_CUDA=ON, you can also try the following<br />
<br />
<source lang="bash" enclose="div"><br />
rtkforwardprojections -i muCT.mha -o cudaRayCastProjections.mha -g geometry.xml --fp CudaRayCast<br />
</source><br />
<source lang="bash" enclose="div"><br />
rtkbackprojections -p . -r projections.mha -o cudaRayCastBackProjection.mha -g geometry.xml --bp CudaRayCast<br />
</source><br />
<source lang="bash" enclose="div"><br />
rtkbackprojections -p . -r projections.mha -o cudaBackProjection.mha -g geometry.xml --bp CudaBackProjection<br />
</source><br />
<br />
= 3D Reconstruction =<br />
<br />
== Creating a very small dataset ==<br />
<br />
Various reconstruction algorithms exist, which employ forward and back projection extensively. We will now start performing real reconstructions using some of the algorithms implemented in RTK. Since these algorithms are computationally much more demanding than the standard FDK, we propose to run them with low resolution data. You will be able to re-compute them at full resolution later, since the present page will remain available to you after the training. Note that, for the regularized reconstruction techniques, you will have to re-tune the regularization parameters yourself, since they depend (among many things) on resolution.<br />
<br />
Start by downloading the cone beam CT projection data [http://midas3.kitware.com/midas/download/item/208648/projections.tgz here], and extract it. It contains 644 projections, each one in a ".his" file. You can view them in vv by typing<br />
<br />
<source lang="bash" enclose="div"><br />
vv --sequence *.his<br />
</source><br />
<br />
RTK has a collection of tools to convert and preprocess commercial CBCT projection data, most of which are combined in the application "rtkprojections". To convert and preprocess these projections, run<br />
<br />
<source lang="bash" enclose="div"><br />
rtkprojections -p . -r .*.his -o downsampledProjections.mha --binning "4, 4"<br />
</source><br />
<br />
The '--binning "4, 4"' option downsamples the projections by 4 along both axes. Since this is not enough to reach acceptable reconstruction times for the training, we will build a sub-dataset by selecting only one projection out of 5. You can do this by running <br />
<br />
<source lang="bash" enclose="div"><br />
rtksubselect -p . -r downsampledProjections.mha -g geometry.xml --out_geometry subGeometry.xml --out_proj subProjections.mha -s 5<br />
</source><br />
<br />
This creates a new geometry file and a new projections file, from which even a laptop should be able to perform iterative reconstruction in reasonable time.<br />
<br />
== Unregularized 3D iterative reconstruction algorithms ==<br />
<br />
The most popular iterative reconstruction algorithm is the Simultaneous Algebraic Reconstruction Technique (SART). Try it by running<br />
<br />
<source lang="bash" enclose="div"><br />
rtksart -p . -r subProjections.mha -g subGeometry.xml -o SART.mha --dimension 128 --spacing 3<br />
</source><br />
<br />
Another popular technique uses the conjugate gradient algorithm<br />
<br />
<source lang="bash" enclose="div"><br />
rtkconjugategradient -p . -r subProjections.mha -g subGeometry.xml -o CG.mha --dimension 128 --spacing 3 -n 10<br />
</source><br />
<br />
You can compare the results by running<br />
<br />
<source lang="bash" enclose="div"><br />
vv SART.mha CG.mha --linkall<br />
</source><br />
<br />
The SART reconstruction should be sharper than the conjugate gradient one. If you are interested in understanding the reasons for this difference, try running <br />
<br />
<source lang="bash" enclose="div"><br />
rtksart -p . -r subProjections.mha -g subGeometry.xml -o OSSART_10projsPerSubset.mha --dimension 128 --spacing 3 --nprojspersubset 10<br />
</source><br />
<br />
The differences in image quality (sharpness, contrast, ...) and convergence speed, stability, ... between the various algorithms may be discussed briefly during the training.<br />
<br />
== Regularized 3D iterative reconstruction algorithms ==<br />
<br />
RTK also includes algorithms that perform regularization during the reconstruction. You can try for example<br />
<br />
<source lang="bash" enclose="div"><br />
rtkadmmtotalvariation -p . -r subProjections.mha -g subGeometry.xml -o admmTV.mha --dimension 128 --spacing 3 -n 10 --beta 1000 --alpha 1<br />
</source><br />
<br />
and<br />
<br />
<source lang="bash" enclose="div"><br />
rtkadmmwavelets -p . -r subProjections.mha -g subGeometry.xml -o admmWavelets.mha --dimension 128 --spacing 3 -n 10 --beta 1000 --alpha 1<br />
</source><br />
<br />
Note that these algorithms have little interest when working with such low resolution data, since most of the noise and artifacts they are meant to remove have already been eliminated by undersampling.<br />
<br />
= 4D Iterative reconstruction =<br />
<br />
The 4D reconstruction applications may take a long time to compute. If you do not have a CUDA-capable GPU, you may want to skip them and take the reconstruction results directly from the USB key you received at the beginning of the training. If you do have a CUDA-capable GPU and have compiled RTK with RTK_USE_CUDA=ON, you can add <br />
<br />
<source lang="bash" enclose="div"><br />
--fp CudaRayCast --bp CudaVoxelBased<br />
</source><br />
<br />
to the reconstruction command lines in order to use it.<br />
<br />
== Extracting respiratory phase ==<br />
<br />
RTK includes a tool to extract the phase of respiratory motion from the projection data. It uses an intermediate image built from the stack of projections, called the "shroud". Run<br />
<br />
<source lang="bash" enclose="div"><br />
rtkamsterdamshroud -p . -r .*.his -o shroud.mhd<br />
</source><br />
<br />
and open the shroud image with vv:<br />
<br />
<source lang="bash" enclose="div"><br />
vv shroud.mhd<br />
</source><br />
<br />
You will notice that a periodic signal is visible in the image. Before we try to retrieve this signal's phase, we need to remove the parts of the image affected by low frequency noise. Try<br />
<br />
<source lang="bash" enclose="div"><br />
rtkamsterdamshroud -p . -r .*.his -o cshroud.mhd --lowercrop "0, 270, 0" --upper "0, 112, 0"<br />
</source><br />
<br />
The cropped shroud can be viewed with vv:<br />
<br />
<source lang="bash" enclose="div"><br />
vv cshroud.mhd<br />
</source><br />
<br />
This cropped shroud will be used to extract a phase signal, with another RTK command. Run<br />
<br />
<source lang="bash" enclose="div"><br />
rtkextractshroudsignal -i cshroud.mhd -o signal.txt -p cphase.txt<br />
</source><br />
<br />
If you have Python installed, you can download [http://midas3.kitware.com/midas/download/item/318791/showPeaksOverShroud.py this script] and run it from your working directory. It will generate an image with the cropped shroud in background and the detected minima in foreground, in red.<br />
<br />
== Unregularized iterative 4D reconstruction ==<br />
<br />
RTK includes several algorithms for 4D reconstruction. Similarly to 3D, you can try them with the following commands<br />
<br />
<source lang="bash" enclose="div"><br />
rtkfourdsart -p . -r downsampledProjections.mha -g geometry.xml -o 4DSART.mha --signal cphase.txt --dimension 128 --spacing 3<br />
</source><br />
<source lang="bash" enclose="div"><br />
rtkfourdconjugategradient -p . -r downsampledProjections.mha -g geometry.xml -o 4DCG.mha --signal cphase.txt --dimension 128 --spacing 3<br />
</source><br />
<br />
== Regularized iterative 4D reconstruction ==<br />
<br />
Just like in 3D reconstruction, regularity conditions can be added in 4D reconstruction. Actually, 4D reconstruction even allows more regularization: since the whole respiratory cycle is reconstructed at once, regularization along time can be applied. RTK includes an application to perform regularized 4D reconstruction, called ROOSTER. <br />
It requires a motion mask, which you can download [http://midas3.kitware.com/midas/download/item/208652/mm_50.mha here].<br />
You can try ROOSTER by running<br />
<br />
<source lang="bash" enclose="div"><br />
rtkfourdrooster -p . -r downsampledProjections.mha -g geometry.xml -o 4DROOSTER.mha --signal cphase.txt --dimension 128 --spacing 3 --gamma_time 0.0005 --gamma_space 0.0001 --motionmask mm_50.mha<br />
</source></div>Cyril.moryhttps://wiki.openrtk.org/index.php?title=RTK/Meetings/TrainingNov15&diff=430RTK/Meetings/TrainingNov152015-10-26T16:00:10Z<p>Cyril.mory: /* 4D Iterative reconstruction */</p>
<hr />
<div>= Basic operators =<br />
<br />
Here is a list of the RTK command lines you will have to run during the training, along with the data you will need.<br />
To start, download the following [http://midas3.kitware.com/midas/download/item/318788/muCT.mha CT data] and a relevant Cone-Beam CT [http://midas3.kitware.com/midas/download/item/318790/geometry.xml geometry file].<br />
<br />
== Forward projection ==<br />
<br />
To forward project the CT volume, following the geometry described in geometry.xml, run<br />
<br />
<source lang="bash" enclose="div"><br />
rtkforwardprojections -i muCT.mha -o projections.mha -g geometry.xml<br />
</source><br />
<br />
Look at the result using vv<br />
<br />
<source lang="bash" enclose="div"><br />
vv projections.mha<br />
</source><br />
<br />
There are as many projections as described in the geometry.xml file. You can edit the geometry.xml file, remove all projections except one, and try again. Such a modified geometry file is available [http://midas3.kitware.com/midas/download/item/318789/singleProjectionGeometry.xml here]. Run the following command line<br />
<br />
<source lang="bash" enclose="div"><br />
rtkforwardprojections -i muCT.mha -o singleProjection.mha -g singleProjectionGeometry.xml<br />
</source><br />
<br />
You can check with vv that the file contains only one projection<br />
<br />
<source lang="bash" enclose="div"><br />
vv singleProjection.mha<br />
</source><br />
<br />
== Back projection ==<br />
<br />
Start by back projecting a single projection. Run<br />
<br />
<source lang="bash" enclose="div"><br />
rtkbackprojections -p . -r singleProjection.mha -o singleBackProjection.mha -g singleProjectionGeometry.xml<br />
</source><br />
<br />
Observe the result with vv<br />
<br />
<source lang="bash" enclose="div"><br />
vv singleBackProjection.mha<br />
</source><br />
<br />
As you can see, the projection data seems to be smeared into the volume. Now back project all projections, by running<br />
<br />
<source lang="bash" enclose="div"><br />
rtkbackprojections -p . -r projections.mha -o backProjection.mha -g geometry.xml<br />
</source><br />
<br />
Look at the result with vv. In order to compare it with the original image, run <br />
<br />
<source lang="bash" enclose="div"><br />
vv backProjection.mha muCT.mha --linkall<br />
</source><br />
<br />
Click in one of the display windows, hit 'Ctrl + G' to center the view on the tumor. Hit 'w' to automatically compute reasonable window and level values. You can navigate between "muCT.mha" and "backProjection.mha" by hitting the 'Tab' key.<br />
<br />
== Using different forward and back projection algorithms ==<br />
<br />
Both rtkforwardprojections and rtkbackprojections can use several algorithms to perform the forward or back projections. For forward projections, you can try the following command lines<br />
<br />
<source lang="bash" enclose="div"><br />
rtkforwardprojections -i muCT.mha -o josephProjections.mha -g geometry.xml --fp Joseph<br />
</source><br />
<source lang="bash" enclose="div"><br />
rtkforwardprojections -i muCT.mha -o rayCastInterpolatorProjections.mha -g geometry.xml --fp RayCastInterpolator<br />
</source><br />
<br />
And for back projection<br />
<br />
<source lang="bash" enclose="div"><br />
rtkbackprojections -p . -r projections.mha -o voxelBasedBackProjection.mha -g geometry.xml --bp VoxelBasedBackProjection<br />
</source><br />
<source lang="bash" enclose="div"><br />
rtkbackprojections -p . -r projections.mha -o josephBackProjection.mha -g geometry.xml --bp Joseph<br />
</source><br />
<source lang="bash" enclose="div"><br />
rtkbackprojections -p . -r projections.mha -o normalizedJosephBackProjection.mha -g geometry.xml --bp NormalizedJoseph<br />
</source><br />
<br />
If you have a CUDA-capable graphics card, and have compiled RTK with RTK_USE_CUDA=ON, you can also try the following<br />
<br />
<source lang="bash" enclose="div"><br />
rtkforwardprojections -i muCT.mha -o cudaRayCastProjections.mha -g geometry.xml --fp CudaRayCast<br />
</source><br />
<source lang="bash" enclose="div"><br />
rtkbackprojections -p . -r projections.mha -o cudaRayCastBackProjection.mha -g geometry.xml --bp CudaRayCast<br />
</source><br />
<source lang="bash" enclose="div"><br />
rtkbackprojections -p . -r projections.mha -o cudaBackProjection.mha -g geometry.xml --bp CudaBackProjection<br />
</source><br />
<br />
= 3D Reconstruction =<br />
<br />
== Creating a very small dataset ==<br />
<br />
Various reconstruction algorithms exist, which employ forward and back projection extensively. We will now start performing real reconstructions using some of the algorithms implemented in RTK. Since these algorithms are computationally much more demanding than the standard FDK, we propose to run them with low resolution data. You will be able to re-compute them at full resolution later, since the present page will remain available to you after the training. Note that, for the regularized reconstruction techniques, you will have to re-tune the regularization parameters yourself, since they depend (among many things) on resolution.<br />
<br />
Start by downloading the cone beam CT projection data [http://midas3.kitware.com/midas/download/item/208648/projections.tgz here], and extract it. It contains 644 projections, each one in a ".his" file. You can view them in vv by typing<br />
<br />
<source lang="bash" enclose="div"><br />
vv --sequence *.his<br />
</source><br />
<br />
RTK has a collection of tools to convert and preprocess commercial CBCT projection data, most of which are combined in the application "rtkprojections". To convert and preprocess these projections, run<br />
<br />
<source lang="bash" enclose="div"><br />
rtkprojections -p . -r .*.his -o downsampledProjections.mha --binning "4, 4"<br />
</source><br />
<br />
The '--binning "4, 4"' option downsamples the projections by 4 along both axes. Since this is not enough to reach acceptable reconstruction times for the training, we will build a sub-dataset by selecting only one projection out of 5. You can do this by running <br />
<br />
<source lang="bash" enclose="div"><br />
rtksubselect -p . -r downsampledProjections.mha -g geometry.xml --out_geometry subGeometry.xml --out_proj subProjections.mha -s 5<br />
</source><br />
<br />
This creates a new geometry file and a new projections file, from which even a laptop should be able to perform iterative reconstruction in reasonable time.<br />
<br />
== Unregularized 3D iterative reconstruction algorithms ==<br />
<br />
The most popular iterative reconstruction algorithm is the Simultaneous Algebraic Reconstruction Technique (SART). Try it by running<br />
<br />
<source lang="bash" enclose="div"><br />
rtksart -p . -r subProjections.mha -g subGeometry.xml -o SART.mha --dimension 128 --spacing 3<br />
</source><br />
<br />
Another popular technique uses the conjugate gradient algorithm<br />
<br />
<source lang="bash" enclose="div"><br />
rtkconjugategradient -p . -r subProjections.mha -g subGeometry.xml -o CG.mha --dimension 128 --spacing 3 -n 10<br />
</source><br />
<br />
You can compare the results by running<br />
<br />
<source lang="bash" enclose="div"><br />
vv SART.mha CG.mha --linkall<br />
</source><br />
<br />
The SART reconstruction should be sharper than the conjugate gradient one. If you are interested in understanding the reasons for this difference, try running <br />
<br />
<source lang="bash" enclose="div"><br />
rtksart -p . -r subProjections.mha -g subGeometry.xml -o OSSART_10projsPerSubset.mha --dimension 128 --spacing 3 --nprojspersubset 10<br />
</source><br />
<br />
The differences in image quality (sharpness, contrast, ...) and convergence speed, stability, ... between the various algorithms may be discussed briefly during the training.<br />
<br />
== Regularized 3D iterative reconstruction algorithms ==<br />
<br />
RTK also includes algorithms that perform regularization during the reconstruction. You can try for example<br />
<br />
<source lang="bash" enclose="div"><br />
rtkadmmtotalvariation -p . -r subProjections.mha -g subGeometry.xml -o admmTV.mha --dimension 128 --spacing 3 -n 10 --beta 1000 --alpha 1<br />
</source><br />
<br />
and<br />
<br />
<source lang="bash" enclose="div"><br />
rtkadmmwavelets -p . -r subProjections.mha -g subGeometry.xml -o admmWavelets.mha --dimension 128 --spacing 3 -n 10 --beta 1000 --alpha 1<br />
</source><br />
<br />
Note that these algorithms have little interest when working with such low resolution data, since most of the noise and artifacts they are meant to remove have already been eliminated by undersampling.<br />
<br />
= 4D Iterative reconstruction =<br />
<br />
The 4D reconstruction applications may take a long time to compute. If you do not have a CUDA-capable GPU, you may want to skip them and take the reconstruction results directly from the USB key you received at the beginning of the training. If you do have a CUDA-capable GPU and have compiled RTK with RTK_USE_CUDA=ON, you can add <br />
<br />
<source lang="bash" enclose="div"><br />
--fp CudaRayCast --bp CudaVoxelBased<br />
</source><br />
<br />
to the reconstruction command lines in order to use it.<br />
<br />
== Extracting respiratory phase ==<br />
<br />
RTK includes a tool to extract the phase of respiratory motion from the projection data. It uses an intermediate image built from the stack of projections, called the "shroud". Run<br />
<br />
<source lang="bash" enclose="div"><br />
rtkamsterdamshroud -p . -r .*.his -o shroud.mhd<br />
</source><br />
<br />
and open the shroud image with vv:<br />
<br />
<source lang="bash" enclose="div"><br />
vv shroud.mhd<br />
</source><br />
<br />
You will notice that a periodic signal is visible in the image. Before we try to retrieve this signal's phase, we need to remove the parts of the image affected by low frequency noise. Try<br />
<br />
<source lang="bash" enclose="div"><br />
rtkamsterdamshroud -p . -r .*.his -o cshroud.mhd --lowercrop "0, 270, 0" --upper "0, 112, 0"<br />
</source><br />
<br />
The cropped shroud can be viewed with vv:<br />
<br />
<source lang="bash" enclose="div"><br />
vv cshroud.mhd<br />
</source><br />
<br />
This cropped shroud will be used to extract a phase signal, with another RTK command. Run<br />
<br />
<source lang="bash" enclose="div"><br />
rtkextractshroudsignal -i cshroud.mhd -o signal.txt -p cphase.txt<br />
</source><br />
<br />
If you have Python installed, you can download [http://midas3.kitware.com/midas/download/item/318791/showPeaksOverShroud.py this script] and run it from your working directory. It will generate an image with the cropped shroud in background and the detected minima in foreground, in red.<br />
<br />
== Unregularized iterative 4D reconstruction ==<br />
<br />
RTK includes several algorithms for 4D reconstruction. Similarly to 3D, you can try them with the following commands<br />
<br />
<source lang="bash" enclose="div"><br />
rtkfourdsart -p . -r downsampledProjections.mha -g geometry.xml -o 4DSART.mha --signal cphase.txt --dimension 128 --spacing 3<br />
</source><br />
<source lang="bash" enclose="div"><br />
rtkfourdconjugategradient -p . -r downsampledProjections.mha -g geometry.xml -o 4DCG.mha --signal cphase.txt --dimension 128 --spacing 3<br />
</source><br />
<br />
== Regularized iterative 4D reconstruction ==<br />
<br />
Just like in 3D reconstruction, regularity conditions can be added in 4D reconstruction. Actually, 4D reconstruction even allows more regularization: since the whole respiratory cycle is reconstructed at once, regularization along time can be applied. RTK includes an application to perform regularized 4D reconstruction, called ROOSTER. <br />
It requires a motion mask, which you can download [http://midas3.kitware.com/midas/download/item/208652/mm_50.mha here]<br />
You can try ROOSTER by running<br />
<br />
<source lang="bash" enclose="div"><br />
rtkfourdrooster -p . -r downsampledProjections.mha -g geometry.xml -o 4DROOSTER.mha --signal cphase.txt --dimension 128 --spacing 3 --gamma_time 0.0005 --gamma_space 0.0001 --motionmask mm_50.mha<br />
</source></div>Cyril.moryhttps://wiki.openrtk.org/index.php?title=RTK/Meetings/TrainingNov15&diff=429RTK/Meetings/TrainingNov152015-10-26T15:32:12Z<p>Cyril.mory: /* 4D Iterative reconstruction */</p>
<hr />
<div>= Basic operators =<br />
<br />
Here is a list of the RTK command lines you will have to run during the training, along with the data you will need.<br />
To start, download the following [http://midas3.kitware.com/midas/download/item/318788/muCT.mha CT data] and a relevant Cone-Beam CT [http://midas3.kitware.com/midas/download/item/318790/geometry.xml geometry file].<br />
<br />
== Forward projection ==<br />
<br />
To forward project the CT volume, following the geometry described in geometry.xml, run<br />
<br />
<source lang="bash" enclose="div"><br />
rtkforwardprojections -i muCT.mha -o projections.mha -g geometry.xml<br />
</source><br />
<br />
Look at the result using vv<br />
<br />
<source lang="bash" enclose="div"><br />
vv projections.mha<br />
</source><br />
<br />
There are as many projections as described in the geometry.xml file. You can edit the geometry.xml file, remove all projections except one, and try again. Such a modified geometry file is available [http://midas3.kitware.com/midas/download/item/318789/singleProjectionGeometry.xml here]. Run the following command line<br />
<br />
<source lang="bash" enclose="div"><br />
rtkforwardprojections -i muCT.mha -o singleProjection.mha -g singleProjectionGeometry.xml<br />
</source><br />
<br />
You can check with vv that the file contains only one projection<br />
<br />
<source lang="bash" enclose="div"><br />
vv singleProjection.mha<br />
</source><br />
<br />
== Back projection ==<br />
<br />
Start by back projecting a single projection. Run<br />
<br />
<source lang="bash" enclose="div"><br />
rtkbackprojections -p . -r singleProjection.mha -o singleBackProjection.mha -g singleProjectionGeometry.xml<br />
</source><br />
<br />
Observe the result with vv<br />
<br />
<source lang="bash" enclose="div"><br />
vv singleBackProjection.mha<br />
</source><br />
<br />
As you can see, the projection data seems to be smeared into the volume. Now back project all projections, by running<br />
<br />
<source lang="bash" enclose="div"><br />
rtkbackprojections -p . -r projections.mha -o backProjection.mha -g geometry.xml<br />
</source><br />
<br />
Look at the result with vv. In order to compare it with the original image, run <br />
<br />
<source lang="bash" enclose="div"><br />
vv backProjection.mha muCT.mha --linkall<br />
</source><br />
<br />
Click in one of the display windows, hit 'Ctrl + G' to center the view on the tumor. Hit 'w' to automatically compute reasonable window and level values. You can navigate between "muCT.mha" and "backProjection.mha" by hitting the 'Tab' key.<br />
<br />
== Using different forward and back projection algorithms ==<br />
<br />
Both rtkforwardprojections and rtkbackprojections can use several algorithms to perform the forward or back projections. For forward projections, you can try the following command lines<br />
<br />
<source lang="bash" enclose="div"><br />
rtkforwardprojections -i muCT.mha -o josephProjections.mha -g geometry.xml --fp Joseph<br />
</source><br />
<source lang="bash" enclose="div"><br />
rtkforwardprojections -i muCT.mha -o rayCastInterpolatorProjections.mha -g geometry.xml --fp RayCastInterpolator<br />
</source><br />
<br />
And for back projection<br />
<br />
<source lang="bash" enclose="div"><br />
rtkbackprojections -p . -r projections.mha -o voxelBasedBackProjection.mha -g geometry.xml --bp VoxelBasedBackProjection<br />
</source><br />
<source lang="bash" enclose="div"><br />
rtkbackprojections -p . -r projections.mha -o josephBackProjection.mha -g geometry.xml --bp Joseph<br />
</source><br />
<source lang="bash" enclose="div"><br />
rtkbackprojections -p . -r projections.mha -o normalizedJosephBackProjection.mha -g geometry.xml --bp NormalizedJoseph<br />
</source><br />
<br />
If you have a CUDA-capable graphics card, and have compiled RTK with RTK_USE_CUDA=ON, you can also try the following<br />
<br />
<source lang="bash" enclose="div"><br />
rtkforwardprojections -i muCT.mha -o cudaRayCastProjections.mha -g geometry.xml --fp CudaRayCast<br />
</source><br />
<source lang="bash" enclose="div"><br />
rtkbackprojections -p . -r projections.mha -o cudaRayCastBackProjection.mha -g geometry.xml --bp CudaRayCast<br />
</source><br />
<source lang="bash" enclose="div"><br />
rtkbackprojections -p . -r projections.mha -o cudaBackProjection.mha -g geometry.xml --bp CudaBackProjection<br />
</source><br />
<br />
= 3D Reconstruction =<br />
<br />
== Creating a very small dataset ==<br />
<br />
Various reconstruction algorithms exist, which employ forward and back projection extensively. We will now start performing real reconstructions using some of the algorithms implemented in RTK. Since these algorithms are computationally much more demanding than the standard FDK, we propose to run them with low resolution data. You will be able to re-compute them at full resolution later, since the present page will remain available to you after the training. Note that, for the regularized reconstruction techniques, you will have to re-tune the regularization parameters yourself, since they depend (among many things) on resolution.<br />
<br />
Start by downloading the cone beam CT projection data [http://midas3.kitware.com/midas/download/item/208648/projections.tgz here], and extract it. It contains 644 projections, each one in a ".his" file. You can view them in vv by typing<br />
<br />
<source lang="bash" enclose="div"><br />
vv --sequence *.his<br />
</source><br />
<br />
RTK has a collection of tools to convert and preprocess commercial CBCT projection data, most of which are combined in the application "rtkprojections". To convert and preprocess these projections, run<br />
<br />
<source lang="bash" enclose="div"><br />
rtkprojections -p . -r .*.his -o downsampledProjections.mha --binning "4, 4"<br />
</source><br />
<br />
The '--binning "4, 4"' option downsamples the projections by 4 along both axes. Since this is not enough to reach acceptable reconstruction times for the training, we will build a sub-dataset by selecting only one projection out of 5. You can do this by running <br />
<br />
<source lang="bash" enclose="div"><br />
rtksubselect -p . -r downsampledProjections.mha -g geometry.xml --out_geometry subGeometry.xml --out_proj subProjections.mha -s 5<br />
</source><br />
<br />
This creates a new geometry file and a new projections file, from which even a laptop should be able to perform iterative reconstruction in reasonable time.<br />
<br />
== Unregularized 3D iterative reconstruction algorithms ==<br />
<br />
The most popular iterative reconstruction algorithm is the Simultaneous Algebraic Reconstruction Technique (SART). Try it by running<br />
<br />
<source lang="bash" enclose="div"><br />
rtksart -p . -r subProjections.mha -g subGeometry.xml -o SART.mha --dimension 128 --spacing 3<br />
</source><br />
<br />
Another popular technique uses the conjugate gradient algorithm<br />
<br />
<source lang="bash" enclose="div"><br />
rtkconjugategradient -p . -r subProjections.mha -g subGeometry.xml -o CG.mha --dimension 128 --spacing 3 -n 10<br />
</source><br />
<br />
You can compare the results by running<br />
<br />
<source lang="bash" enclose="div"><br />
vv SART.mha CG.mha --linkall<br />
</source><br />
<br />
The SART reconstruction should be sharper than the conjugate gradient one. If you are interested in understanding the reasons for this difference, try running <br />
<br />
<source lang="bash" enclose="div"><br />
rtksart -p . -r subProjections.mha -g subGeometry.xml -o OSSART_10projsPerSubset.mha --dimension 128 --spacing 3 --nprojspersubset 10<br />
</source><br />
<br />
The differences in image quality (sharpness, contrast, ...) and convergence speed, stability, ... between the various algorithms may be discussed briefly during the training.<br />
<br />
== Regularized 3D iterative reconstruction algorithms ==<br />
<br />
RTK also includes algorithms that perform regularization during the reconstruction. You can try for example<br />
<br />
<source lang="bash" enclose="div"><br />
rtkadmmtotalvariation -p . -r subProjections.mha -g subGeometry.xml -o admmTV.mha --dimension 128 --spacing 3 -n 10 --beta 1000 --alpha 1<br />
</source><br />
<br />
and<br />
<br />
<source lang="bash" enclose="div"><br />
rtkadmmwavelets -p . -r subProjections.mha -g subGeometry.xml -o admmWavelets.mha --dimension 128 --spacing 3 -n 10 --beta 1000 --alpha 1<br />
</source><br />
<br />
Note that these algorithms have little interest when working with such low resolution data, since most of the noise and artifacts they are meant to remove have already been eliminated by undersampling.<br />
<br />
= 4D Iterative reconstruction =<br />
<br />
The 4D reconstruction applications may take a long time to compute. If you do not have a CUDA-capable GPU, you may want to skip them and take the reconstruction results directly from the USB key you received at the beginning of the training.<br />
<br />
== Extracting respiratory phase ==<br />
<br />
RTK includes a tool to extract the phase of respiratory motion from the projection data. It uses an intermediate image built from the stack of projections, called the "shroud". Run<br />
<br />
<source lang="bash" enclose="div"><br />
rtkamsterdamshroud -p . -r .*.his -o shroud.mhd<br />
</source><br />
<br />
and open the shroud image with vv:<br />
<br />
<source lang="bash" enclose="div"><br />
vv shroud.mhd<br />
</source><br />
<br />
You will notice that a periodic signal is visible in the image. Before we try to retrieve this signal's phase, we need to remove the parts of the image affected by low frequency noise. Try<br />
<br />
<source lang="bash" enclose="div"><br />
rtkamsterdamshroud -p . -r .*.his -o cshroud.mhd --lowercrop "0, 270, 0" --upper "0, 112, 0"<br />
</source><br />
<br />
The cropped shroud can be viewed with vv:<br />
<br />
<source lang="bash" enclose="div"><br />
vv cshroud.mhd<br />
</source><br />
<br />
This cropped shroud will be used to extract a phase signal, with another RTK command. Run<br />
<br />
<source lang="bash" enclose="div"><br />
rtkextractshroudsignal -i cshroud.mhd -o signal.txt -p cphase.txt<br />
</source><br />
<br />
If you have Python installed, you can download [http://midas3.kitware.com/midas/download/item/318791/showPeaksOverShroud.py this script] and run it from your working directory. It will generate an image with the cropped shroud in background and the detected minima in foreground, in red.<br />
<br />
== Unregularized iterative 4D reconstruction ==<br />
<br />
RTK includes several algorithms for 4D reconstruction. Similarly to 3D, you can try them with the following commands<br />
<br />
<source lang="bash" enclose="div"><br />
rtkfourdsart -p . -r downsampledProjections.mha -g geometry.xml -o 4DSART.mha --signal cphase.txt --dimension 128 --spacing 3<br />
</source><br />
<source lang="bash" enclose="div"><br />
rtkfourdconjugategradient -p . -r downsampledProjections.mha -g geometry.xml -o 4DCG.mha --signal cphase.txt --dimension 128 --spacing 3<br />
</source></div>Cyril.moryhttps://wiki.openrtk.org/index.php?title=RTK/Meetings/TrainingNov15&diff=428RTK/Meetings/TrainingNov152015-10-26T15:29:33Z<p>Cyril.mory: /* Unregularized iterative 4D reconstruction */</p>
<hr />
<div>= Basic operators =<br />
<br />
Here is a list of the RTK command lines you will have to run during the training, along with the data you will need.<br />
To start, download the following [http://midas3.kitware.com/midas/download/item/318788/muCT.mha CT data] and a relevant Cone-Beam CT [http://midas3.kitware.com/midas/download/item/318790/geometry.xml geometry file].<br />
<br />
== Forward projection ==<br />
<br />
To forward project the CT volume, following the geometry described in geometry.xml, run<br />
<br />
<source lang="bash" enclose="div"><br />
rtkforwardprojections -i muCT.mha -o projections.mha -g geometry.xml<br />
</source><br />
<br />
Look at the result using vv<br />
<br />
<source lang="bash" enclose="div"><br />
vv projections.mha<br />
</source><br />
<br />
There are as many projections as described in the geometry.xml file. You can edit the geometry.xml file, remove all projections except one, and try again. Such a modified geometry file is available [http://midas3.kitware.com/midas/download/item/318789/singleProjectionGeometry.xml here]. Run the following command line<br />
<br />
<source lang="bash" enclose="div"><br />
rtkforwardprojections -i muCT.mha -o singleProjection.mha -g singleProjectionGeometry.xml<br />
</source><br />
<br />
You can check with vv that the file contains only one projection<br />
<br />
<source lang="bash" enclose="div"><br />
vv singleProjection.mha<br />
</source><br />
<br />
== Back projection ==<br />
<br />
Start by back projecting a single projection. Run<br />
<br />
<source lang="bash" enclose="div"><br />
rtkbackprojections -p . -r singleProjection.mha -o singleBackProjection.mha -g singleProjectionGeometry.xml<br />
</source><br />
<br />
Observe the result with vv<br />
<br />
<source lang="bash" enclose="div"><br />
vv singleBackProjection.mha<br />
</source><br />
<br />
As you can see, the projection data seems to be smeared into the volume. Now back project all projections, by running<br />
<br />
<source lang="bash" enclose="div"><br />
rtkbackprojections -p . -r projections.mha -o backProjection.mha -g geometry.xml<br />
</source><br />
<br />
Look at the result with vv. In order to compare it with the original image, run <br />
<br />
<source lang="bash" enclose="div"><br />
vv backProjection.mha muCT.mha --linkall<br />
</source><br />
<br />
Click in one of the display windows, hit 'Ctrl + G' to center the view on the tumor. Hit 'w' to automatically compute reasonable window and level values. You can navigate between "muCT.mha" and "backProjection.mha" by hitting the 'Tab' key.<br />
<br />
== Using different forward and back projection algorithms ==<br />
<br />
Both rtkforwardprojections and rtkbackprojections can use several algorithms to perform the forward or back projections. For forward projections, you can try the following command lines<br />
<br />
<source lang="bash" enclose="div"><br />
rtkforwardprojections -i muCT.mha -o josephProjections.mha -g geometry.xml --fp Joseph<br />
</source><br />
<source lang="bash" enclose="div"><br />
rtkforwardprojections -i muCT.mha -o rayCastInterpolatorProjections.mha -g geometry.xml --fp RayCastInterpolator<br />
</source><br />
<br />
And for back projection<br />
<br />
<source lang="bash" enclose="div"><br />
rtkbackprojections -p . -r projections.mha -o voxelBasedBackProjection.mha -g geometry.xml --bp VoxelBasedBackProjection<br />
</source><br />
<source lang="bash" enclose="div"><br />
rtkbackprojections -p . -r projections.mha -o josephBackProjection.mha -g geometry.xml --bp Joseph<br />
</source><br />
<source lang="bash" enclose="div"><br />
rtkbackprojections -p . -r projections.mha -o normalizedJosephBackProjection.mha -g geometry.xml --bp NormalizedJoseph<br />
</source><br />
<br />
If you have a CUDA-capable graphics card, and have compiled RTK with RTK_USE_CUDA=ON, you can also try the following<br />
<br />
<source lang="bash" enclose="div"><br />
rtkforwardprojections -i muCT.mha -o cudaRayCastProjections.mha -g geometry.xml --fp CudaRayCast<br />
</source><br />
<source lang="bash" enclose="div"><br />
rtkbackprojections -p . -r projections.mha -o cudaRayCastBackProjection.mha -g geometry.xml --bp CudaRayCast<br />
</source><br />
<source lang="bash" enclose="div"><br />
rtkbackprojections -p . -r projections.mha -o cudaBackProjection.mha -g geometry.xml --bp CudaBackProjection<br />
</source><br />
<br />
= 3D Reconstruction =<br />
<br />
== Creating a very small dataset ==<br />
<br />
Various reconstruction algorithms exist, which employ forward and back projection extensively. We will now start performing real reconstructions using some of the algorithms implemented in RTK. Since these algorithms are computationally much more demanding than the standard FDK, we propose to run them with low resolution data. You will be able to re-compute them at full resolution later, since the present page will remain available to you after the training. Note that, for the regularized reconstruction techniques, you will have to re-tune the regularization parameters yourself, since they depend (among many things) on resolution.<br />
<br />
Start by downloading the cone beam CT projection data [http://midas3.kitware.com/midas/download/item/208648/projections.tgz here], and extract it. It contains 644 projections, each one in a ".his" file. You can view them in vv by typing<br />
<br />
<source lang="bash" enclose="div"><br />
vv --sequence *.his<br />
</source><br />
<br />
RTK has a collection of tools to convert and preprocess commercial CBCT projection data, most of which are combined in the application "rtkprojections". To convert and preprocess these projections, run<br />
<br />
<source lang="bash" enclose="div"><br />
rtkprojections -p . -r .*.his -o downsampledProjections.mha --binning "4, 4"<br />
</source><br />
<br />
The '--binning "4, 4"' option downsamples the projections by 4 along both axes. Since this is not enough to reach acceptable reconstruction times for the training, we will build a sub-dataset by selecting only one projection out of 5. You can do this by running <br />
<br />
<source lang="bash" enclose="div"><br />
rtksubselect -p . -r downsampledProjections.mha -g geometry.xml --out_geometry subGeometry.xml --out_proj subProjections.mha -s 5<br />
</source><br />
<br />
This creates a new geometry file and a new projections file, from which even a laptop should be able to perform iterative reconstruction in reasonable time.<br />
<br />
== Unregularized 3D iterative reconstruction algorithms ==<br />
<br />
The most popular iterative reconstruction algorithm is the Simultaneous Algebraic Reconstruction Technique (SART). Try it by running<br />
<br />
<source lang="bash" enclose="div"><br />
rtksart -p . -r subProjections.mha -g subGeometry.xml -o SART.mha --dimension 128 --spacing 3<br />
</source><br />
<br />
Another popular technique uses the conjugate gradient algorithm<br />
<br />
<source lang="bash" enclose="div"><br />
rtkconjugategradient -p . -r subProjections.mha -g subGeometry.xml -o CG.mha --dimension 128 --spacing 3 -n 10<br />
</source><br />
<br />
You can compare the results by running<br />
<br />
<source lang="bash" enclose="div"><br />
vv SART.mha CG.mha --linkall<br />
</source><br />
<br />
The SART reconstruction should be sharper than the conjugate gradient one. If you are interested in understanding the reasons for this difference, try running <br />
<br />
<source lang="bash" enclose="div"><br />
rtksart -p . -r subProjections.mha -g subGeometry.xml -o OSSART_10projsPerSubset.mha --dimension 128 --spacing 3 --nprojspersubset 10<br />
</source><br />
<br />
The differences in image quality (sharpness, contrast, ...) and convergence speed, stability, ... between the various algorithms may be discussed briefly during the training.<br />
<br />
== Regularized 3D iterative reconstruction algorithms ==<br />
<br />
RTK also includes algorithms that perform regularization during the reconstruction. You can try for example<br />
<br />
<source lang="bash" enclose="div"><br />
rtkadmmtotalvariation -p . -r subProjections.mha -g subGeometry.xml -o admmTV.mha --dimension 128 --spacing 3 -n 10 --beta 1000 --alpha 1<br />
</source><br />
<br />
and<br />
<br />
<source lang="bash" enclose="div"><br />
rtkadmmwavelets -p . -r subProjections.mha -g subGeometry.xml -o admmWavelets.mha --dimension 128 --spacing 3 -n 10 --beta 1000 --alpha 1<br />
</source><br />
<br />
Note that these algorithms have little interest when working with such low resolution data, since most of the noise and artifacts they are meant to remove have already been eliminated by undersampling.<br />
<br />
= 4D Iterative reconstruction =<br />
<br />
== Extracting respiratory phase ==<br />
<br />
RTK includes a tool to extract the phase of respiratory motion from the projection data. It uses an intermediate image built from the stack of projections, called the "shroud". Run<br />
<br />
<source lang="bash" enclose="div"><br />
rtkamsterdamshroud -p . -r .*.his -o shroud.mhd<br />
</source><br />
<br />
and open the shroud image with vv:<br />
<br />
<source lang="bash" enclose="div"><br />
vv shroud.mhd<br />
</source><br />
<br />
You will notice that a periodic signal is visible in the image. Before we try to retrieve this signal's phase, we need to remove the parts of the image affected by low frequency noise. Try<br />
<br />
<source lang="bash" enclose="div"><br />
rtkamsterdamshroud -p . -r .*.his -o cshroud.mhd --lowercrop "0, 270, 0" --upper "0, 112, 0"<br />
</source><br />
<br />
The cropped shroud can be viewed with vv:<br />
<br />
<source lang="bash" enclose="div"><br />
vv cshroud.mhd<br />
</source><br />
<br />
This cropped shroud will be used to extract a phase signal, with another RTK command. Run<br />
<br />
<source lang="bash" enclose="div"><br />
rtkextractshroudsignal -i cshroud.mhd -o signal.txt -p cphase.txt<br />
</source><br />
<br />
If you have Python installed, you can download [http://midas3.kitware.com/midas/download/item/318791/showPeaksOverShroud.py this script] and run it from your working directory. It will generate an image with the cropped shroud in background and the detected minima in foreground, in red.<br />
<br />
== Unregularized iterative 4D reconstruction ==<br />
<br />
RTK includes several algorithms for 4D reconstruction. Similarly to 3D, you can try them with the following commands<br />
<br />
<source lang="bash" enclose="div"><br />
rtkfourdsart -p . -r downsampledProjections.mha -g geometry.xml -o 4DSART.mha --signal cphase.txt --dimension 128 --spacing 3<br />
</source><br />
<source lang="bash" enclose="div"><br />
rtkfourdconjugategradient -p . -r downsampledProjections.mha -g geometry.xml -o 4DCG.mha --signal cphase.txt --dimension 128 --spacing 3<br />
</source></div>Cyril.moryhttps://wiki.openrtk.org/index.php?title=RTK/Meetings/TrainingNov15&diff=427RTK/Meetings/TrainingNov152015-10-26T15:17:08Z<p>Cyril.mory: /* 4D Iterative reconstruction */</p>
<hr />
<div>= Basic operators =<br />
<br />
Here is a list of the RTK command lines you will have to run during the training, along with the data you will need.<br />
To start, download the following [http://midas3.kitware.com/midas/download/item/318788/muCT.mha CT data] and a relevant Cone-Beam CT [http://midas3.kitware.com/midas/download/item/318790/geometry.xml geometry file].<br />
<br />
== Forward projection ==<br />
<br />
To forward project the CT volume, following the geometry described in geometry.xml, run<br />
<br />
<source lang="bash" enclose="div"><br />
rtkforwardprojections -i muCT.mha -o projections.mha -g geometry.xml<br />
</source><br />
<br />
Look at the result using vv<br />
<br />
<source lang="bash" enclose="div"><br />
vv projections.mha<br />
</source><br />
<br />
There are as many projections as described in the geometry.xml file. You can edit the geometry.xml file, remove all projections except one, and try again. Such a modified geometry file is available [http://midas3.kitware.com/midas/download/item/318789/singleProjectionGeometry.xml here]. Run the following command line<br />
<br />
<source lang="bash" enclose="div"><br />
rtkforwardprojections -i muCT.mha -o singleProjection.mha -g singleProjectionGeometry.xml<br />
</source><br />
<br />
You can check with vv that the file contains only one projection<br />
<br />
<source lang="bash" enclose="div"><br />
vv singleProjection.mha<br />
</source><br />
<br />
== Back projection ==<br />
<br />
Start by back projecting a single projection. Run<br />
<br />
<source lang="bash" enclose="div"><br />
rtkbackprojections -p . -r singleProjection.mha -o singleBackProjection.mha -g singleProjectionGeometry.xml<br />
</source><br />
<br />
Observe the result with vv<br />
<br />
<source lang="bash" enclose="div"><br />
vv singleBackProjection.mha<br />
</source><br />
<br />
As you can see, the projection data seems to be smeared into the volume. Now back project all projections, by running<br />
<br />
<source lang="bash" enclose="div"><br />
rtkbackprojections -p . -r projections.mha -o backProjection.mha -g geometry.xml<br />
</source><br />
<br />
Look at the result with vv. In order to compare it with the original image, run <br />
<br />
<source lang="bash" enclose="div"><br />
vv backProjection.mha muCT.mha --linkall<br />
</source><br />
<br />
Click in one of the display windows, hit 'Ctrl + G' to center the view on the tumor. Hit 'w' to automatically compute reasonable window and level values. You can navigate between "muCT.mha" and "backProjection.mha" by hitting the 'Tab' key.<br />
<br />
== Using different forward and back projection algorithms ==<br />
<br />
Both rtkforwardprojections and rtkbackprojections can use several algorithms to perform the forward or back projections. For forward projections, you can try the following command lines<br />
<br />
<source lang="bash" enclose="div"><br />
rtkforwardprojections -i muCT.mha -o josephProjections.mha -g geometry.xml --fp Joseph<br />
</source><br />
<source lang="bash" enclose="div"><br />
rtkforwardprojections -i muCT.mha -o rayCastInterpolatorProjections.mha -g geometry.xml --fp RayCastInterpolator<br />
</source><br />
<br />
And for back projection<br />
<br />
<source lang="bash" enclose="div"><br />
rtkbackprojections -p . -r projections.mha -o voxelBasedBackProjection.mha -g geometry.xml --bp VoxelBasedBackProjection<br />
</source><br />
<source lang="bash" enclose="div"><br />
rtkbackprojections -p . -r projections.mha -o josephBackProjection.mha -g geometry.xml --bp Joseph<br />
</source><br />
<source lang="bash" enclose="div"><br />
rtkbackprojections -p . -r projections.mha -o normalizedJosephBackProjection.mha -g geometry.xml --bp NormalizedJoseph<br />
</source><br />
<br />
If you have a CUDA-capable graphics card, and have compiled RTK with RTK_USE_CUDA=ON, you can also try the following<br />
<br />
<source lang="bash" enclose="div"><br />
rtkforwardprojections -i muCT.mha -o cudaRayCastProjections.mha -g geometry.xml --fp CudaRayCast<br />
</source><br />
<source lang="bash" enclose="div"><br />
rtkbackprojections -p . -r projections.mha -o cudaRayCastBackProjection.mha -g geometry.xml --bp CudaRayCast<br />
</source><br />
<source lang="bash" enclose="div"><br />
rtkbackprojections -p . -r projections.mha -o cudaBackProjection.mha -g geometry.xml --bp CudaBackProjection<br />
</source><br />
<br />
= 3D Reconstruction =<br />
<br />
== Creating a very small dataset ==<br />
<br />
Various reconstruction algorithms exist, which employ forward and back projection extensively. We will now start performing real reconstructions using some of the algorithms implemented in RTK. Since these algorithms are computationally much more demanding than the standard FDK, we propose to run them with low resolution data. You will be able to re-compute them at full resolution later, since the present page will remain available to you after the training. Note that, for the regularized reconstruction techniques, you will have to re-tune the regularization parameters yourself, since they depend (among many things) on resolution.<br />
<br />
Start by downloading the cone beam CT projection data [http://midas3.kitware.com/midas/download/item/208648/projections.tgz here], and extract it. It contains 644 projections, each one in a ".his" file. You can view them in vv by typing<br />
<br />
<source lang="bash" enclose="div"><br />
vv --sequence *.his<br />
</source><br />
<br />
RTK has a collection of tools to convert and preprocess commercial CBCT projection data, most of which are combined in the application "rtkprojections". To convert and preprocess these projections, run<br />
<br />
<source lang="bash" enclose="div"><br />
rtkprojections -p . -r .*.his -o downsampledProjections.mha --binning "4, 4"<br />
</source><br />
<br />
The '--binning "4, 4"' option downsamples the projections by 4 along both axes. Since this is not enough to reach acceptable reconstruction times for the training, we will build a sub-dataset by selecting only one projection out of 5. You can do this by running <br />
<br />
<source lang="bash" enclose="div"><br />
rtksubselect -p . -r downsampledProjections.mha -g geometry.xml --out_geometry subGeometry.xml --out_proj subProjections.mha -s 5<br />
</source><br />
<br />
This creates a new geometry file and a new projections file, from which even a laptop should be able to perform iterative reconstruction in reasonable time.<br />
<br />
== Unregularized 3D iterative reconstruction algorithms ==<br />
<br />
The most popular iterative reconstruction algorithm is the Simultaneous Algebraic Reconstruction Technique (SART). Try it by running<br />
<br />
<source lang="bash" enclose="div"><br />
rtksart -p . -r subProjections.mha -g subGeometry.xml -o SART.mha --dimension 128 --spacing 3<br />
</source><br />
<br />
Another popular technique uses the conjugate gradient algorithm<br />
<br />
<source lang="bash" enclose="div"><br />
rtkconjugategradient -p . -r subProjections.mha -g subGeometry.xml -o CG.mha --dimension 128 --spacing 3 -n 10<br />
</source><br />
<br />
You can compare the results by running<br />
<br />
<source lang="bash" enclose="div"><br />
vv SART.mha CG.mha --linkall<br />
</source><br />
<br />
The SART reconstruction should be sharper than the conjugate gradient one. If you are interested in understanding the reasons for this difference, try running <br />
<br />
<source lang="bash" enclose="div"><br />
rtksart -p . -r subProjections.mha -g subGeometry.xml -o OSSART_10projsPerSubset.mha --dimension 128 --spacing 3 --nprojspersubset 10<br />
</source><br />
<br />
The differences in image quality (sharpness, contrast, ...) and convergence speed, stability, ... between the various algorithms may be discussed briefly during the training.<br />
<br />
== Regularized 3D iterative reconstruction algorithms ==<br />
<br />
RTK also includes algorithms that perform regularization during the reconstruction. You can try for example<br />
<br />
<source lang="bash" enclose="div"><br />
rtkadmmtotalvariation -p . -r subProjections.mha -g subGeometry.xml -o admmTV.mha --dimension 128 --spacing 3 -n 10 --beta 1000 --alpha 1<br />
</source><br />
<br />
and<br />
<br />
<source lang="bash" enclose="div"><br />
rtkadmmwavelets -p . -r subProjections.mha -g subGeometry.xml -o admmWavelets.mha --dimension 128 --spacing 3 -n 10 --beta 1000 --alpha 1<br />
</source><br />
<br />
Note that these algorithms have little interest when working with such low resolution data, since most of the noise and artifacts they are meant to remove have already been eliminated by undersampling.<br />
<br />
= 4D Iterative reconstruction =<br />
<br />
== Extracting respiratory phase ==<br />
<br />
RTK includes a tool to extract the phase of respiratory motion from the projection data. It uses an intermediate image built from the stack of projections, called the "shroud". Run<br />
<br />
<source lang="bash" enclose="div"><br />
rtkamsterdamshroud -p . -r .*.his -o shroud.mhd<br />
</source><br />
<br />
and open the shroud image with vv:<br />
<br />
<source lang="bash" enclose="div"><br />
vv shroud.mhd<br />
</source><br />
<br />
You will notice that a periodic signal is visible in the image. Before we try to retrieve this signal's phase, we need to remove the parts of the image affected by low frequency noise. Try<br />
<br />
<source lang="bash" enclose="div"><br />
rtkamsterdamshroud -p . -r .*.his -o cshroud.mhd --lowercrop "0, 270, 0" --upper "0, 112, 0"<br />
</source><br />
<br />
The cropped shroud can be viewed with vv:<br />
<br />
<source lang="bash" enclose="div"><br />
vv cshroud.mhd<br />
</source><br />
<br />
This cropped shroud will be used to extract a phase signal, with another RTK command. Run<br />
<br />
<source lang="bash" enclose="div"><br />
rtkextractshroudsignal -i cshroud.mhd -o signal.txt -p cphase.txt<br />
</source><br />
<br />
If you have Python installed, you can download [http://midas3.kitware.com/midas/download/item/318791/showPeaksOverShroud.py this script] and run it from your working directory. It will generate an image with the cropped shroud in background and the detected minima in foreground, in red.<br />
<br />
== Unregularized iterative 4D reconstruction ==<br />
<br />
RTK includes various algorithms for 4D reconstruction. Similarly to 3D, you can try them with the following commands<br />
<br />
<source lang="bash" enclose="div"><br />
rtkfourdsart -p . -r <br />
</source><br />
<source lang="bash" enclose="div"><br />
<br />
</source><br />
<source lang="bash" enclose="div"><br />
<br />
</source></div>Cyril.moryhttps://wiki.openrtk.org/index.php?title=RTK/Meetings/TrainingNov15&diff=426RTK/Meetings/TrainingNov152015-10-26T15:03:38Z<p>Cyril.mory: /* Extracting respiratory phase */</p>
<hr />
<div>= Basic operators =<br />
<br />
Here is a list of the RTK command lines you will have to run during the training, along with the data you will need.<br />
To start, download the following [http://midas3.kitware.com/midas/download/item/318788/muCT.mha CT data] and a relevant Cone-Beam CT [http://midas3.kitware.com/midas/download/item/318790/geometry.xml geometry file].<br />
<br />
== Forward projection ==<br />
<br />
To forward project the CT volume, following the geometry described in geometry.xml, run<br />
<br />
<source lang="bash" enclose="div"><br />
rtkforwardprojections -i muCT.mha -o projections.mha -g geometry.xml<br />
</source><br />
<br />
Look at the result using vv<br />
<br />
<source lang="bash" enclose="div"><br />
vv projections.mha<br />
</source><br />
<br />
There are as many projections as described in the geometry.xml file. You can edit the geometry.xml file, remove all projections except one, and try again. Such a modified geometry file is available [http://midas3.kitware.com/midas/download/item/318789/singleProjectionGeometry.xml here]. Run the following command line<br />
<br />
<source lang="bash" enclose="div"><br />
rtkforwardprojections -i muCT.mha -o singleProjection.mha -g singleProjectionGeometry.xml<br />
</source><br />
<br />
You can check with vv that the file contains only one projection<br />
<br />
<source lang="bash" enclose="div"><br />
vv singleProjection.mha<br />
</source><br />
<br />
== Back projection ==<br />
<br />
Start by back projecting a single projection. Run<br />
<br />
<source lang="bash" enclose="div"><br />
rtkbackprojections -p . -r singleProjection.mha -o singleBackProjection.mha -g singleProjectionGeometry.xml<br />
</source><br />
<br />
Observe the result with vv<br />
<br />
<source lang="bash" enclose="div"><br />
vv singleBackProjection.mha<br />
</source><br />
<br />
As you can see, the projection data seems to be smeared into the volume. Now back project all projections, by running<br />
<br />
<source lang="bash" enclose="div"><br />
rtkbackprojections -p . -r projections.mha -o backProjection.mha -g geometry.xml<br />
</source><br />
<br />
Look at the result with vv. In order to compare it with the original image, run <br />
<br />
<source lang="bash" enclose="div"><br />
vv backProjection.mha muCT.mha --linkall<br />
</source><br />
<br />
Click in one of the display windows, hit 'Ctrl + G' to center the view on the tumor. Hit 'w' to automatically compute reasonable window and level values. You can navigate between "muCT.mha" and "backProjection.mha" by hitting the 'Tab' key.<br />
<br />
== Using different forward and back projection algorithms ==<br />
<br />
Both rtkforwardprojections and rtkbackprojections can use several algorithms to perform the forward or back projections. For forward projections, you can try the following command lines<br />
<br />
<source lang="bash" enclose="div"><br />
rtkforwardprojections -i muCT.mha -o josephProjections.mha -g geometry.xml --fp Joseph<br />
</source><br />
<source lang="bash" enclose="div"><br />
rtkforwardprojections -i muCT.mha -o rayCastInterpolatorProjections.mha -g geometry.xml --fp RayCastInterpolator<br />
</source><br />
<br />
And for back projection<br />
<br />
<source lang="bash" enclose="div"><br />
rtkbackprojections -p . -r projections.mha -o voxelBasedBackProjection.mha -g geometry.xml --bp VoxelBasedBackProjection<br />
</source><br />
<source lang="bash" enclose="div"><br />
rtkbackprojections -p . -r projections.mha -o josephBackProjection.mha -g geometry.xml --bp Joseph<br />
</source><br />
<source lang="bash" enclose="div"><br />
rtkbackprojections -p . -r projections.mha -o normalizedJosephBackProjection.mha -g geometry.xml --bp NormalizedJoseph<br />
</source><br />
<br />
If you have a CUDA-capable graphics card, and have compiled RTK with RTK_USE_CUDA=ON, you can also try the following<br />
<br />
<source lang="bash" enclose="div"><br />
rtkforwardprojections -i muCT.mha -o cudaRayCastProjections.mha -g geometry.xml --fp CudaRayCast<br />
</source><br />
<source lang="bash" enclose="div"><br />
rtkbackprojections -p . -r projections.mha -o cudaRayCastBackProjection.mha -g geometry.xml --bp CudaRayCast<br />
</source><br />
<source lang="bash" enclose="div"><br />
rtkbackprojections -p . -r projections.mha -o cudaBackProjection.mha -g geometry.xml --bp CudaBackProjection<br />
</source><br />
<br />
= 3D Reconstruction =<br />
<br />
== Creating a very small dataset ==<br />
<br />
Various reconstruction algorithms exist, which employ forward and back projection extensively. We will now start performing real reconstructions using some of the algorithms implemented in RTK. Since these algorithms are computationally much more demanding than the standard FDK, we propose to run them with low resolution data. You will be able to re-compute them at full resolution later, since the present page will remain available to you after the training. Note that, for the regularized reconstruction techniques, you will have to re-tune the regularization parameters yourself, since they depend (among many things) on resolution.<br />
<br />
Start by downloading the cone beam CT projection data [http://midas3.kitware.com/midas/download/item/208648/projections.tgz here], and extract it. It contains 644 projections, each one in a ".his" file. You can view them in vv by typing<br />
<br />
<source lang="bash" enclose="div"><br />
vv --sequence *.his<br />
</source><br />
<br />
RTK has a collection of tools to convert and preprocess commercial CBCT projection data, most of which are combined in the application "rtkprojections". To convert and preprocess these projections, run<br />
<br />
<source lang="bash" enclose="div"><br />
rtkprojections -p . -r .*.his -o downsampledProjections.mha --binning "4, 4"<br />
</source><br />
<br />
The '--binning "4, 4"' option downsamples the projections by 4 along both axes. Since this is not enough to reach acceptable reconstruction times for the training, we will build a sub-dataset by selecting only one projection out of 5. You can do this by running <br />
<br />
<source lang="bash" enclose="div"><br />
rtksubselect -p . -r downsampledProjections.mha -g geometry.xml --out_geometry subGeometry.xml --out_proj subProjections.mha -s 5<br />
</source><br />
<br />
This creates a new geometry file and a new projections file, from which even a laptop should be able to perform iterative reconstruction in reasonable time.<br />
<br />
== Unregularized 3D iterative reconstruction algorithms ==<br />
<br />
The most popular iterative reconstruction algorithm is the Simultaneous Algebraic Reconstruction Technique (SART). Try it by running<br />
<br />
<source lang="bash" enclose="div"><br />
rtksart -p . -r subProjections.mha -g subGeometry.xml -o SART.mha --dimension 128 --spacing 3<br />
</source><br />
<br />
Another popular technique uses the conjugate gradient algorithm<br />
<br />
<source lang="bash" enclose="div"><br />
rtkconjugategradient -p . -r subProjections.mha -g subGeometry.xml -o CG.mha --dimension 128 --spacing 3 -n 10<br />
</source><br />
<br />
You can compare the results by running<br />
<br />
<source lang="bash" enclose="div"><br />
vv SART.mha CG.mha --linkall<br />
</source><br />
<br />
The SART reconstruction should be sharper than the conjugate gradient one. If you are interested in understanding the reasons for this difference, try running <br />
<br />
<source lang="bash" enclose="div"><br />
rtksart -p . -r subProjections.mha -g subGeometry.xml -o OSSART_10projsPerSubset.mha --dimension 128 --spacing 3 --nprojspersubset 10<br />
</source><br />
<br />
The differences in image quality (sharpness, contrast, ...) and convergence speed, stability, ... between the various algorithms may be discussed briefly during the training.<br />
<br />
== Regularized 3D iterative reconstruction algorithms ==<br />
<br />
RTK also includes algorithms that perform regularization during the reconstruction. You can try for example<br />
<br />
<source lang="bash" enclose="div"><br />
rtkadmmtotalvariation -p . -r subProjections.mha -g subGeometry.xml -o admmTV.mha --dimension 128 --spacing 3 -n 10 --beta 1000 --alpha 1<br />
</source><br />
<br />
and<br />
<br />
<source lang="bash" enclose="div"><br />
rtkadmmwavelets -p . -r subProjections.mha -g subGeometry.xml -o admmWavelets.mha --dimension 128 --spacing 3 -n 10 --beta 1000 --alpha 1<br />
</source><br />
<br />
Note that these algorithms have little interest when working with such low resolution data, since most of the noise and artifacts they are meant to remove have already been eliminated by undersampling.<br />
<br />
= 4D Iterative reconstruction =<br />
<br />
== Extracting respiratory phase ==<br />
<br />
RTK includes a tool to extract the phase of respiratory motion from the projection data. It uses an intermediate image built from the stack of projections, called the "shroud". Run<br />
<br />
<source lang="bash" enclose="div"><br />
rtkamsterdamshroud -p . -r .*.his -o shroud.mhd<br />
</source><br />
<br />
and open the shroud image with vv:<br />
<br />
<source lang="bash" enclose="div"><br />
vv shroud.mhd<br />
</source><br />
<br />
You will notice that a periodic signal is visible in the image. Before we try to retrieve this signal's phase, we need to remove the parts of the image affected by low frequency noise. Try<br />
<br />
<source lang="bash" enclose="div"><br />
rtkamsterdamshroud -p . -r .*.his -o cshroud.mhd --lowercrop "0, 270, 0" --upper "0, 112, 0"<br />
</source><br />
<br />
The cropped shroud can be viewed with vv:<br />
<br />
<source lang="bash" enclose="div"><br />
vv cshroud.mhd<br />
</source><br />
<br />
This cropped shroud will be used to extract a phase signal, with another RTK command. Run<br />
<br />
<source lang="bash" enclose="div"><br />
rtkextractshroudsignal -i cshroud.mhd -o signal.txt -p cphase.txt<br />
</source></div>Cyril.moryhttps://wiki.openrtk.org/index.php?title=RTK/Meetings/TrainingNov15&diff=425RTK/Meetings/TrainingNov152015-10-26T15:03:10Z<p>Cyril.mory: </p>
<hr />
<div>= Basic operators =<br />
<br />
Here is a list of the RTK command lines you will have to run during the training, along with the data you will need.<br />
To start, download the following [http://midas3.kitware.com/midas/download/item/318788/muCT.mha CT data] and a relevant Cone-Beam CT [http://midas3.kitware.com/midas/download/item/318790/geometry.xml geometry file].<br />
<br />
== Forward projection ==<br />
<br />
To forward project the CT volume, following the geometry described in geometry.xml, run<br />
<br />
<source lang="bash" enclose="div"><br />
rtkforwardprojections -i muCT.mha -o projections.mha -g geometry.xml<br />
</source><br />
<br />
Look at the result using vv<br />
<br />
<source lang="bash" enclose="div"><br />
vv projections.mha<br />
</source><br />
<br />
There are as many projections as described in the geometry.xml file. You can edit the geometry.xml file, remove all projections except one, and try again. Such a modified geometry file is available [http://midas3.kitware.com/midas/download/item/318789/singleProjectionGeometry.xml here]. Run the following command line<br />
<br />
<source lang="bash" enclose="div"><br />
rtkforwardprojections -i muCT.mha -o singleProjection.mha -g singleProjectionGeometry.xml<br />
</source><br />
<br />
You can check with vv that the file contains only one projection<br />
<br />
<source lang="bash" enclose="div"><br />
vv singleProjection.mha<br />
</source><br />
<br />
== Back projection ==<br />
<br />
Start by back projecting a single projection. Run<br />
<br />
<source lang="bash" enclose="div"><br />
rtkbackprojections -p . -r singleProjection.mha -o singleBackProjection.mha -g singleProjectionGeometry.xml<br />
</source><br />
<br />
Observe the result with vv<br />
<br />
<source lang="bash" enclose="div"><br />
vv singleBackProjection.mha<br />
</source><br />
<br />
As you can see, the projection data seems to be smeared into the volume. Now back project all projections, by running<br />
<br />
<source lang="bash" enclose="div"><br />
rtkbackprojections -p . -r projections.mha -o backProjection.mha -g geometry.xml<br />
</source><br />
<br />
Look at the result with vv. In order to compare it with the original image, run <br />
<br />
<source lang="bash" enclose="div"><br />
vv backProjection.mha muCT.mha --linkall<br />
</source><br />
<br />
Click in one of the display windows, hit 'Ctrl + G' to center the view on the tumor. Hit 'w' to automatically compute reasonable window and level values. You can navigate between "muCT.mha" and "backProjection.mha" by hitting the 'Tab' key.<br />
<br />
== Using different forward and back projection algorithms ==<br />
<br />
Both rtkforwardprojections and rtkbackprojections can use several algorithms to perform the forward or back projections. For forward projections, you can try the following command lines<br />
<br />
<source lang="bash" enclose="div"><br />
rtkforwardprojections -i muCT.mha -o josephProjections.mha -g geometry.xml --fp Joseph<br />
</source><br />
<source lang="bash" enclose="div"><br />
rtkforwardprojections -i muCT.mha -o rayCastInterpolatorProjections.mha -g geometry.xml --fp RayCastInterpolator<br />
</source><br />
<br />
And for back projection<br />
<br />
<source lang="bash" enclose="div"><br />
rtkbackprojections -p . -r projections.mha -o voxelBasedBackProjection.mha -g geometry.xml --bp VoxelBasedBackProjection<br />
</source><br />
<source lang="bash" enclose="div"><br />
rtkbackprojections -p . -r projections.mha -o josephBackProjection.mha -g geometry.xml --bp Joseph<br />
</source><br />
<source lang="bash" enclose="div"><br />
rtkbackprojections -p . -r projections.mha -o normalizedJosephBackProjection.mha -g geometry.xml --bp NormalizedJoseph<br />
</source><br />
<br />
If you have a CUDA-capable graphics card, and have compiled RTK with RTK_USE_CUDA=ON, you can also try the following<br />
<br />
<source lang="bash" enclose="div"><br />
rtkforwardprojections -i muCT.mha -o cudaRayCastProjections.mha -g geometry.xml --fp CudaRayCast<br />
</source><br />
<source lang="bash" enclose="div"><br />
rtkbackprojections -p . -r projections.mha -o cudaRayCastBackProjection.mha -g geometry.xml --bp CudaRayCast<br />
</source><br />
<source lang="bash" enclose="div"><br />
rtkbackprojections -p . -r projections.mha -o cudaBackProjection.mha -g geometry.xml --bp CudaBackProjection<br />
</source><br />
<br />
= 3D Reconstruction =<br />
<br />
== Creating a very small dataset ==<br />
<br />
Various reconstruction algorithms exist, which employ forward and back projection extensively. We will now start performing real reconstructions using some of the algorithms implemented in RTK. Since these algorithms are computationally much more demanding than the standard FDK, we propose to run them with low resolution data. You will be able to re-compute them at full resolution later, since the present page will remain available to you after the training. Note that, for the regularized reconstruction techniques, you will have to re-tune the regularization parameters yourself, since they depend (among many things) on resolution.<br />
<br />
Start by downloading the cone beam CT projection data [http://midas3.kitware.com/midas/download/item/208648/projections.tgz here], and extract it. It contains 644 projections, each one in a ".his" file. You can view them in vv by typing<br />
<br />
<source lang="bash" enclose="div"><br />
vv --sequence *.his<br />
</source><br />
<br />
RTK has a collection of tools to convert and preprocess commercial CBCT projection data, most of which are combined in the application "rtkprojections". To convert and preprocess these projections, run<br />
<br />
<source lang="bash" enclose="div"><br />
rtkprojections -p . -r .*.his -o downsampledProjections.mha --binning "4, 4"<br />
</source><br />
<br />
The '--binning "4, 4"' option downsamples the projections by 4 along both axes. Since this is not enough to reach acceptable reconstruction times for the training, we will build a sub-dataset by selecting only one projection out of 5. You can do this by running <br />
<br />
<source lang="bash" enclose="div"><br />
rtksubselect -p . -r downsampledProjections.mha -g geometry.xml --out_geometry subGeometry.xml --out_proj subProjections.mha -s 5<br />
</source><br />
<br />
This creates a new geometry file and a new projections file, from which even a laptop should be able to perform iterative reconstruction in reasonable time.<br />
<br />
== Unregularized 3D iterative reconstruction algorithms ==<br />
<br />
The most popular iterative reconstruction algorithm is the Simultaneous Algebraic Reconstruction Technique (SART). Try it by running<br />
<br />
<source lang="bash" enclose="div"><br />
rtksart -p . -r subProjections.mha -g subGeometry.xml -o SART.mha --dimension 128 --spacing 3<br />
</source><br />
<br />
Another popular technique uses the conjugate gradient algorithm<br />
<br />
<source lang="bash" enclose="div"><br />
rtkconjugategradient -p . -r subProjections.mha -g subGeometry.xml -o CG.mha --dimension 128 --spacing 3 -n 10<br />
</source><br />
<br />
You can compare the results by running<br />
<br />
<source lang="bash" enclose="div"><br />
vv SART.mha CG.mha --linkall<br />
</source><br />
<br />
The SART reconstruction should be sharper than the conjugate gradient one. If you are interested in understanding the reasons for this difference, try running <br />
<br />
<source lang="bash" enclose="div"><br />
rtksart -p . -r subProjections.mha -g subGeometry.xml -o OSSART_10projsPerSubset.mha --dimension 128 --spacing 3 --nprojspersubset 10<br />
</source><br />
<br />
The differences in image quality (sharpness, contrast, ...) and convergence speed, stability, ... between the various algorithms may be discussed briefly during the training.<br />
<br />
== Regularized 3D iterative reconstruction algorithms ==<br />
<br />
RTK also includes algorithms that perform regularization during the reconstruction. You can try for example<br />
<br />
<source lang="bash" enclose="div"><br />
rtkadmmtotalvariation -p . -r subProjections.mha -g subGeometry.xml -o admmTV.mha --dimension 128 --spacing 3 -n 10 --beta 1000 --alpha 1<br />
</source><br />
<br />
and<br />
<br />
<source lang="bash" enclose="div"><br />
rtkadmmwavelets -p . -r subProjections.mha -g subGeometry.xml -o admmWavelets.mha --dimension 128 --spacing 3 -n 10 --beta 1000 --alpha 1<br />
</source><br />
<br />
Note that these algorithms have little interest when working with such low resolution data, since most of the noise and artifacts they are meant to remove have already been eliminated by undersampling.<br />
<br />
= 4D Iterative reconstruction =<br />
<br />
== Extracting respiratory phase ==<br />
<br />
RTK includes a tool to extract the phase of respiratory motion from the projection data. It uses an intermediate image built from the stack of projections, called the "shroud". Run<br />
<br />
<source lang="bash" enclose="div"><br />
rtkamsterdamshroud -p ../POPI/ -r .*.his -o shroud.mhd<br />
</source><br />
<br />
and open the shroud image with vv:<br />
<br />
<source lang="bash" enclose="div"><br />
vv shroud.mhd<br />
</source><br />
<br />
You will notice that a periodic signal is visible in the image. Before we try to retrieve this signal's phase, we need to remove the parts of the image affected by low frequency noise. Try<br />
<br />
<source lang="bash" enclose="div"><br />
rtkamsterdamshroud -p ../POPI/ -r .*.his -o cshroud.mhd --lowercrop "0, 270, 0" --upper "0, 112, 0"<br />
</source><br />
<br />
The cropped shroud can be viewed with vv:<br />
<br />
<source lang="bash" enclose="div"><br />
vv cshroud.mhd<br />
</source><br />
<br />
This cropped shroud will be used to extract a phase signal, with another RTK command. Run<br />
<br />
<source lang="bash" enclose="div"><br />
rtkextractshroudsignal -i cshroud.mhd -o signal.txt -p cphase.txt<br />
</source></div>Cyril.moryhttps://wiki.openrtk.org/index.php?title=RTK/Meetings/TrainingNov15&diff=424RTK/Meetings/TrainingNov152015-10-26T15:01:40Z<p>Cyril.mory: /* 4D Iterative reconstruction */</p>
<hr />
<div>= Basic operators =<br />
<br />
Here is a list of the RTK command lines you will have to run during the training, along with the data you will need.<br />
To start, download the following [http://midas3.kitware.com/midas/download/item/318788/muCT.mha CT data] and a relevant Cone-Beam CT [http://midas3.kitware.com/midas/download/item/318790/geometry.xml geometry file].<br />
<br />
== Forward projection ==<br />
<br />
To forward project the CT volume, following the geometry described in geometry.xml, run<br />
<br />
<source lang="bash" enclose="div"><br />
rtkforwardprojections -i muCT.mha -o projections.mha -g geometry.xml<br />
</source><br />
<br />
Look at the result using vv<br />
<br />
<source lang="bash" enclose="div"><br />
vv projections.mha<br />
</source><br />
<br />
There are as many projections as described in the geometry.xml file. You can edit the geometry.xml file, remove all projections except one, and try again. Such a modified geometry file is available [http://midas3.kitware.com/midas/download/item/318789/singleProjectionGeometry.xml here]. Run the following command line<br />
<br />
<source lang="bash" enclose="div"><br />
rtkforwardprojections -i muCT.mha -o singleProjection.mha -g singleProjectionGeometry.xml<br />
</source><br />
<br />
You can check with vv that the file contains only one projection<br />
<br />
<source lang="bash" enclose="div"><br />
vv singleProjection.mha<br />
</source><br />
<br />
== Back projection ==<br />
<br />
Start by back projecting a single projection. Run<br />
<br />
<source lang="bash" enclose="div"><br />
rtkbackprojections -p . -r singleProjection.mha -o singleBackProjection.mha -g singleProjectionGeometry.xml<br />
</source><br />
<br />
Observe the result with vv<br />
<br />
<source lang="bash" enclose="div"><br />
vv singleBackProjection.mha<br />
</source><br />
<br />
As you can see, the projection data seems to be smeared into the volume. Now back project all projections, by running<br />
<br />
<source lang="bash" enclose="div"><br />
rtkbackprojections -p . -r projections.mha -o backProjection.mha -g geometry.xml<br />
</source><br />
<br />
Look at the result with vv. In order to compare it with the original image, run <br />
<br />
<source lang="bash" enclose="div"><br />
vv backProjection.mha muCT.mha --linkall<br />
</source><br />
<br />
Click in one of the display windows, hit 'Ctrl + G' to center the view on the tumor. Hit 'w' to automatically compute reasonable window and level values. You can navigate between "muCT.mha" and "backProjection.mha" by hitting the 'Tab' key.<br />
<br />
== Using different forward and back projection algorithms ==<br />
<br />
Both rtkforwardprojections and rtkbackprojections can use several algorithms to perform the forward or back projections. For forward projections, you can try the following command lines<br />
<br />
<source lang="bash" enclose="div"><br />
rtkforwardprojections -i muCT.mha -o josephProjections.mha -g geometry.xml --fp Joseph<br />
</source><br />
<source lang="bash" enclose="div"><br />
rtkforwardprojections -i muCT.mha -o rayCastInterpolatorProjections.mha -g geometry.xml --fp RayCastInterpolator<br />
</source><br />
<br />
And for back projection<br />
<br />
<source lang="bash" enclose="div"><br />
rtkbackprojections -p . -r projections.mha -o voxelBasedBackProjection.mha -g geometry.xml --bp VoxelBasedBackProjection<br />
</source><br />
<source lang="bash" enclose="div"><br />
rtkbackprojections -p . -r projections.mha -o josephBackProjection.mha -g geometry.xml --bp Joseph<br />
</source><br />
<source lang="bash" enclose="div"><br />
rtkbackprojections -p . -r projections.mha -o normalizedJosephBackProjection.mha -g geometry.xml --bp NormalizedJoseph<br />
</source><br />
<br />
If you have a CUDA-capable graphics card, and have compiled RTK with RTK_USE_CUDA=ON, you can also try the following<br />
<br />
<source lang="bash" enclose="div"><br />
rtkforwardprojections -i muCT.mha -o cudaRayCastProjections.mha -g geometry.xml --fp CudaRayCast<br />
</source><br />
<source lang="bash" enclose="div"><br />
rtkbackprojections -p . -r projections.mha -o cudaRayCastBackProjection.mha -g geometry.xml --bp CudaRayCast<br />
</source><br />
<source lang="bash" enclose="div"><br />
rtkbackprojections -p . -r projections.mha -o cudaBackProjection.mha -g geometry.xml --bp CudaBackProjection<br />
</source><br />
<br />
= 3D Reconstruction =<br />
<br />
== Creating a very small dataset ==<br />
<br />
Various reconstruction algorithms exist, which employ forward and back projection extensively. We will now start performing real reconstructions using some of the algorithms implemented in RTK. Since these algorithms are computationally much more demanding than the standard FDK, we propose to run them with low resolution data. You will be able to re-compute them at full resolution later, since the present page will remain available to you after the training. Note that, for the regularized reconstruction techniques, you will have to re-tune the regularization parameters yourself, since they depend (among many things) on resolution.<br />
<br />
Start by downloading the cone beam CT projection data [http://midas3.kitware.com/midas/download/item/208648/projections.tgz here], and extract it. It contains 644 projections, each one in a ".his" file. You can view them in vv by typing<br />
<br />
<source lang="bash" enclose="div"><br />
vv --sequence *.his<br />
</source><br />
<br />
RTK has a collection of tools to convert and preprocess commercial CBCT projection data, most of which are combined in the application "rtkprojections". To convert and preprocess these projections, run<br />
<br />
<source lang="bash" enclose="div"><br />
rtkprojections -p . -r .*.his -o downsampledProjections.mha --binning "4, 4"<br />
</source><br />
<br />
The '--binning "4, 4"' option downsamples the projections by 4 along both axes. Since this is not enough to reach acceptable reconstruction times for the training, we will build a sub-dataset by selecting only one projection out of 5. You can do this by running <br />
<br />
<source lang="bash" enclose="div"><br />
rtksubselect -p . -r downsampledProjections.mha -g geometry.xml --out_geometry subGeometry.xml --out_proj subProjections.mha -s 5<br />
</source><br />
<br />
This creates a new geometry file and a new projections file, from which even a laptop should be able to perform iterative reconstruction in reasonable time.<br />
<br />
== Unregularized 3D iterative reconstruction algorithms ==<br />
<br />
The most popular iterative reconstruction algorithm is the Simultaneous Algebraic Reconstruction Technique (SART). Try it by running<br />
<br />
<source lang="bash" enclose="div"><br />
rtksart -p . -r subProjections.mha -g subGeometry.xml -o SART.mha --dimension 128 --spacing 3<br />
</source><br />
<br />
Another popular technique uses the conjugate gradient algorithm<br />
<br />
<source lang="bash" enclose="div"><br />
rtkconjugategradient -p . -r subProjections.mha -g subGeometry.xml -o CG.mha --dimension 128 --spacing 3 -n 10<br />
</source><br />
<br />
You can compare the results by running<br />
<br />
<source lang="bash" enclose="div"><br />
vv SART.mha CG.mha --linkall<br />
</source><br />
<br />
The SART reconstruction should be sharper than the conjugate gradient one. If you are interested in understanding the reasons for this difference, try running <br />
<br />
<source lang="bash" enclose="div"><br />
rtksart -p . -r subProjections.mha -g subGeometry.xml -o OSSART_10projsPerSubset.mha --dimension 128 --spacing 3 --nprojspersubset 10<br />
</source><br />
<br />
The differences in image quality (sharpness, contrast, ...) and convergence speed, stability, ... between the various algorithms may be discussed briefly during the training.<br />
<br />
== Regularized 3D iterative reconstruction algorithms ==<br />
<br />
RTK also includes algorithms that perform regularization during the reconstruction. You can try for example<br />
<br />
<source lang="bash" enclose="div"><br />
rtkadmmtotalvariation -p . -r subProjections.mha -g subGeometry.xml -o admmTV.mha --dimension 128 --spacing 3 -n 10 --beta 1000 --alpha 1<br />
</source><br />
<br />
and<br />
<br />
<source lang="bash" enclose="div"><br />
rtkadmmwavelets -p . -r subProjections.mha -g subGeometry.xml -o admmWavelets.mha --dimension 128 --spacing 3 -n 10 --beta 1000 --alpha 1<br />
</source><br />
<br />
Note that these algorithms have little interest when working with such low resolution data, since most of the noise and artifacts they are meant to remove have already been eliminated by undersampling.<br />
<br />
= 4D Iterative reconstruction =<br />
<br />
== Extracting respiratory phase ==<br />
<br />
RTK includes a tool to extract the phase of respiratory motion from the projection data. It uses an intermediate image built from the stack of projections, called the "shroud". Run<br />
<br />
rtkamsterdamshroud -p ../POPI/ -r .*.his -o shroud.mhd<br />
<br />
and open the shroud image with vv:<br />
<br />
vv shroud.mhd<br />
<br />
You will notice that a periodic signal is visible in the image. Before we try to retrieve this signal's phase, we need to remove the parts of the image affected by low frequency noise. Try<br />
<br />
rtkamsterdamshroud -p ../POPI/ -r .*.his -o cshroud.mhd --lowercrop "0, 270, 0" --upper "0, 112, 0"<br />
<br />
The cropped shroud can be viewed with vv:<br />
<br />
vv cshroud.mhd<br />
<br />
This cropped shroud will be used to extract a phase signal, with another RTK command. Run<br />
<br />
rtkextractshroudsignal -i cshroud.mhd -o signal.txt -p cphase.txt</div>Cyril.moryhttps://wiki.openrtk.org/index.php?title=RTK/Meetings/TrainingNov15&diff=423RTK/Meetings/TrainingNov152015-10-26T14:42:35Z<p>Cyril.mory: </p>
<hr />
<div>= Basic operators =<br />
<br />
Here is a list of the RTK command lines you will have to run during the training, along with the data you will need.<br />
To start, download the following [http://midas3.kitware.com/midas/download/item/318788/muCT.mha CT data] and a relevant Cone-Beam CT [http://midas3.kitware.com/midas/download/item/318790/geometry.xml geometry file].<br />
<br />
== Forward projection ==<br />
<br />
To forward project the CT volume, following the geometry described in geometry.xml, run<br />
<br />
<source lang="bash" enclose="div"><br />
rtkforwardprojections -i muCT.mha -o projections.mha -g geometry.xml<br />
</source><br />
<br />
Look at the result using vv<br />
<br />
<source lang="bash" enclose="div"><br />
vv projections.mha<br />
</source><br />
<br />
There are as many projections as described in the geometry.xml file. You can edit the geometry.xml file, remove all projections except one, and try again. Such a modified geometry file is available [http://midas3.kitware.com/midas/download/item/318789/singleProjectionGeometry.xml here]. Run the following command line<br />
<br />
<source lang="bash" enclose="div"><br />
rtkforwardprojections -i muCT.mha -o singleProjection.mha -g singleProjectionGeometry.xml<br />
</source><br />
<br />
You can check with vv that the file contains only one projection<br />
<br />
<source lang="bash" enclose="div"><br />
vv singleProjection.mha<br />
</source><br />
<br />
== Back projection ==<br />
<br />
Start by back projecting a single projection. Run<br />
<br />
<source lang="bash" enclose="div"><br />
rtkbackprojections -p . -r singleProjection.mha -o singleBackProjection.mha -g singleProjectionGeometry.xml<br />
</source><br />
<br />
Observe the result with vv<br />
<br />
<source lang="bash" enclose="div"><br />
vv singleBackProjection.mha<br />
</source><br />
<br />
As you can see, the projection data seems to be smeared into the volume. Now back project all projections, by running<br />
<br />
<source lang="bash" enclose="div"><br />
rtkbackprojections -p . -r projections.mha -o backProjection.mha -g geometry.xml<br />
</source><br />
<br />
Look at the result with vv. In order to compare it with the original image, run <br />
<br />
<source lang="bash" enclose="div"><br />
vv backProjection.mha muCT.mha --linkall<br />
</source><br />
<br />
Click in one of the display windows, hit 'Ctrl + G' to center the view on the tumor. Hit 'w' to automatically compute reasonable window and level values. You can navigate between "muCT.mha" and "backProjection.mha" by hitting the 'Tab' key.<br />
<br />
== Using different forward and back projection algorithms ==<br />
<br />
Both rtkforwardprojections and rtkbackprojections can use several algorithms to perform the forward or back projections. For forward projections, you can try the following command lines<br />
<br />
<source lang="bash" enclose="div"><br />
rtkforwardprojections -i muCT.mha -o josephProjections.mha -g geometry.xml --fp Joseph<br />
</source><br />
<source lang="bash" enclose="div"><br />
rtkforwardprojections -i muCT.mha -o rayCastInterpolatorProjections.mha -g geometry.xml --fp RayCastInterpolator<br />
</source><br />
<br />
And for back projection<br />
<br />
<source lang="bash" enclose="div"><br />
rtkbackprojections -p . -r projections.mha -o voxelBasedBackProjection.mha -g geometry.xml --bp VoxelBasedBackProjection<br />
</source><br />
<source lang="bash" enclose="div"><br />
rtkbackprojections -p . -r projections.mha -o josephBackProjection.mha -g geometry.xml --bp Joseph<br />
</source><br />
<source lang="bash" enclose="div"><br />
rtkbackprojections -p . -r projections.mha -o normalizedJosephBackProjection.mha -g geometry.xml --bp NormalizedJoseph<br />
</source><br />
<br />
If you have a CUDA-capable graphics card, and have compiled RTK with RTK_USE_CUDA=ON, you can also try the following<br />
<br />
<source lang="bash" enclose="div"><br />
rtkforwardprojections -i muCT.mha -o cudaRayCastProjections.mha -g geometry.xml --fp CudaRayCast<br />
</source><br />
<source lang="bash" enclose="div"><br />
rtkbackprojections -p . -r projections.mha -o cudaRayCastBackProjection.mha -g geometry.xml --bp CudaRayCast<br />
</source><br />
<source lang="bash" enclose="div"><br />
rtkbackprojections -p . -r projections.mha -o cudaBackProjection.mha -g geometry.xml --bp CudaBackProjection<br />
</source><br />
<br />
= 3D Reconstruction =<br />
<br />
== Creating a very small dataset ==<br />
<br />
Various reconstruction algorithms exist, which employ forward and back projection extensively. We will now start performing real reconstructions using some of the algorithms implemented in RTK. Since these algorithms are computationally much more demanding than the standard FDK, we propose to run them with low resolution data. You will be able to re-compute them at full resolution later, since the present page will remain available to you after the training. Note that, for the regularized reconstruction techniques, you will have to re-tune the regularization parameters yourself, since they depend (among many things) on resolution.<br />
<br />
Start by downloading the cone beam CT projection data [http://midas3.kitware.com/midas/download/item/208648/projections.tgz here], and extract it. It contains 644 projections, each one in a ".his" file. You can view them in vv by typing<br />
<br />
<source lang="bash" enclose="div"><br />
vv --sequence *.his<br />
</source><br />
<br />
RTK has a collection of tools to convert and preprocess commercial CBCT projection data, most of which are combined in the application "rtkprojections". To convert and preprocess these projections, run<br />
<br />
<source lang="bash" enclose="div"><br />
rtkprojections -p . -r .*.his -o downsampledProjections.mha --binning "4, 4"<br />
</source><br />
<br />
The '--binning "4, 4"' option downsamples the projections by 4 along both axes. Since this is not enough to reach acceptable reconstruction times for the training, we will build a sub-dataset by selecting only one projection out of 5. You can do this by running <br />
<br />
<source lang="bash" enclose="div"><br />
rtksubselect -p . -r downsampledProjections.mha -g geometry.xml --out_geometry subGeometry.xml --out_proj subProjections.mha -s 5<br />
</source><br />
<br />
This creates a new geometry file and a new projections file, from which even a laptop should be able to perform iterative reconstruction in reasonable time.<br />
<br />
== Unregularized 3D iterative reconstruction algorithms ==<br />
<br />
The most popular iterative reconstruction algorithm is the Simultaneous Algebraic Reconstruction Technique (SART). Try it by running<br />
<br />
<source lang="bash" enclose="div"><br />
rtksart -p . -r subProjections.mha -g subGeometry.xml -o SART.mha --dimension 128 --spacing 3<br />
</source><br />
<br />
Another popular technique uses the conjugate gradient algorithm<br />
<br />
<source lang="bash" enclose="div"><br />
rtkconjugategradient -p . -r subProjections.mha -g subGeometry.xml -o CG.mha --dimension 128 --spacing 3 -n 10<br />
</source><br />
<br />
You can compare the results by running<br />
<br />
<source lang="bash" enclose="div"><br />
vv SART.mha CG.mha --linkall<br />
</source><br />
<br />
The SART reconstruction should be sharper than the conjugate gradient one. If you are interested in understanding the reasons for this difference, try running <br />
<br />
<source lang="bash" enclose="div"><br />
rtksart -p . -r subProjections.mha -g subGeometry.xml -o OSSART_10projsPerSubset.mha --dimension 128 --spacing 3 --nprojspersubset 10<br />
</source><br />
<br />
The differences in image quality (sharpness, contrast, ...) and convergence speed, stability, ... between the various algorithms may be discussed briefly during the training.<br />
<br />
== Regularized 3D iterative reconstruction algorithms ==<br />
<br />
RTK also includes algorithms that perform regularization during the reconstruction. You can try for example<br />
<br />
<source lang="bash" enclose="div"><br />
rtkadmmtotalvariation -p . -r subProjections.mha -g subGeometry.xml -o admmTV.mha --dimension 128 --spacing 3 -n 10 --beta 1000 --alpha 1<br />
</source><br />
<br />
and<br />
<br />
<source lang="bash" enclose="div"><br />
rtkadmmwavelets -p . -r subProjections.mha -g subGeometry.xml -o admmWavelets.mha --dimension 128 --spacing 3 -n 10 --beta 1000 --alpha 1<br />
</source><br />
<br />
Note that these algorithms have little interest when working with such low resolution data, since most of the noise and artifacts they are meant to remove have already been eliminated by undersampling.<br />
<br />
= 4D Iterative reconstruction =</div>Cyril.moryhttps://wiki.openrtk.org/index.php?title=RTK/Meetings/TrainingNov15&diff=422RTK/Meetings/TrainingNov152015-10-26T14:41:04Z<p>Cyril.mory: </p>
<hr />
<div>Here is a list of the RTK command lines you will have to run during the training, along with the data you will need.<br />
To start, download the following [http://midas3.kitware.com/midas/download/item/318788/muCT.mha CT data] and a relevant Cone-Beam CT [http://midas3.kitware.com/midas/download/item/318790/geometry.xml geometry file].<br />
<br />
== Forward projection ==<br />
<br />
To forward project the CT volume, following the geometry described in geometry.xml, run<br />
<br />
<source lang="bash" enclose="div"><br />
rtkforwardprojections -i muCT.mha -o projections.mha -g geometry.xml<br />
</source><br />
<br />
Look at the result using vv<br />
<br />
<source lang="bash" enclose="div"><br />
vv projections.mha<br />
</source><br />
<br />
There are as many projections as described in the geometry.xml file. You can edit the geometry.xml file, remove all projections except one, and try again. Such a modified geometry file is available [http://midas3.kitware.com/midas/download/item/318789/singleProjectionGeometry.xml here]. Run the following command line<br />
<br />
<source lang="bash" enclose="div"><br />
rtkforwardprojections -i muCT.mha -o singleProjection.mha -g singleProjectionGeometry.xml<br />
</source><br />
<br />
You can check with vv that the file contains only one projection<br />
<br />
<source lang="bash" enclose="div"><br />
vv singleProjection.mha<br />
</source><br />
<br />
== Back projection ==<br />
<br />
Start by back projecting a single projection. Run<br />
<br />
<source lang="bash" enclose="div"><br />
rtkbackprojections -p . -r singleProjection.mha -o singleBackProjection.mha -g singleProjectionGeometry.xml<br />
</source><br />
<br />
Observe the result with vv<br />
<br />
<source lang="bash" enclose="div"><br />
vv singleBackProjection.mha<br />
</source><br />
<br />
As you can see, the projection data seems to be smeared into the volume. Now back project all projections, by running<br />
<br />
<source lang="bash" enclose="div"><br />
rtkbackprojections -p . -r projections.mha -o backProjection.mha -g geometry.xml<br />
</source><br />
<br />
Look at the result with vv. In order to compare it with the original image, run <br />
<br />
<source lang="bash" enclose="div"><br />
vv backProjection.mha muCT.mha --linkall<br />
</source><br />
<br />
Click in one of the display windows, hit 'Ctrl + G' to center the view on the tumor. Hit 'w' to automatically compute reasonable window and level values. You can navigate between "muCT.mha" and "backProjection.mha" by hitting the 'Tab' key.<br />
<br />
== Using different forward and back projection algorithms ==<br />
<br />
Both rtkforwardprojections and rtkbackprojections can use several algorithms to perform the forward or back projections. For forward projections, you can try the following command lines<br />
<br />
<source lang="bash" enclose="div"><br />
rtkforwardprojections -i muCT.mha -o josephProjections.mha -g geometry.xml --fp Joseph<br />
</source><br />
<source lang="bash" enclose="div"><br />
rtkforwardprojections -i muCT.mha -o rayCastInterpolatorProjections.mha -g geometry.xml --fp RayCastInterpolator<br />
</source><br />
<br />
And for back projection<br />
<br />
<source lang="bash" enclose="div"><br />
rtkbackprojections -p . -r projections.mha -o voxelBasedBackProjection.mha -g geometry.xml --bp VoxelBasedBackProjection<br />
</source><br />
<source lang="bash" enclose="div"><br />
rtkbackprojections -p . -r projections.mha -o josephBackProjection.mha -g geometry.xml --bp Joseph<br />
</source><br />
<source lang="bash" enclose="div"><br />
rtkbackprojections -p . -r projections.mha -o normalizedJosephBackProjection.mha -g geometry.xml --bp NormalizedJoseph<br />
</source><br />
<br />
If you have a CUDA-capable graphics card, and have compiled RTK with RTK_USE_CUDA=ON, you can also try the following<br />
<br />
<source lang="bash" enclose="div"><br />
rtkforwardprojections -i muCT.mha -o cudaRayCastProjections.mha -g geometry.xml --fp CudaRayCast<br />
</source><br />
<source lang="bash" enclose="div"><br />
rtkbackprojections -p . -r projections.mha -o cudaRayCastBackProjection.mha -g geometry.xml --bp CudaRayCast<br />
</source><br />
<source lang="bash" enclose="div"><br />
rtkbackprojections -p . -r projections.mha -o cudaBackProjection.mha -g geometry.xml --bp CudaBackProjection<br />
</source><br />
<br />
== Creating a very small dataset ==<br />
<br />
Various reconstruction algorithms exist, which employ forward and back projection extensively. We will now start performing real reconstructions using some of the algorithms implemented in RTK. Since these algorithms are computationally much more demanding than the standard FDK, we propose to run them with low resolution data. You will be able to re-compute them at full resolution later, since the present page will remain available to you after the training. Note that, for the regularized reconstruction techniques, you will have to re-tune the regularization parameters yourself, since they depend (among many things) on resolution.<br />
<br />
Start by downloading the cone beam CT projection data [http://midas3.kitware.com/midas/download/item/208648/projections.tgz here], and extract it. It contains 644 projections, each one in a ".his" file. You can view them in vv by typing<br />
<br />
<source lang="bash" enclose="div"><br />
vv --sequence *.his<br />
</source><br />
<br />
RTK has a collection of tools to convert and preprocess commercial CBCT projection data, most of which are combined in the application "rtkprojections". To convert and preprocess these projections, run<br />
<br />
<source lang="bash" enclose="div"><br />
rtkprojections -p . -r .*.his -o downsampledProjections.mha --binning "4, 4"<br />
</source><br />
<br />
The '--binning "4, 4"' option downsamples the projections by 4 along both axes. Since this is not enough to reach acceptable reconstruction times for the training, we will build a sub-dataset by selecting only one projection out of 5. You can do this by running <br />
<br />
<source lang="bash" enclose="div"><br />
rtksubselect -p . -r downsampledProjections.mha -g geometry.xml --out_geometry subGeometry.xml --out_proj subProjections.mha -s 5<br />
</source><br />
<br />
This creates a new geometry file and a new projections file, from which even a laptop should be able to perform iterative reconstruction in reasonable time.<br />
<br />
== Unregularized 3D iterative reconstruction algorithms ==<br />
<br />
The most popular iterative reconstruction algorithm is the Simultaneous Algebraic Reconstruction Technique (SART). Try it by running<br />
<br />
<source lang="bash" enclose="div"><br />
rtksart -p . -r subProjections.mha -g subGeometry.xml -o SART.mha --dimension 128 --spacing 3<br />
</source><br />
<br />
Another popular technique uses the conjugate gradient algorithm<br />
<br />
<source lang="bash" enclose="div"><br />
rtkconjugategradient -p . -r subProjections.mha -g subGeometry.xml -o CG.mha --dimension 128 --spacing 3 -n 10<br />
</source><br />
<br />
You can compare the results by running<br />
<br />
<source lang="bash" enclose="div"><br />
vv SART.mha CG.mha --linkall<br />
</source><br />
<br />
The SART reconstruction should be sharper than the conjugate gradient one. If you are interested in understanding the reasons for this difference, try running <br />
<br />
<source lang="bash" enclose="div"><br />
rtksart -p . -r subProjections.mha -g subGeometry.xml -o OSSART_10projsPerSubset.mha --dimension 128 --spacing 3 --nprojspersubset 10<br />
</source><br />
<br />
The differences in image quality (sharpness, contrast, ...) and convergence speed, stability, ... between the various algorithms may be discussed briefly during the training.<br />
<br />
== Regularized 3D iterative reconstruction algorithms ==<br />
<br />
RTK also includes algorithms that perform regularization during the reconstruction. You can try for example<br />
<br />
<source lang="bash" enclose="div"><br />
rtkadmmtotalvariation -p . -r subProjections.mha -g subGeometry.xml -o admmTV.mha --dimension 128 --spacing 3 -n 10 --beta 1000 --alpha 1<br />
</source><br />
<br />
and<br />
<br />
<source lang="bash" enclose="div"><br />
rtkadmmwavelets -p . -r subProjections.mha -g subGeometry.xml -o admmWavelets.mha --dimension 128 --spacing 3 -n 10 --beta 1000 --alpha 1<br />
</source><br />
<br />
Note that these algorithms have little interest when working with such low resolution data, since most of the noise and artifacts they are meant to remove have already been eliminated by undersampling.<br />
<br />
== 4D Iterative reconstruction ==</div>Cyril.moryhttps://wiki.openrtk.org/index.php?title=RTK/Meetings/TrainingNov15&diff=421RTK/Meetings/TrainingNov152015-10-26T14:39:47Z<p>Cyril.mory: /* Unregularized 3D iterative reconstruction algorithms */</p>
<hr />
<div>Here is a list of the RTK command lines you will have to run during the training, along with the data you will need.<br />
To start, download the following [http://midas3.kitware.com/midas/download/item/318788/muCT.mha CT data] and a relevant Cone-Beam CT [http://midas3.kitware.com/midas/download/item/318790/geometry.xml geometry file].<br />
<br />
== Forward projection ==<br />
<br />
To forward project the CT volume, following the geometry described in geometry.xml, run<br />
<br />
<source lang="bash" enclose="div"><br />
rtkforwardprojections -i muCT.mha -o projections.mha -g geometry.xml<br />
</source><br />
<br />
Look at the result using vv<br />
<br />
<source lang="bash" enclose="div"><br />
vv projections.mha<br />
</source><br />
<br />
There are as many projections as described in the geometry.xml file. You can edit the geometry.xml file, remove all projections except one, and try again. Such a modified geometry file is available [http://midas3.kitware.com/midas/download/item/318789/singleProjectionGeometry.xml here]. Run the following command line<br />
<br />
<source lang="bash" enclose="div"><br />
rtkforwardprojections -i muCT.mha -o singleProjection.mha -g singleProjectionGeometry.xml<br />
</source><br />
<br />
You can check with vv that the file contains only one projection<br />
<br />
<source lang="bash" enclose="div"><br />
vv singleProjection.mha<br />
</source><br />
<br />
== Back projection ==<br />
<br />
Start by back projecting a single projection. Run<br />
<br />
<source lang="bash" enclose="div"><br />
rtkbackprojections -p . -r singleProjection.mha -o singleBackProjection.mha -g singleProjectionGeometry.xml<br />
</source><br />
<br />
Observe the result with vv<br />
<br />
<source lang="bash" enclose="div"><br />
vv singleBackProjection.mha<br />
</source><br />
<br />
As you can see, the projection data seems to be smeared into the volume. Now back project all projections, by running<br />
<br />
<source lang="bash" enclose="div"><br />
rtkbackprojections -p . -r projections.mha -o backProjection.mha -g geometry.xml<br />
</source><br />
<br />
Look at the result with vv. In order to compare it with the original image, run <br />
<br />
<source lang="bash" enclose="div"><br />
vv backProjection.mha muCT.mha --linkall<br />
</source><br />
<br />
Click in one of the display windows, hit 'Ctrl + G' to center the view on the tumor. Hit 'w' to automatically compute reasonable window and level values. You can navigate between "muCT.mha" and "backProjection.mha" by hitting the 'Tab' key.<br />
<br />
== Using different forward and back projection algorithms ==<br />
<br />
Both rtkforwardprojections and rtkbackprojections can use several algorithms to perform the forward or back projections. For forward projections, you can try the following command lines<br />
<br />
<source lang="bash" enclose="div"><br />
rtkforwardprojections -i muCT.mha -o josephProjections.mha -g geometry.xml --fp Joseph<br />
</source><br />
<source lang="bash" enclose="div"><br />
rtkforwardprojections -i muCT.mha -o rayCastInterpolatorProjections.mha -g geometry.xml --fp RayCastInterpolator<br />
</source><br />
<br />
And for back projection<br />
<br />
<source lang="bash" enclose="div"><br />
rtkbackprojections -p . -r projections.mha -o voxelBasedBackProjection.mha -g geometry.xml --bp VoxelBasedBackProjection<br />
</source><br />
<source lang="bash" enclose="div"><br />
rtkbackprojections -p . -r projections.mha -o josephBackProjection.mha -g geometry.xml --bp Joseph<br />
</source><br />
<source lang="bash" enclose="div"><br />
rtkbackprojections -p . -r projections.mha -o normalizedJosephBackProjection.mha -g geometry.xml --bp NormalizedJoseph<br />
</source><br />
<br />
If you have a CUDA-capable graphics card, and have compiled RTK with RTK_USE_CUDA=ON, you can also try the following<br />
<br />
<source lang="bash" enclose="div"><br />
rtkforwardprojections -i muCT.mha -o cudaRayCastProjections.mha -g geometry.xml --fp CudaRayCast<br />
</source><br />
<source lang="bash" enclose="div"><br />
rtkbackprojections -p . -r projections.mha -o cudaRayCastBackProjection.mha -g geometry.xml --bp CudaRayCast<br />
</source><br />
<source lang="bash" enclose="div"><br />
rtkbackprojections -p . -r projections.mha -o cudaBackProjection.mha -g geometry.xml --bp CudaBackProjection<br />
</source><br />
<br />
== Creating a very small dataset ==<br />
<br />
Various reconstruction algorithms exist, which employ forward and back projection extensively. We will now start performing real reconstructions using some of the algorithms implemented in RTK. Since these algorithms are computationally much more demanding than the standard FDK, we propose to run them with low resolution data. You will be able to re-compute them at full resolution later, since the present page will remain available to you after the training. Note that, for the regularized reconstruction techniques, you will have to re-tune the regularization parameters yourself, since they depend (among many things) on resolution.<br />
<br />
Start by downloading the cone beam CT projection data [http://midas3.kitware.com/midas/download/item/208648/projections.tgz here], and extract it. It contains 644 projections, each one in a ".his" file. You can view them in vv by typing<br />
<br />
<source lang="bash" enclose="div"><br />
vv --sequence *.his<br />
</source><br />
<br />
RTK has a collection of tools to convert and preprocess commercial CBCT projection data, most of which are combined in the application "rtkprojections". To convert and preprocess these projections, run<br />
<br />
<source lang="bash" enclose="div"><br />
rtkprojections -p . -r .*.his -o downsampledProjections.mha --binning "4, 4"<br />
</source><br />
<br />
The '--binning "4, 4"' option downsamples the projections by 4 along both axes. Since this is not enough to reach acceptable reconstruction times for the training, we will build a sub-dataset by selecting only one projection out of 5. You can do this by running <br />
<br />
<source lang="bash" enclose="div"><br />
rtksubselect -p . -r downsampledProjections.mha -g geometry.xml --out_geometry subGeometry.xml --out_proj subProjections.mha -s 5<br />
</source><br />
<br />
This creates a new geometry file and a new projections file, from which even a laptop should be able to perform iterative reconstruction in reasonable time.<br />
<br />
== Unregularized 3D iterative reconstruction algorithms ==<br />
<br />
The most popular iterative reconstruction algorithm is the Simultaneous Algebraic Reconstruction Technique (SART). Try it by running<br />
<br />
<source lang="bash" enclose="div"><br />
rtksart -p . -r subProjections.mha -g subGeometry.xml -o SART.mha --dimension 128 --spacing 3<br />
</source><br />
<br />
Another popular technique uses the conjugate gradient algorithm<br />
<br />
<source lang="bash" enclose="div"><br />
rtkconjugategradient -p . -r subProjections.mha -g subGeometry.xml -o CG.mha --dimension 128 --spacing 3 -n 10<br />
</source><br />
<br />
You can compare the results by running<br />
<br />
<source lang="bash" enclose="div"><br />
vv SART.mha CG.mha --linkall<br />
</source><br />
<br />
The SART reconstruction should be sharper than the conjugate gradient one. If you are interested in understanding the reasons for this difference, try running <br />
<br />
<source lang="bash" enclose="div"><br />
rtksart -p . -r subProjections.mha -g subGeometry.xml -o OSSART_10projsPerSubset.mha --dimension 128 --spacing 3 --nprojspersubset 10<br />
</source><br />
<br />
The differences in image quality (sharpness, contrast, ...) and convergence speed, stability, ... between the various algorithms may be discussed briefly during the training.<br />
<br />
== Regularized 3D iterative reconstruction algorithms ==<br />
<br />
RTK also includes algorithms that perform regularization during the reconstruction. You can try for example<br />
<br />
<source lang="bash" enclose="div"><br />
rtkadmmtotalvariation -p . -r subProjections.mha -g subGeometry.xml -o admmTV.mha --dimension 128 --spacing 3 -n 10 --beta 1000 --alpha 1<br />
</source><br />
<br />
and<br />
<br />
<source lang="bash" enclose="div"><br />
rtkadmmwavelets -p . -r subProjections.mha -g subGeometry.xml -o admmWavelets.mha --dimension 128 --spacing 3 -n 10 --beta 1000 --alpha 1<br />
</source><br />
<br />
Note that these algorithms have little interest when working with such low resolution data, since most of the noise and artifacts they are meant to remove have already been eliminated by undersampling.</div>Cyril.moryhttps://wiki.openrtk.org/index.php?title=RTK/Meetings/TrainingNov15&diff=420RTK/Meetings/TrainingNov152015-10-26T14:39:10Z<p>Cyril.mory: /* Regularized 3D iterative reconstruction algorithms */</p>
<hr />
<div>Here is a list of the RTK command lines you will have to run during the training, along with the data you will need.<br />
To start, download the following [http://midas3.kitware.com/midas/download/item/318788/muCT.mha CT data] and a relevant Cone-Beam CT [http://midas3.kitware.com/midas/download/item/318790/geometry.xml geometry file].<br />
<br />
== Forward projection ==<br />
<br />
To forward project the CT volume, following the geometry described in geometry.xml, run<br />
<br />
<source lang="bash" enclose="div"><br />
rtkforwardprojections -i muCT.mha -o projections.mha -g geometry.xml<br />
</source><br />
<br />
Look at the result using vv<br />
<br />
<source lang="bash" enclose="div"><br />
vv projections.mha<br />
</source><br />
<br />
There are as many projections as described in the geometry.xml file. You can edit the geometry.xml file, remove all projections except one, and try again. Such a modified geometry file is available [http://midas3.kitware.com/midas/download/item/318789/singleProjectionGeometry.xml here]. Run the following command line<br />
<br />
<source lang="bash" enclose="div"><br />
rtkforwardprojections -i muCT.mha -o singleProjection.mha -g singleProjectionGeometry.xml<br />
</source><br />
<br />
You can check with vv that the file contains only one projection<br />
<br />
<source lang="bash" enclose="div"><br />
vv singleProjection.mha<br />
</source><br />
<br />
== Back projection ==<br />
<br />
Start by back projecting a single projection. Run<br />
<br />
<source lang="bash" enclose="div"><br />
rtkbackprojections -p . -r singleProjection.mha -o singleBackProjection.mha -g singleProjectionGeometry.xml<br />
</source><br />
<br />
Observe the result with vv<br />
<br />
<source lang="bash" enclose="div"><br />
vv singleBackProjection.mha<br />
</source><br />
<br />
As you can see, the projection data seems to be smeared into the volume. Now back project all projections, by running<br />
<br />
<source lang="bash" enclose="div"><br />
rtkbackprojections -p . -r projections.mha -o backProjection.mha -g geometry.xml<br />
</source><br />
<br />
Look at the result with vv. In order to compare it with the original image, run <br />
<br />
<source lang="bash" enclose="div"><br />
vv backProjection.mha muCT.mha --linkall<br />
</source><br />
<br />
Click in one of the display windows, hit 'Ctrl + G' to center the view on the tumor. Hit 'w' to automatically compute reasonable window and level values. You can navigate between "muCT.mha" and "backProjection.mha" by hitting the 'Tab' key.<br />
<br />
== Using different forward and back projection algorithms ==<br />
<br />
Both rtkforwardprojections and rtkbackprojections can use several algorithms to perform the forward or back projections. For forward projections, you can try the following command lines<br />
<br />
<source lang="bash" enclose="div"><br />
rtkforwardprojections -i muCT.mha -o josephProjections.mha -g geometry.xml --fp Joseph<br />
</source><br />
<source lang="bash" enclose="div"><br />
rtkforwardprojections -i muCT.mha -o rayCastInterpolatorProjections.mha -g geometry.xml --fp RayCastInterpolator<br />
</source><br />
<br />
And for back projection<br />
<br />
<source lang="bash" enclose="div"><br />
rtkbackprojections -p . -r projections.mha -o voxelBasedBackProjection.mha -g geometry.xml --bp VoxelBasedBackProjection<br />
</source><br />
<source lang="bash" enclose="div"><br />
rtkbackprojections -p . -r projections.mha -o josephBackProjection.mha -g geometry.xml --bp Joseph<br />
</source><br />
<source lang="bash" enclose="div"><br />
rtkbackprojections -p . -r projections.mha -o normalizedJosephBackProjection.mha -g geometry.xml --bp NormalizedJoseph<br />
</source><br />
<br />
If you have a CUDA-capable graphics card, and have compiled RTK with RTK_USE_CUDA=ON, you can also try the following<br />
<br />
<source lang="bash" enclose="div"><br />
rtkforwardprojections -i muCT.mha -o cudaRayCastProjections.mha -g geometry.xml --fp CudaRayCast<br />
</source><br />
<source lang="bash" enclose="div"><br />
rtkbackprojections -p . -r projections.mha -o cudaRayCastBackProjection.mha -g geometry.xml --bp CudaRayCast<br />
</source><br />
<source lang="bash" enclose="div"><br />
rtkbackprojections -p . -r projections.mha -o cudaBackProjection.mha -g geometry.xml --bp CudaBackProjection<br />
</source><br />
<br />
== Creating a very small dataset ==<br />
<br />
Various reconstruction algorithms exist, which employ forward and back projection extensively. We will now start performing real reconstructions using some of the algorithms implemented in RTK. Since these algorithms are computationally much more demanding than the standard FDK, we propose to run them with low resolution data. You will be able to re-compute them at full resolution later, since the present page will remain available to you after the training. Note that, for the regularized reconstruction techniques, you will have to re-tune the regularization parameters yourself, since they depend (among many things) on resolution.<br />
<br />
Start by downloading the cone beam CT projection data [http://midas3.kitware.com/midas/download/item/208648/projections.tgz here], and extract it. It contains 644 projections, each one in a ".his" file. You can view them in vv by typing<br />
<br />
<source lang="bash" enclose="div"><br />
vv --sequence *.his<br />
</source><br />
<br />
RTK has a collection of tools to convert and preprocess commercial CBCT projection data, most of which are combined in the application "rtkprojections". To convert and preprocess these projections, run<br />
<br />
<source lang="bash" enclose="div"><br />
rtkprojections -p . -r .*.his -o downsampledProjections.mha --binning "4, 4"<br />
</source><br />
<br />
The '--binning "4, 4"' option downsamples the projections by 4 along both axes. Since this is not enough to reach acceptable reconstruction times for the training, we will build a sub-dataset by selecting only one projection out of 5. You can do this by running <br />
<br />
<source lang="bash" enclose="div"><br />
rtksubselect -p . -r downsampledProjections.mha -g geometry.xml --out_geometry subGeometry.xml --out_proj subProjections.mha -s 5<br />
</source><br />
<br />
This creates a new geometry file and a new projections file, from which even a laptop should be able to perform iterative reconstruction in reasonable time.<br />
<br />
== Unregularized 3D iterative reconstruction algorithms ==<br />
<br />
The most popular iterative reconstruction algorithm is the Simultaneous Algebraic Reconstruction Technique (SART). Try it by running<br />
<br />
<source lang="bash" enclose="div"><br />
rtksart -p . -r subProjections.mha -g subGeometry.xml -o SART.mha --dimension 128 --spacing 3<br />
</source><br />
<br />
Another popular technique uses the conjugate gradient algorithm<br />
<br />
<source lang="bash" enclose="div"><br />
rtkconjugategradient -p . -r subProjections.mha -g subGeometry.xml -o CG.mha --dimension 128 --spacing 3 -n 10<br />
</source><br />
<br />
You can compare the results by running<br />
<br />
<source lang="bash" enclose="div"><br />
vv SART.mha CG.mha --linkall<br />
</source><br />
<br />
The SART reconstruction should be sharper than the conjugate gradient one. If you are interested in understanding the reasons for this difference, try running <br />
<br />
<source lang="bash" enclose="div"><br />
rtksart -p . -r subProjections.mha -g subGeometry.xml -o SART.mha --dimension 128 --spacing 3 --nprojspersubset 10<br />
</source><br />
<br />
The differences in image quality (sharpness, contrast, ...) and convergence speed, stability, ... between the various algorithms may be discussed briefly during the training.<br />
<br />
== Regularized 3D iterative reconstruction algorithms ==<br />
<br />
RTK also includes algorithms that perform regularization during the reconstruction. You can try for example<br />
<br />
<source lang="bash" enclose="div"><br />
rtkadmmtotalvariation -p . -r subProjections.mha -g subGeometry.xml -o admmTV.mha --dimension 128 --spacing 3 -n 10 --beta 1000 --alpha 1<br />
</source><br />
<br />
and<br />
<br />
<source lang="bash" enclose="div"><br />
rtkadmmwavelets -p . -r subProjections.mha -g subGeometry.xml -o admmWavelets.mha --dimension 128 --spacing 3 -n 10 --beta 1000 --alpha 1<br />
</source><br />
<br />
Note that these algorithms have little interest when working with such low resolution data, since most of the noise and artifacts they are meant to remove have already been eliminated by undersampling.</div>Cyril.moryhttps://wiki.openrtk.org/index.php?title=RTK/Meetings/TrainingNov15&diff=419RTK/Meetings/TrainingNov152015-10-26T14:38:17Z<p>Cyril.mory: /* Creating a very small dataset */</p>
<hr />
<div>Here is a list of the RTK command lines you will have to run during the training, along with the data you will need.<br />
To start, download the following [http://midas3.kitware.com/midas/download/item/318788/muCT.mha CT data] and a relevant Cone-Beam CT [http://midas3.kitware.com/midas/download/item/318790/geometry.xml geometry file].<br />
<br />
== Forward projection ==<br />
<br />
To forward project the CT volume, following the geometry described in geometry.xml, run<br />
<br />
<source lang="bash" enclose="div"><br />
rtkforwardprojections -i muCT.mha -o projections.mha -g geometry.xml<br />
</source><br />
<br />
Look at the result using vv<br />
<br />
<source lang="bash" enclose="div"><br />
vv projections.mha<br />
</source><br />
<br />
There are as many projections as described in the geometry.xml file. You can edit the geometry.xml file, remove all projections except one, and try again. Such a modified geometry file is available [http://midas3.kitware.com/midas/download/item/318789/singleProjectionGeometry.xml here]. Run the following command line<br />
<br />
<source lang="bash" enclose="div"><br />
rtkforwardprojections -i muCT.mha -o singleProjection.mha -g singleProjectionGeometry.xml<br />
</source><br />
<br />
You can check with vv that the file contains only one projection<br />
<br />
<source lang="bash" enclose="div"><br />
vv singleProjection.mha<br />
</source><br />
<br />
== Back projection ==<br />
<br />
Start by back projecting a single projection. Run<br />
<br />
<source lang="bash" enclose="div"><br />
rtkbackprojections -p . -r singleProjection.mha -o singleBackProjection.mha -g singleProjectionGeometry.xml<br />
</source><br />
<br />
Observe the result with vv<br />
<br />
<source lang="bash" enclose="div"><br />
vv singleBackProjection.mha<br />
</source><br />
<br />
As you can see, the projection data seems to be smeared into the volume. Now back project all projections, by running<br />
<br />
<source lang="bash" enclose="div"><br />
rtkbackprojections -p . -r projections.mha -o backProjection.mha -g geometry.xml<br />
</source><br />
<br />
Look at the result with vv. In order to compare it with the original image, run <br />
<br />
<source lang="bash" enclose="div"><br />
vv backProjection.mha muCT.mha --linkall<br />
</source><br />
<br />
Click in one of the display windows, hit 'Ctrl + G' to center the view on the tumor. Hit 'w' to automatically compute reasonable window and level values. You can navigate between "muCT.mha" and "backProjection.mha" by hitting the 'Tab' key.<br />
<br />
== Using different forward and back projection algorithms ==<br />
<br />
Both rtkforwardprojections and rtkbackprojections can use several algorithms to perform the forward or back projections. For forward projections, you can try the following command lines<br />
<br />
<source lang="bash" enclose="div"><br />
rtkforwardprojections -i muCT.mha -o josephProjections.mha -g geometry.xml --fp Joseph<br />
</source><br />
<source lang="bash" enclose="div"><br />
rtkforwardprojections -i muCT.mha -o rayCastInterpolatorProjections.mha -g geometry.xml --fp RayCastInterpolator<br />
</source><br />
<br />
And for back projection<br />
<br />
<source lang="bash" enclose="div"><br />
rtkbackprojections -p . -r projections.mha -o voxelBasedBackProjection.mha -g geometry.xml --bp VoxelBasedBackProjection<br />
</source><br />
<source lang="bash" enclose="div"><br />
rtkbackprojections -p . -r projections.mha -o josephBackProjection.mha -g geometry.xml --bp Joseph<br />
</source><br />
<source lang="bash" enclose="div"><br />
rtkbackprojections -p . -r projections.mha -o normalizedJosephBackProjection.mha -g geometry.xml --bp NormalizedJoseph<br />
</source><br />
<br />
If you have a CUDA-capable graphics card, and have compiled RTK with RTK_USE_CUDA=ON, you can also try the following<br />
<br />
<source lang="bash" enclose="div"><br />
rtkforwardprojections -i muCT.mha -o cudaRayCastProjections.mha -g geometry.xml --fp CudaRayCast<br />
</source><br />
<source lang="bash" enclose="div"><br />
rtkbackprojections -p . -r projections.mha -o cudaRayCastBackProjection.mha -g geometry.xml --bp CudaRayCast<br />
</source><br />
<source lang="bash" enclose="div"><br />
rtkbackprojections -p . -r projections.mha -o cudaBackProjection.mha -g geometry.xml --bp CudaBackProjection<br />
</source><br />
<br />
== Creating a very small dataset ==<br />
<br />
Various reconstruction algorithms exist, which employ forward and back projection extensively. We will now start performing real reconstructions using some of the algorithms implemented in RTK. Since these algorithms are computationally much more demanding than the standard FDK, we propose to run them with low resolution data. You will be able to re-compute them at full resolution later, since the present page will remain available to you after the training. Note that, for the regularized reconstruction techniques, you will have to re-tune the regularization parameters yourself, since they depend (among many things) on resolution.<br />
<br />
Start by downloading the cone beam CT projection data [http://midas3.kitware.com/midas/download/item/208648/projections.tgz here], and extract it. It contains 644 projections, each one in a ".his" file. You can view them in vv by typing<br />
<br />
<source lang="bash" enclose="div"><br />
vv --sequence *.his<br />
</source><br />
<br />
RTK has a collection of tools to convert and preprocess commercial CBCT projection data, most of which are combined in the application "rtkprojections". To convert and preprocess these projections, run<br />
<br />
<source lang="bash" enclose="div"><br />
rtkprojections -p . -r .*.his -o downsampledProjections.mha --binning "4, 4"<br />
</source><br />
<br />
The '--binning "4, 4"' option downsamples the projections by 4 along both axes. Since this is not enough to reach acceptable reconstruction times for the training, we will build a sub-dataset by selecting only one projection out of 5. You can do this by running <br />
<br />
<source lang="bash" enclose="div"><br />
rtksubselect -p . -r downsampledProjections.mha -g geometry.xml --out_geometry subGeometry.xml --out_proj subProjections.mha -s 5<br />
</source><br />
<br />
This creates a new geometry file and a new projections file, from which even a laptop should be able to perform iterative reconstruction in reasonable time.<br />
<br />
== Unregularized 3D iterative reconstruction algorithms ==<br />
<br />
The most popular iterative reconstruction algorithm is the Simultaneous Algebraic Reconstruction Technique (SART). Try it by running<br />
<br />
<source lang="bash" enclose="div"><br />
rtksart -p . -r subProjections.mha -g subGeometry.xml -o SART.mha --dimension 128 --spacing 3<br />
</source><br />
<br />
Another popular technique uses the conjugate gradient algorithm<br />
<br />
<source lang="bash" enclose="div"><br />
rtkconjugategradient -p . -r subProjections.mha -g subGeometry.xml -o CG.mha --dimension 128 --spacing 3 -n 10<br />
</source><br />
<br />
You can compare the results by running<br />
<br />
<source lang="bash" enclose="div"><br />
vv SART.mha CG.mha --linkall<br />
</source><br />
<br />
The SART reconstruction should be sharper than the conjugate gradient one. If you are interested in understanding the reasons for this difference, try running <br />
<br />
<source lang="bash" enclose="div"><br />
rtksart -p . -r subProjections.mha -g subGeometry.xml -o SART.mha --dimension 128 --spacing 3 --nprojspersubset 10<br />
</source><br />
<br />
The differences in image quality (sharpness, contrast, ...) and convergence speed, stability, ... between the various algorithms may be discussed briefly during the training.<br />
<br />
== Regularized 3D iterative reconstruction algorithms ==<br />
<br />
RTK also includes algorithms that perform regularization during the reconstruction. You can try for example<br />
<br />
<source lang="bash" enclose="div"><br />
rtkadmmtotalvariation -p . -r subProjections.mha -g subGeometry.xml -o admmTV.mha --dimension 128 --spacing 3 -n 10 --beta 1000 --alpha 1<br />
</source><br />
<br />
and<br />
<br />
<source lang="bash" enclose="div"><br />
rtkadmmwavelets -p . -r subProjections.mha -g subGeometry.xml -o admmTV.mha --dimension 128 --spacing 3 -n 10 --beta 1000 --alpha 1<br />
</source><br />
<br />
Note that these algorithms have little interest when working with such low resolution data, since most of the noise and artifacts they are meant to remove have already been eliminated by undersampling.</div>Cyril.moryhttps://wiki.openrtk.org/index.php?title=RTK/Meetings/TrainingNov15&diff=418RTK/Meetings/TrainingNov152015-10-26T14:36:41Z<p>Cyril.mory: /* Regularized 3D iterative reconstruction algorithms */</p>
<hr />
<div>Here is a list of the RTK command lines you will have to run during the training, along with the data you will need.<br />
To start, download the following [http://midas3.kitware.com/midas/download/item/318788/muCT.mha CT data] and a relevant Cone-Beam CT [http://midas3.kitware.com/midas/download/item/318790/geometry.xml geometry file].<br />
<br />
== Forward projection ==<br />
<br />
To forward project the CT volume, following the geometry described in geometry.xml, run<br />
<br />
<source lang="bash" enclose="div"><br />
rtkforwardprojections -i muCT.mha -o projections.mha -g geometry.xml<br />
</source><br />
<br />
Look at the result using vv<br />
<br />
<source lang="bash" enclose="div"><br />
vv projections.mha<br />
</source><br />
<br />
There are as many projections as described in the geometry.xml file. You can edit the geometry.xml file, remove all projections except one, and try again. Such a modified geometry file is available [http://midas3.kitware.com/midas/download/item/318789/singleProjectionGeometry.xml here]. Run the following command line<br />
<br />
<source lang="bash" enclose="div"><br />
rtkforwardprojections -i muCT.mha -o singleProjection.mha -g singleProjectionGeometry.xml<br />
</source><br />
<br />
You can check with vv that the file contains only one projection<br />
<br />
<source lang="bash" enclose="div"><br />
vv singleProjection.mha<br />
</source><br />
<br />
== Back projection ==<br />
<br />
Start by back projecting a single projection. Run<br />
<br />
<source lang="bash" enclose="div"><br />
rtkbackprojections -p . -r singleProjection.mha -o singleBackProjection.mha -g singleProjectionGeometry.xml<br />
</source><br />
<br />
Observe the result with vv<br />
<br />
<source lang="bash" enclose="div"><br />
vv singleBackProjection.mha<br />
</source><br />
<br />
As you can see, the projection data seems to be smeared into the volume. Now back project all projections, by running<br />
<br />
<source lang="bash" enclose="div"><br />
rtkbackprojections -p . -r projections.mha -o backProjection.mha -g geometry.xml<br />
</source><br />
<br />
Look at the result with vv. In order to compare it with the original image, run <br />
<br />
<source lang="bash" enclose="div"><br />
vv backProjection.mha muCT.mha --linkall<br />
</source><br />
<br />
Click in one of the display windows, hit 'Ctrl + G' to center the view on the tumor. Hit 'w' to automatically compute reasonable window and level values. You can navigate between "muCT.mha" and "backProjection.mha" by hitting the 'Tab' key.<br />
<br />
== Using different forward and back projection algorithms ==<br />
<br />
Both rtkforwardprojections and rtkbackprojections can use several algorithms to perform the forward or back projections. For forward projections, you can try the following command lines<br />
<br />
<source lang="bash" enclose="div"><br />
rtkforwardprojections -i muCT.mha -o josephProjections.mha -g geometry.xml --fp Joseph<br />
</source><br />
<source lang="bash" enclose="div"><br />
rtkforwardprojections -i muCT.mha -o rayCastInterpolatorProjections.mha -g geometry.xml --fp RayCastInterpolator<br />
</source><br />
<br />
And for back projection<br />
<br />
<source lang="bash" enclose="div"><br />
rtkbackprojections -p . -r projections.mha -o voxelBasedBackProjection.mha -g geometry.xml --bp VoxelBasedBackProjection<br />
</source><br />
<source lang="bash" enclose="div"><br />
rtkbackprojections -p . -r projections.mha -o josephBackProjection.mha -g geometry.xml --bp Joseph<br />
</source><br />
<source lang="bash" enclose="div"><br />
rtkbackprojections -p . -r projections.mha -o normalizedJosephBackProjection.mha -g geometry.xml --bp NormalizedJoseph<br />
</source><br />
<br />
If you have a CUDA-capable graphics card, and have compiled RTK with RTK_USE_CUDA=ON, you can also try the following<br />
<br />
<source lang="bash" enclose="div"><br />
rtkforwardprojections -i muCT.mha -o cudaRayCastProjections.mha -g geometry.xml --fp CudaRayCast<br />
</source><br />
<source lang="bash" enclose="div"><br />
rtkbackprojections -p . -r projections.mha -o cudaRayCastBackProjection.mha -g geometry.xml --bp CudaRayCast<br />
</source><br />
<source lang="bash" enclose="div"><br />
rtkbackprojections -p . -r projections.mha -o cudaBackProjection.mha -g geometry.xml --bp CudaBackProjection<br />
</source><br />
<br />
== Creating a very small dataset ==<br />
<br />
Various reconstruction algorithms exist, which employ forward and back projection extensively. We will now start performing real reconstructions using some of the algorithms implemented in RTK. Since these algorithms are computationally much more demanding than the standard FDK, we propose to run them with low resolution data. You will be able to re-compute them at full resolution later, since the present page will remain available to you after the training.<br />
<br />
Start by downloading the cone beam CT projection data [http://midas3.kitware.com/midas/download/item/208648/projections.tgz here], and extract it. It contains 644 projections, each one in a ".his" file. You can view them in vv by typing<br />
<br />
<source lang="bash" enclose="div"><br />
vv --sequence *.his<br />
</source><br />
<br />
RTK has a collection of tools to convert and preprocess commercial CBCT projection data, most of which are combined in the application "rtkprojections". To convert and preprocess these projections, run<br />
<br />
<source lang="bash" enclose="div"><br />
rtkprojections -p . -r .*.his -o downsampledProjections.mha --binning "4, 4"<br />
</source><br />
<br />
The '--binning "4, 4"' option downsamples the projections by 4 along both axes. Since this is not enough to reach acceptable reconstruction times for the training, we will build a sub-dataset by selecting only one projection out of 5. You can do this by running <br />
<br />
<source lang="bash" enclose="div"><br />
rtksubselect -p . -r downsampledProjections.mha -g geometry.xml --out_geometry subGeometry.xml --out_proj subProjections.mha -s 5<br />
</source><br />
<br />
This creates a new geometry file and a new projections file, from which even a laptop should be able to perform iterative reconstruction in reasonable time. <br />
<br />
== Unregularized 3D iterative reconstruction algorithms ==<br />
<br />
The most popular iterative reconstruction algorithm is the Simultaneous Algebraic Reconstruction Technique (SART). Try it by running<br />
<br />
<source lang="bash" enclose="div"><br />
rtksart -p . -r subProjections.mha -g subGeometry.xml -o SART.mha --dimension 128 --spacing 3<br />
</source><br />
<br />
Another popular technique uses the conjugate gradient algorithm<br />
<br />
<source lang="bash" enclose="div"><br />
rtkconjugategradient -p . -r subProjections.mha -g subGeometry.xml -o CG.mha --dimension 128 --spacing 3 -n 10<br />
</source><br />
<br />
You can compare the results by running<br />
<br />
<source lang="bash" enclose="div"><br />
vv SART.mha CG.mha --linkall<br />
</source><br />
<br />
The SART reconstruction should be sharper than the conjugate gradient one. If you are interested in understanding the reasons for this difference, try running <br />
<br />
<source lang="bash" enclose="div"><br />
rtksart -p . -r subProjections.mha -g subGeometry.xml -o SART.mha --dimension 128 --spacing 3 --nprojspersubset 10<br />
</source><br />
<br />
The differences in image quality (sharpness, contrast, ...) and convergence speed, stability, ... between the various algorithms may be discussed briefly during the training.<br />
<br />
== Regularized 3D iterative reconstruction algorithms ==<br />
<br />
RTK also includes algorithms that perform regularization during the reconstruction. You can try for example<br />
<br />
<source lang="bash" enclose="div"><br />
rtkadmmtotalvariation -p . -r subProjections.mha -g subGeometry.xml -o admmTV.mha --dimension 128 --spacing 3 -n 10 --beta 1000 --alpha 1<br />
</source><br />
<br />
and<br />
<br />
<source lang="bash" enclose="div"><br />
rtkadmmwavelets -p . -r subProjections.mha -g subGeometry.xml -o admmTV.mha --dimension 128 --spacing 3 -n 10 --beta 1000 --alpha 1<br />
</source><br />
<br />
Note that these algorithms have little interest when working with such low resolution data, since most of the noise and artifacts they are meant to remove have already been eliminated by undersampling.</div>Cyril.moryhttps://wiki.openrtk.org/index.php?title=RTK/Meetings/TrainingNov15&diff=417RTK/Meetings/TrainingNov152015-10-26T14:27:08Z<p>Cyril.mory: /* Regularized 3D iterative reconstruction algorithms */</p>
<hr />
<div>Here is a list of the RTK command lines you will have to run during the training, along with the data you will need.<br />
To start, download the following [http://midas3.kitware.com/midas/download/item/318788/muCT.mha CT data] and a relevant Cone-Beam CT [http://midas3.kitware.com/midas/download/item/318790/geometry.xml geometry file].<br />
<br />
== Forward projection ==<br />
<br />
To forward project the CT volume, following the geometry described in geometry.xml, run<br />
<br />
<source lang="bash" enclose="div"><br />
rtkforwardprojections -i muCT.mha -o projections.mha -g geometry.xml<br />
</source><br />
<br />
Look at the result using vv<br />
<br />
<source lang="bash" enclose="div"><br />
vv projections.mha<br />
</source><br />
<br />
There are as many projections as described in the geometry.xml file. You can edit the geometry.xml file, remove all projections except one, and try again. Such a modified geometry file is available [http://midas3.kitware.com/midas/download/item/318789/singleProjectionGeometry.xml here]. Run the following command line<br />
<br />
<source lang="bash" enclose="div"><br />
rtkforwardprojections -i muCT.mha -o singleProjection.mha -g singleProjectionGeometry.xml<br />
</source><br />
<br />
You can check with vv that the file contains only one projection<br />
<br />
<source lang="bash" enclose="div"><br />
vv singleProjection.mha<br />
</source><br />
<br />
== Back projection ==<br />
<br />
Start by back projecting a single projection. Run<br />
<br />
<source lang="bash" enclose="div"><br />
rtkbackprojections -p . -r singleProjection.mha -o singleBackProjection.mha -g singleProjectionGeometry.xml<br />
</source><br />
<br />
Observe the result with vv<br />
<br />
<source lang="bash" enclose="div"><br />
vv singleBackProjection.mha<br />
</source><br />
<br />
As you can see, the projection data seems to be smeared into the volume. Now back project all projections, by running<br />
<br />
<source lang="bash" enclose="div"><br />
rtkbackprojections -p . -r projections.mha -o backProjection.mha -g geometry.xml<br />
</source><br />
<br />
Look at the result with vv. In order to compare it with the original image, run <br />
<br />
<source lang="bash" enclose="div"><br />
vv backProjection.mha muCT.mha --linkall<br />
</source><br />
<br />
Click in one of the display windows, hit 'Ctrl + G' to center the view on the tumor. Hit 'w' to automatically compute reasonable window and level values. You can navigate between "muCT.mha" and "backProjection.mha" by hitting the 'Tab' key.<br />
<br />
== Using different forward and back projection algorithms ==<br />
<br />
Both rtkforwardprojections and rtkbackprojections can use several algorithms to perform the forward or back projections. For forward projections, you can try the following command lines<br />
<br />
<source lang="bash" enclose="div"><br />
rtkforwardprojections -i muCT.mha -o josephProjections.mha -g geometry.xml --fp Joseph<br />
</source><br />
<source lang="bash" enclose="div"><br />
rtkforwardprojections -i muCT.mha -o rayCastInterpolatorProjections.mha -g geometry.xml --fp RayCastInterpolator<br />
</source><br />
<br />
And for back projection<br />
<br />
<source lang="bash" enclose="div"><br />
rtkbackprojections -p . -r projections.mha -o voxelBasedBackProjection.mha -g geometry.xml --bp VoxelBasedBackProjection<br />
</source><br />
<source lang="bash" enclose="div"><br />
rtkbackprojections -p . -r projections.mha -o josephBackProjection.mha -g geometry.xml --bp Joseph<br />
</source><br />
<source lang="bash" enclose="div"><br />
rtkbackprojections -p . -r projections.mha -o normalizedJosephBackProjection.mha -g geometry.xml --bp NormalizedJoseph<br />
</source><br />
<br />
If you have a CUDA-capable graphics card, and have compiled RTK with RTK_USE_CUDA=ON, you can also try the following<br />
<br />
<source lang="bash" enclose="div"><br />
rtkforwardprojections -i muCT.mha -o cudaRayCastProjections.mha -g geometry.xml --fp CudaRayCast<br />
</source><br />
<source lang="bash" enclose="div"><br />
rtkbackprojections -p . -r projections.mha -o cudaRayCastBackProjection.mha -g geometry.xml --bp CudaRayCast<br />
</source><br />
<source lang="bash" enclose="div"><br />
rtkbackprojections -p . -r projections.mha -o cudaBackProjection.mha -g geometry.xml --bp CudaBackProjection<br />
</source><br />
<br />
== Creating a very small dataset ==<br />
<br />
Various reconstruction algorithms exist, which employ forward and back projection extensively. We will now start performing real reconstructions using some of the algorithms implemented in RTK. Since these algorithms are computationally much more demanding than the standard FDK, we propose to run them with low resolution data. You will be able to re-compute them at full resolution later, since the present page will remain available to you after the training.<br />
<br />
Start by downloading the cone beam CT projection data [http://midas3.kitware.com/midas/download/item/208648/projections.tgz here], and extract it. It contains 644 projections, each one in a ".his" file. You can view them in vv by typing<br />
<br />
<source lang="bash" enclose="div"><br />
vv --sequence *.his<br />
</source><br />
<br />
RTK has a collection of tools to convert and preprocess commercial CBCT projection data, most of which are combined in the application "rtkprojections". To convert and preprocess these projections, run<br />
<br />
<source lang="bash" enclose="div"><br />
rtkprojections -p . -r .*.his -o downsampledProjections.mha --binning "4, 4"<br />
</source><br />
<br />
The '--binning "4, 4"' option downsamples the projections by 4 along both axes. Since this is not enough to reach acceptable reconstruction times for the training, we will build a sub-dataset by selecting only one projection out of 5. You can do this by running <br />
<br />
<source lang="bash" enclose="div"><br />
rtksubselect -p . -r downsampledProjections.mha -g geometry.xml --out_geometry subGeometry.xml --out_proj subProjections.mha -s 5<br />
</source><br />
<br />
This creates a new geometry file and a new projections file, from which even a laptop should be able to perform iterative reconstruction in reasonable time. <br />
<br />
== Unregularized 3D iterative reconstruction algorithms ==<br />
<br />
The most popular iterative reconstruction algorithm is the Simultaneous Algebraic Reconstruction Technique (SART). Try it by running<br />
<br />
<source lang="bash" enclose="div"><br />
rtksart -p . -r subProjections.mha -g subGeometry.xml -o SART.mha --dimension 128 --spacing 3<br />
</source><br />
<br />
Another popular technique uses the conjugate gradient algorithm<br />
<br />
<source lang="bash" enclose="div"><br />
rtkconjugategradient -p . -r subProjections.mha -g subGeometry.xml -o CG.mha --dimension 128 --spacing 3 -n 10<br />
</source><br />
<br />
You can compare the results by running<br />
<br />
<source lang="bash" enclose="div"><br />
vv SART.mha CG.mha --linkall<br />
</source><br />
<br />
The SART reconstruction should be sharper than the conjugate gradient one. If you are interested in understanding the reasons for this difference, try running <br />
<br />
<source lang="bash" enclose="div"><br />
rtksart -p . -r subProjections.mha -g subGeometry.xml -o SART.mha --dimension 128 --spacing 3 --nprojspersubset 10<br />
</source><br />
<br />
The differences in image quality (sharpness, contrast, ...) and convergence speed, stability, ... between the various algorithms may be discussed briefly during the training.<br />
<br />
== Regularized 3D iterative reconstruction algorithms ==<br />
<br />
RTK also includes algorithms that perform regularization during the reconstruction. You can try for example<br />
<br />
<source lang="bash" enclose="div"><br />
rtkadmmtotalvariation -p . -r subProjections.mha -g subGeometry.xml -o admmTV.mha --dimension 128 --spacing 3 -n 10 --beta 1000 --alpha 1<br />
</source><br />
<br />
and<br />
<br />
<source lang="bash" enclose="div"><br />
rtkadmmwavelets -p . -r subProjections.mha -g subGeometry.xml -o admmTV.mha --dimension 128 --spacing 3 -n 10 --beta 1000 --alpha 1<br />
</source></div>Cyril.moryhttps://wiki.openrtk.org/index.php?title=RTK/Meetings/TrainingNov15&diff=416RTK/Meetings/TrainingNov152015-10-26T14:24:47Z<p>Cyril.mory: /* Using different forward and back projection algorithms */</p>
<hr />
<div>Here is a list of the RTK command lines you will have to run during the training, along with the data you will need.<br />
To start, download the following [http://midas3.kitware.com/midas/download/item/318788/muCT.mha CT data] and a relevant Cone-Beam CT [http://midas3.kitware.com/midas/download/item/318790/geometry.xml geometry file].<br />
<br />
== Forward projection ==<br />
<br />
To forward project the CT volume, following the geometry described in geometry.xml, run<br />
<br />
<source lang="bash" enclose="div"><br />
rtkforwardprojections -i muCT.mha -o projections.mha -g geometry.xml<br />
</source><br />
<br />
Look at the result using vv<br />
<br />
<source lang="bash" enclose="div"><br />
vv projections.mha<br />
</source><br />
<br />
There are as many projections as described in the geometry.xml file. You can edit the geometry.xml file, remove all projections except one, and try again. Such a modified geometry file is available [http://midas3.kitware.com/midas/download/item/318789/singleProjectionGeometry.xml here]. Run the following command line<br />
<br />
<source lang="bash" enclose="div"><br />
rtkforwardprojections -i muCT.mha -o singleProjection.mha -g singleProjectionGeometry.xml<br />
</source><br />
<br />
You can check with vv that the file contains only one projection<br />
<br />
<source lang="bash" enclose="div"><br />
vv singleProjection.mha<br />
</source><br />
<br />
== Back projection ==<br />
<br />
Start by back projecting a single projection. Run<br />
<br />
<source lang="bash" enclose="div"><br />
rtkbackprojections -p . -r singleProjection.mha -o singleBackProjection.mha -g singleProjectionGeometry.xml<br />
</source><br />
<br />
Observe the result with vv<br />
<br />
<source lang="bash" enclose="div"><br />
vv singleBackProjection.mha<br />
</source><br />
<br />
As you can see, the projection data seems to be smeared into the volume. Now back project all projections, by running<br />
<br />
<source lang="bash" enclose="div"><br />
rtkbackprojections -p . -r projections.mha -o backProjection.mha -g geometry.xml<br />
</source><br />
<br />
Look at the result with vv. In order to compare it with the original image, run <br />
<br />
<source lang="bash" enclose="div"><br />
vv backProjection.mha muCT.mha --linkall<br />
</source><br />
<br />
Click in one of the display windows, hit 'Ctrl + G' to center the view on the tumor. Hit 'w' to automatically compute reasonable window and level values. You can navigate between "muCT.mha" and "backProjection.mha" by hitting the 'Tab' key.<br />
<br />
== Using different forward and back projection algorithms ==<br />
<br />
Both rtkforwardprojections and rtkbackprojections can use several algorithms to perform the forward or back projections. For forward projections, you can try the following command lines<br />
<br />
<source lang="bash" enclose="div"><br />
rtkforwardprojections -i muCT.mha -o josephProjections.mha -g geometry.xml --fp Joseph<br />
</source><br />
<source lang="bash" enclose="div"><br />
rtkforwardprojections -i muCT.mha -o rayCastInterpolatorProjections.mha -g geometry.xml --fp RayCastInterpolator<br />
</source><br />
<br />
And for back projection<br />
<br />
<source lang="bash" enclose="div"><br />
rtkbackprojections -p . -r projections.mha -o voxelBasedBackProjection.mha -g geometry.xml --bp VoxelBasedBackProjection<br />
</source><br />
<source lang="bash" enclose="div"><br />
rtkbackprojections -p . -r projections.mha -o josephBackProjection.mha -g geometry.xml --bp Joseph<br />
</source><br />
<source lang="bash" enclose="div"><br />
rtkbackprojections -p . -r projections.mha -o normalizedJosephBackProjection.mha -g geometry.xml --bp NormalizedJoseph<br />
</source><br />
<br />
If you have a CUDA-capable graphics card, and have compiled RTK with RTK_USE_CUDA=ON, you can also try the following<br />
<br />
<source lang="bash" enclose="div"><br />
rtkforwardprojections -i muCT.mha -o cudaRayCastProjections.mha -g geometry.xml --fp CudaRayCast<br />
</source><br />
<source lang="bash" enclose="div"><br />
rtkbackprojections -p . -r projections.mha -o cudaRayCastBackProjection.mha -g geometry.xml --bp CudaRayCast<br />
</source><br />
<source lang="bash" enclose="div"><br />
rtkbackprojections -p . -r projections.mha -o cudaBackProjection.mha -g geometry.xml --bp CudaBackProjection<br />
</source><br />
<br />
== Creating a very small dataset ==<br />
<br />
Various reconstruction algorithms exist, which employ forward and back projection extensively. We will now start performing real reconstructions using some of the algorithms implemented in RTK. Since these algorithms are computationally much more demanding than the standard FDK, we propose to run them with low resolution data. You will be able to re-compute them at full resolution later, since the present page will remain available to you after the training.<br />
<br />
Start by downloading the cone beam CT projection data [http://midas3.kitware.com/midas/download/item/208648/projections.tgz here], and extract it. It contains 644 projections, each one in a ".his" file. You can view them in vv by typing<br />
<br />
<source lang="bash" enclose="div"><br />
vv --sequence *.his<br />
</source><br />
<br />
RTK has a collection of tools to convert and preprocess commercial CBCT projection data, most of which are combined in the application "rtkprojections". To convert and preprocess these projections, run<br />
<br />
<source lang="bash" enclose="div"><br />
rtkprojections -p . -r .*.his -o downsampledProjections.mha --binning "4, 4"<br />
</source><br />
<br />
The '--binning "4, 4"' option downsamples the projections by 4 along both axes. Since this is not enough to reach acceptable reconstruction times for the training, we will build a sub-dataset by selecting only one projection out of 5. You can do this by running <br />
<br />
<source lang="bash" enclose="div"><br />
rtksubselect -p . -r downsampledProjections.mha -g geometry.xml --out_geometry subGeometry.xml --out_proj subProjections.mha -s 5<br />
</source><br />
<br />
This creates a new geometry file and a new projections file, from which even a laptop should be able to perform iterative reconstruction in reasonable time. <br />
<br />
== Unregularized 3D iterative reconstruction algorithms ==<br />
<br />
The most popular iterative reconstruction algorithm is the Simultaneous Algebraic Reconstruction Technique (SART). Try it by running<br />
<br />
<source lang="bash" enclose="div"><br />
rtksart -p . -r subProjections.mha -g subGeometry.xml -o SART.mha --dimension 128 --spacing 3<br />
</source><br />
<br />
Another popular technique uses the conjugate gradient algorithm<br />
<br />
<source lang="bash" enclose="div"><br />
rtkconjugategradient -p . -r subProjections.mha -g subGeometry.xml -o CG.mha --dimension 128 --spacing 3 -n 10<br />
</source><br />
<br />
You can compare the results by running<br />
<br />
<source lang="bash" enclose="div"><br />
vv SART.mha CG.mha --linkall<br />
</source><br />
<br />
The SART reconstruction should be sharper than the conjugate gradient one. If you are interested in understanding the reasons for this difference, try running <br />
<br />
<source lang="bash" enclose="div"><br />
rtksart -p . -r subProjections.mha -g subGeometry.xml -o SART.mha --dimension 128 --spacing 3 --nprojspersubset 10<br />
</source><br />
<br />
The differences in image quality (sharpness, contrast, ...) and convergence speed, stability, ... between the various algorithms may be discussed briefly during the training.<br />
<br />
== Regularized 3D iterative reconstruction algorithms ==<br />
<br />
<source lang="bash" enclose="div"><br />
rtkadmmtotalvariation -p . -r subProjections.mha -g subGeometry.xml -o admmTV.mha --dimension 128 --spacing 3 -n 10 --beta 1000 --alpha 1<br />
</source></div>Cyril.moryhttps://wiki.openrtk.org/index.php?title=RTK/Meetings/TrainingNov15&diff=415RTK/Meetings/TrainingNov152015-10-26T14:20:23Z<p>Cyril.mory: </p>
<hr />
<div>Here is a list of the RTK command lines you will have to run during the training, along with the data you will need.<br />
To start, download the following [http://midas3.kitware.com/midas/download/item/318788/muCT.mha CT data] and a relevant Cone-Beam CT [http://midas3.kitware.com/midas/download/item/318790/geometry.xml geometry file].<br />
<br />
== Forward projection ==<br />
<br />
To forward project the CT volume, following the geometry described in geometry.xml, run<br />
<br />
<source lang="bash" enclose="div"><br />
rtkforwardprojections -i muCT.mha -o projections.mha -g geometry.xml<br />
</source><br />
<br />
Look at the result using vv<br />
<br />
<source lang="bash" enclose="div"><br />
vv projections.mha<br />
</source><br />
<br />
There are as many projections as described in the geometry.xml file. You can edit the geometry.xml file, remove all projections except one, and try again. Such a modified geometry file is available [http://midas3.kitware.com/midas/download/item/318789/singleProjectionGeometry.xml here]. Run the following command line<br />
<br />
<source lang="bash" enclose="div"><br />
rtkforwardprojections -i muCT.mha -o singleProjection.mha -g singleProjectionGeometry.xml<br />
</source><br />
<br />
You can check with vv that the file contains only one projection<br />
<br />
<source lang="bash" enclose="div"><br />
vv singleProjection.mha<br />
</source><br />
<br />
== Back projection ==<br />
<br />
Start by back projecting a single projection. Run<br />
<br />
<source lang="bash" enclose="div"><br />
rtkbackprojections -p . -r singleProjection.mha -o singleBackProjection.mha -g singleProjectionGeometry.xml<br />
</source><br />
<br />
Observe the result with vv<br />
<br />
<source lang="bash" enclose="div"><br />
vv singleBackProjection.mha<br />
</source><br />
<br />
As you can see, the projection data seems to be smeared into the volume. Now back project all projections, by running<br />
<br />
<source lang="bash" enclose="div"><br />
rtkbackprojections -p . -r projections.mha -o backProjection.mha -g geometry.xml<br />
</source><br />
<br />
Look at the result with vv. In order to compare it with the original image, run <br />
<br />
<source lang="bash" enclose="div"><br />
vv backProjection.mha muCT.mha --linkall<br />
</source><br />
<br />
Click in one of the display windows, hit 'Ctrl + G' to center the view on the tumor. Hit 'w' to automatically compute reasonable window and level values. You can navigate between "muCT.mha" and "backProjection.mha" by hitting the 'Tab' key.<br />
<br />
== Using different forward and back projection algorithms ==<br />
<br />
Both rtkforwardprojections and rtkbackprojections can use several algorithms to perform the forward or back projections. For forward projections, you can try the following command lines<br />
<br />
<source lang="bash" enclose="div"><br />
rtkforwardprojections -i muCT.mha -o josephProjections.mha -g geometry.xml --fp Joseph<br />
rtkforwardprojections -i muCT.mha -o rayCastInterpolatorProjections.mha -g geometry.xml --fp RayCastInterpolator<br />
</source><br />
<br />
And for back projection<br />
<br />
<source lang="bash" enclose="div"><br />
rtkbackprojections -p . -r projections.mha -o voxelBasedBackProjection.mha -g geometry.xml --bp VoxelBasedBackProjection<br />
rtkbackprojections -p . -r projections.mha -o josephBackProjection.mha -g geometry.xml --bp Joseph<br />
rtkbackprojections -p . -r projections.mha -o normalizedJosephBackProjection.mha -g geometry.xml --bp NormalizedJoseph<br />
</source><br />
<br />
If you have a CUDA-capable graphics card, and have compiled RTK with RTK_USE_CUDA=ON, you can also try the following<br />
<br />
<source lang="bash" enclose="div"><br />
rtkforwardprojections -i muCT.mha -o cudaRayCastProjections.mha -g geometry.xml --fp CudaRayCast<br />
rtkbackprojections -p . -r projections.mha -o cudaRayCastBackProjection.mha -g geometry.xml --bp CudaRayCast<br />
rtkbackprojections -p . -r projections.mha -o cudaBackProjection.mha -g geometry.xml --bp CudaBackProjection<br />
</source><br />
<br />
== Creating a very small dataset ==<br />
<br />
Various reconstruction algorithms exist, which employ forward and back projection extensively. We will now start performing real reconstructions using some of the algorithms implemented in RTK. Since these algorithms are computationally much more demanding than the standard FDK, we propose to run them with low resolution data. You will be able to re-compute them at full resolution later, since the present page will remain available to you after the training.<br />
<br />
Start by downloading the cone beam CT projection data [http://midas3.kitware.com/midas/download/item/208648/projections.tgz here], and extract it. It contains 644 projections, each one in a ".his" file. You can view them in vv by typing<br />
<br />
<source lang="bash" enclose="div"><br />
vv --sequence *.his<br />
</source><br />
<br />
RTK has a collection of tools to convert and preprocess commercial CBCT projection data, most of which are combined in the application "rtkprojections". To convert and preprocess these projections, run<br />
<br />
<source lang="bash" enclose="div"><br />
rtkprojections -p . -r .*.his -o downsampledProjections.mha --binning "4, 4"<br />
</source><br />
<br />
The '--binning "4, 4"' option downsamples the projections by 4 along both axes. Since this is not enough to reach acceptable reconstruction times for the training, we will build a sub-dataset by selecting only one projection out of 5. You can do this by running <br />
<br />
<source lang="bash" enclose="div"><br />
rtksubselect -p . -r downsampledProjections.mha -g geometry.xml --out_geometry subGeometry.xml --out_proj subProjections.mha -s 5<br />
</source><br />
<br />
This creates a new geometry file and a new projections file, from which even a laptop should be able to perform iterative reconstruction in reasonable time. <br />
<br />
== Unregularized 3D iterative reconstruction algorithms ==<br />
<br />
The most popular iterative reconstruction algorithm is the Simultaneous Algebraic Reconstruction Technique (SART). Try it by running<br />
<br />
<source lang="bash" enclose="div"><br />
rtksart -p . -r subProjections.mha -g subGeometry.xml -o SART.mha --dimension 128 --spacing 3<br />
</source><br />
<br />
Another popular technique uses the conjugate gradient algorithm<br />
<br />
<source lang="bash" enclose="div"><br />
rtkconjugategradient -p . -r subProjections.mha -g subGeometry.xml -o CG.mha --dimension 128 --spacing 3 -n 10<br />
</source><br />
<br />
You can compare the results by running<br />
<br />
<source lang="bash" enclose="div"><br />
vv SART.mha CG.mha --linkall<br />
</source><br />
<br />
The SART reconstruction should be sharper than the conjugate gradient one. If you are interested in understanding the reasons for this difference, try running <br />
<br />
<source lang="bash" enclose="div"><br />
rtksart -p . -r subProjections.mha -g subGeometry.xml -o SART.mha --dimension 128 --spacing 3 --nprojspersubset 10<br />
</source><br />
<br />
The differences in image quality (sharpness, contrast, ...) and convergence speed, stability, ... between the various algorithms may be discussed briefly during the training.<br />
<br />
== Regularized 3D iterative reconstruction algorithms ==<br />
<br />
<source lang="bash" enclose="div"><br />
rtkadmmtotalvariation -p . -r subProjections.mha -g subGeometry.xml -o admmTV.mha --dimension 128 --spacing 3 -n 10 --beta 1000 --alpha 1<br />
</source></div>Cyril.moryhttps://wiki.openrtk.org/index.php?title=RTK/Meetings/TrainingNov15&diff=414RTK/Meetings/TrainingNov152015-10-26T13:59:46Z<p>Cyril.mory: /* Iterative reconstruction algorithms */</p>
<hr />
<div>Here is a list of the RTK command lines you will have to run during the training, along with the data you will need.<br />
To start, download the following [http://midas3.kitware.com/midas/download/item/318788/muCT.mha CT data] and a relevant Cone-Beam CT [http://midas3.kitware.com/midas/download/item/318790/geometry.xml geometry file].<br />
<br />
== Forward projection ==<br />
<br />
To forward project the CT volume, following the geometry described in geometry.xml, run<br />
<br />
rtkforwardprojections -i muCT.mha -o projections.mha -g geometry.xml<br />
<br />
Look at the result using vv<br />
<br />
vv projections.mha<br />
<br />
There are as many projections as described in the geometry.xml file. You can edit the geometry.xml file, remove all projections except one, and try again. Such a modified geometry file is available [http://midas3.kitware.com/midas/download/item/318789/singleProjectionGeometry.xml here]. Run the following command line<br />
<br />
rtkforwardprojections -i muCT.mha -o singleProjection.mha -g singleProjectionGeometry.xml<br />
<br />
You can check with vv that the file contains only one projection<br />
<br />
vv singleProjection.mha<br />
<br />
== Back projection ==<br />
<br />
Start by back projecting a single projection. Run<br />
<br />
rtkbackprojections -p . -r singleProjection.mha -o singleBackProjection.mha -g singleProjectionGeometry.xml<br />
<br />
Observe the result with vv<br />
<br />
vv singleBackProjection.mha<br />
<br />
As you can see, the projection data seems to be smeared into the volume. Now back project all projections, by running<br />
<br />
rtkbackprojections -p . -r projections.mha -o backProjection.mha -g geometry.xml<br />
<br />
Look at the result with vv. In order to compare it with the original image, run <br />
<br />
vv backProjection.mha muCT.mha --linkall<br />
<br />
Click in one of the display windows, hit 'Ctrl + G' to center the view on the tumor. Hit 'w' to automatically compute reasonable window and level values. You can navigate between "muCT.mha" and "backProjection.mha" by hitting the 'Tab' key.<br />
<br />
== Using different forward and back projection algorithms ==<br />
<br />
Both rtkforwardprojections and rtkbackprojections can use several algorithms to perform the forward or back projections. For forward projections, you can try the following command lines<br />
<br />
rtkforwardprojections -i muCT.mha -o josephProjections.mha -g geometry.xml --fp Joseph<br />
rtkforwardprojections -i muCT.mha -o rayCastInterpolatorProjections.mha -g geometry.xml --fp RayCastInterpolator<br />
<br />
And for back projection<br />
<br />
rtkbackprojections -p . -r projections.mha -o voxelBasedBackProjection.mha -g geometry.xml --bp VoxelBasedBackProjection<br />
rtkbackprojections -p . -r projections.mha -o josephBackProjection.mha -g geometry.xml --bp Joseph<br />
rtkbackprojections -p . -r projections.mha -o normalizedJosephBackProjection.mha -g geometry.xml --bp NormalizedJoseph<br />
<br />
If you have a CUDA-capable graphics card, and have compiled RTK with RTK_USE_CUDA=ON, you can also try the following<br />
<br />
rtkforwardprojections -i muCT.mha -o cudaRayCastProjections.mha -g geometry.xml --fp CudaRayCast<br />
rtkbackprojections -p . -r projections.mha -o cudaRayCastBackProjection.mha -g geometry.xml --bp CudaRayCast<br />
rtkbackprojections -p . -r projections.mha -o cudaBackProjection.mha -g geometry.xml --bp CudaBackProjection<br />
<br />
== Creating a very small dataset ==<br />
<br />
Various reconstruction algorithms exist, which employ forward and back projection extensively. We will now start performing real reconstructions using some of the algorithms implemented in RTK. Since these algorithms are computationally much more demanding than the standard FDK, we propose to run them with low resolution data. You will be able to re-compute them at full resolution later, since the present page will remain available to you after the training.<br />
<br />
Start by downloading the cone beam CT projection data [http://midas3.kitware.com/midas/download/item/208648/projections.tgz here], and extract it. It contains 644 projections, each one in a ".his" file. You can view them in vv by typing<br />
<br />
vv --sequence *.his<br />
<br />
RTK has a collection of tools to convert and preprocess commercial CBCT projection data, most of which are combined in the application "rtkprojections". To convert and preprocess these projections, run<br />
<br />
rtkprojections -p . -r .*.his -o downsampledProjections.mha --binning "4, 4"<br />
<br />
The '--binning "4, 4"' option downsamples the projections by 4 along both axes. Since this is not enough to reach acceptable reconstruction times for the training, we will build a sub-dataset by selecting only one projection out of 5. You can do this by running <br />
<br />
rtksubselect -p . -r downsampledProjections.mha -g geometry.xml --out_geometry subGeometry.xml --out_proj subProjections.mha -s 5<br />
<br />
This creates a new geometry file and a new projections file, from which even a laptop should be able to perform iterative reconstruction in reasonable time. <br />
<br />
== Unregularized 3D iterative reconstruction algorithms ==<br />
<br />
The most popular iterative reconstruction algorithm is the Simultaneous Algebraic Reconstruction Technique (SART). Try it by running<br />
<br />
rtksart -p . -r subProjections.mha -g subGeometry.xml -o SART.mha --dimension 128 --spacing 3<br />
<br />
Another popular technique uses the conjugate gradient algorithm<br />
<br />
rtkconjugategradient -p . -r subProjections.mha -g subGeometry.xml -o CG.mha --dimension 128 --spacing 3 -n 10<br />
<br />
You can compare the results by running<br />
<br />
vv SART.mha CG.mha --linkall<br />
<br />
The SART reconstruction should be sharper than the conjugate gradient one. If you are interested in understanding the reasons for this difference, try running <br />
<source lang="bash" enclose="div"><br />
rtksart -p . -r subProjections.mha -g subGeometry.xml -o SART.mha --dimension 128 --spacing 3 --nprojspersubset 10<br />
</source><br />
The differences in image quality (sharpness, contrast, ...) and convergence speed, stability, ... between the various algorithms may be discussed briefly during the training.<br />
<br />
== Regularized 3D iterative reconstruction algorithms ==<br />
<source lang="bash" enclose="div"><br />
rtkadmmtotalvariation -p . -r subProjections.mha -g subGeometry.xml -o admmTV.mha --dimension 128 --spacing 3 -n 10 --beta 1000 --alpha 1<br />
</source></div>Cyril.moryhttps://wiki.openrtk.org/index.php?title=RTK/Meetings/TrainingNov15&diff=412RTK/Meetings/TrainingNov152015-10-26T13:46:25Z<p>Cyril.mory: /* Iterative reconstruction algorithms */</p>
<hr />
<div>Here is a list of the RTK command lines you will have to run during the training, along with the data you will need.<br />
To start, download the following [http://midas3.kitware.com/midas/download/item/318788/muCT.mha CT data] and a relevant Cone-Beam CT [http://midas3.kitware.com/midas/download/item/318790/geometry.xml geometry file].<br />
<br />
== Forward projection ==<br />
<br />
To forward project the CT volume, following the geometry described in geometry.xml, run<br />
<br />
rtkforwardprojections -i muCT.mha -o projections.mha -g geometry.xml<br />
<br />
Look at the result using vv<br />
<br />
vv projections.mha<br />
<br />
There are as many projections as described in the geometry.xml file. You can edit the geometry.xml file, remove all projections except one, and try again. Such a modified geometry file is available [http://midas3.kitware.com/midas/download/item/318789/singleProjectionGeometry.xml here]. Run the following command line<br />
<br />
rtkforwardprojections -i muCT.mha -o singleProjection.mha -g singleProjectionGeometry.xml<br />
<br />
You can check with vv that the file contains only one projection<br />
<br />
vv singleProjection.mha<br />
<br />
== Back projection ==<br />
<br />
Start by back projecting a single projection. Run<br />
<br />
rtkbackprojections -p . -r singleProjection.mha -o singleBackProjection.mha -g singleProjectionGeometry.xml<br />
<br />
Observe the result with vv<br />
<br />
vv singleBackProjection.mha<br />
<br />
As you can see, the projection data seems to be smeared into the volume. Now back project all projections, by running<br />
<br />
rtkbackprojections -p . -r projections.mha -o backProjection.mha -g geometry.xml<br />
<br />
Look at the result with vv. In order to compare it with the original image, run <br />
<br />
vv backProjection.mha muCT.mha --linkall<br />
<br />
Click in one of the display windows, hit 'Ctrl + G' to center the view on the tumor. Hit 'w' to automatically compute reasonable window and level values. You can navigate between "muCT.mha" and "backProjection.mha" by hitting the 'Tab' key.<br />
<br />
== Using different forward and back projection algorithms ==<br />
<br />
Both rtkforwardprojections and rtkbackprojections can use several algorithms to perform the forward or back projections. For forward projections, you can try the following command lines<br />
<br />
rtkforwardprojections -i muCT.mha -o josephProjections.mha -g geometry.xml --fp Joseph<br />
rtkforwardprojections -i muCT.mha -o rayCastInterpolatorProjections.mha -g geometry.xml --fp RayCastInterpolator<br />
<br />
And for back projection<br />
<br />
rtkbackprojections -p . -r projections.mha -o voxelBasedBackProjection.mha -g geometry.xml --bp VoxelBasedBackProjection<br />
rtkbackprojections -p . -r projections.mha -o josephBackProjection.mha -g geometry.xml --bp Joseph<br />
rtkbackprojections -p . -r projections.mha -o normalizedJosephBackProjection.mha -g geometry.xml --bp NormalizedJoseph<br />
<br />
If you have a CUDA-capable graphics card, and have compiled RTK with RTK_USE_CUDA=ON, you can also try the following<br />
<br />
rtkforwardprojections -i muCT.mha -o cudaRayCastProjections.mha -g geometry.xml --fp CudaRayCast<br />
rtkbackprojections -p . -r projections.mha -o cudaRayCastBackProjection.mha -g geometry.xml --bp CudaRayCast<br />
rtkbackprojections -p . -r projections.mha -o cudaBackProjection.mha -g geometry.xml --bp CudaBackProjection<br />
<br />
== Iterative reconstruction algorithms ==<br />
<br />
Various reconstruction algorithms exist, which employ forward and back projection extensively. We will now start performing real reconstructions using some of the algorithms implemented in RTK. Since these algorithms are computationally much more demanding than the standard FDK, we propose to run them with low resolution data. You will be able to re-compute them at full resolution later, since the present page will remain available to you after the training.<br />
<br />
Start by downloading the cone beam CT projection data [http://midas3.kitware.com/midas/download/item/208648/projections.tgz here], and extract it. It contains 644 projections, each one in a ".his" file. You can view them in vv by typing<br />
<br />
vv --sequence *.his<br />
<br />
RTK has a collection of tools to convert and preprocess commercial CBCT projection data, most of which are combined in the application "rtkprojections". To convert and preprocess these projections, run<br />
<br />
rtkprojections -p . -r .*.his -o downsampledProjections.mha --binning "4, 4"<br />
<br />
The '--binning "4, 4"' option downsamples the projections by 4 along both axes. Since this is not enough to reach acceptable reconstruction times for the training, we will build a sub-dataset by selecting only one projection out of 5. You can do this by running <br />
<br />
rtksubselect -p . -r downsampledProjections.mha -g geometry.xml --out_geometry subGeometry.xml --out_proj subProjections.mha -s 5<br />
<br />
This creates a new geometry file and a new projections file, from which even a laptop should be able to perform iterative reconstruction in reasonable time. <br />
<br />
The most popular iterative reconstruction algorithm is the Simultaneous Algebraic Reconstruction Technique (SART). Try it by running<br />
<br />
rtksart -p . -r subProjections.mha -g subGeometry.xml -o SART.mha --dimension 128 --spacing 3<br />
<br />
Another popular technique uses the conjugate gradient algorithm<br />
<br />
rtkconjugategradient -p . -r subProjections.mha -g subGeometry.xml -o CG.mha --dimension 128 --spacing 3 -n 10<br />
<br />
You can compare the results by running<br />
<br />
vv SART.mha CG.mha --linkall<br />
<br />
The SART reconstruction should be sharper than the conjugate gradient one. If you are interested in understanding the reasons for this difference, try running <br />
<br />
rtksart -p . -r subProjections.mha -g subGeometry.xml -o SART.mha --dimension 128 --spacing 3 --nprojspersubset 10<br />
<br />
The differences in image quality (sharpness, contrast, ...) and convergence speed, stability, ... between the various algorithms may be discussed briefly during the training.<br />
<br />
<tt>Code source</tt></div>Cyril.moryhttps://wiki.openrtk.org/index.php?title=RTK/Meetings/TrainingNov15&diff=410RTK/Meetings/TrainingNov152015-10-26T13:43:21Z<p>Cyril.mory: /* Iterative reconstruction algorithms */</p>
<hr />
<div>Here is a list of the RTK command lines you will have to run during the training, along with the data you will need.<br />
To start, download the following [http://midas3.kitware.com/midas/download/item/318788/muCT.mha CT data] and a relevant Cone-Beam CT [http://midas3.kitware.com/midas/download/item/318790/geometry.xml geometry file].<br />
<br />
== Forward projection ==<br />
<br />
To forward project the CT volume, following the geometry described in geometry.xml, run<br />
<br />
rtkforwardprojections -i muCT.mha -o projections.mha -g geometry.xml<br />
<br />
Look at the result using vv<br />
<br />
vv projections.mha<br />
<br />
There are as many projections as described in the geometry.xml file. You can edit the geometry.xml file, remove all projections except one, and try again. Such a modified geometry file is available [http://midas3.kitware.com/midas/download/item/318789/singleProjectionGeometry.xml here]. Run the following command line<br />
<br />
rtkforwardprojections -i muCT.mha -o singleProjection.mha -g singleProjectionGeometry.xml<br />
<br />
You can check with vv that the file contains only one projection<br />
<br />
vv singleProjection.mha<br />
<br />
== Back projection ==<br />
<br />
Start by back projecting a single projection. Run<br />
<br />
rtkbackprojections -p . -r singleProjection.mha -o singleBackProjection.mha -g singleProjectionGeometry.xml<br />
<br />
Observe the result with vv<br />
<br />
vv singleBackProjection.mha<br />
<br />
As you can see, the projection data seems to be smeared into the volume. Now back project all projections, by running<br />
<br />
rtkbackprojections -p . -r projections.mha -o backProjection.mha -g geometry.xml<br />
<br />
Look at the result with vv. In order to compare it with the original image, run <br />
<br />
vv backProjection.mha muCT.mha --linkall<br />
<br />
Click in one of the display windows, hit 'Ctrl + G' to center the view on the tumor. Hit 'w' to automatically compute reasonable window and level values. You can navigate between "muCT.mha" and "backProjection.mha" by hitting the 'Tab' key.<br />
<br />
== Using different forward and back projection algorithms ==<br />
<br />
Both rtkforwardprojections and rtkbackprojections can use several algorithms to perform the forward or back projections. For forward projections, you can try the following command lines<br />
<br />
rtkforwardprojections -i muCT.mha -o josephProjections.mha -g geometry.xml --fp Joseph<br />
rtkforwardprojections -i muCT.mha -o rayCastInterpolatorProjections.mha -g geometry.xml --fp RayCastInterpolator<br />
<br />
And for back projection<br />
<br />
rtkbackprojections -p . -r projections.mha -o voxelBasedBackProjection.mha -g geometry.xml --bp VoxelBasedBackProjection<br />
rtkbackprojections -p . -r projections.mha -o josephBackProjection.mha -g geometry.xml --bp Joseph<br />
rtkbackprojections -p . -r projections.mha -o normalizedJosephBackProjection.mha -g geometry.xml --bp NormalizedJoseph<br />
<br />
If you have a CUDA-capable graphics card, and have compiled RTK with RTK_USE_CUDA=ON, you can also try the following<br />
<br />
rtkforwardprojections -i muCT.mha -o cudaRayCastProjections.mha -g geometry.xml --fp CudaRayCast<br />
rtkbackprojections -p . -r projections.mha -o cudaRayCastBackProjection.mha -g geometry.xml --bp CudaRayCast<br />
rtkbackprojections -p . -r projections.mha -o cudaBackProjection.mha -g geometry.xml --bp CudaBackProjection<br />
<br />
== Iterative reconstruction algorithms ==<br />
<br />
Various reconstruction algorithms exist, which employ forward and back projection extensively. We will now start performing real reconstructions using some of the algorithms implemented in RTK. Since these algorithms are computationally much more demanding than the standard FDK, we propose to run them with low resolution data. You will be able to re-compute them at full resolution later, since the present page will remain available to you after the training.<br />
<br />
Start by downloading the cone beam CT projection data [http://midas3.kitware.com/midas/download/item/208648/projections.tgz here], and extract it. It contains 644 projections, each one in a ".his" file. You can view them in vv by typing<br />
<br />
vv --sequence *.his<br />
<br />
RTK has a collection of tools to convert and preprocess commercial CBCT projection data, most of which are combined in the application "rtkprojections". To convert and preprocess these projections, run<br />
<br />
rtkprojections -p . -r .*.his -o downsampledProjections.mha --binning "4, 4"<br />
<br />
The '--binning "4, 4"' option downsamples the projections by 4 along both axes. Since this is not enough to reach acceptable reconstruction times for the training, we will build a sub-dataset by selecting only one projection out of 5. You can do this by running <br />
<br />
rtksubselect -p . -r downsampledProjections.mha -g geometry.xml --out_geometry subGeometry.xml --out_proj subProjections.mha -s 5<br />
<br />
This creates a new geometry file and a new projections file, from which even a laptop should be able to perform iterative reconstruction in reasonable time. <br />
<br />
The most popular iterative reconstruction algorithm is the Simultaneous Algebraic Reconstruction Technique (SART). Try it by running<br />
<br />
rtksart -p . -r subProjections.mha -g subGeometry.xml -o SART.mha --dimension 128 --spacing 3<br />
<br />
Another popular technique uses the conjugate gradient algorithm<br />
<br />
rtkconjugategradient -p . -r subProjections.mha -g subGeometry.xml -o CG.mha --dimension 128 --spacing 3 -n 10<br />
<br />
You can compare the results by running<br />
<br />
vv SART.mha CG.mha --linkall<br />
<br />
The SART reconstruction should be sharper than the conjugate gradient one. If you are interested in understanding the reasons for this difference, try running <br />
<br />
rtksart -p . -r subProjections.mha -g subGeometry.xml -o SART.mha --dimension 128 --spacing 3 --nprojspersubset 10<br />
<br />
The differences in image quality (sharpness, contrast, ...) and convergence speed, stability, ... between the various algorithms may be discussed briefly during the training.<br />
<br />
<code>Code source</code></div>Cyril.moryhttps://wiki.openrtk.org/index.php?title=RTK/Meetings/TrainingNov15&diff=409RTK/Meetings/TrainingNov152015-10-26T13:38:47Z<p>Cyril.mory: /* Iterative reconstruction algorithms */</p>
<hr />
<div>Here is a list of the RTK command lines you will have to run during the training, along with the data you will need.<br />
To start, download the following [http://midas3.kitware.com/midas/download/item/318788/muCT.mha CT data] and a relevant Cone-Beam CT [http://midas3.kitware.com/midas/download/item/318790/geometry.xml geometry file].<br />
<br />
== Forward projection ==<br />
<br />
To forward project the CT volume, following the geometry described in geometry.xml, run<br />
<br />
rtkforwardprojections -i muCT.mha -o projections.mha -g geometry.xml<br />
<br />
Look at the result using vv<br />
<br />
vv projections.mha<br />
<br />
There are as many projections as described in the geometry.xml file. You can edit the geometry.xml file, remove all projections except one, and try again. Such a modified geometry file is available [http://midas3.kitware.com/midas/download/item/318789/singleProjectionGeometry.xml here]. Run the following command line<br />
<br />
rtkforwardprojections -i muCT.mha -o singleProjection.mha -g singleProjectionGeometry.xml<br />
<br />
You can check with vv that the file contains only one projection<br />
<br />
vv singleProjection.mha<br />
<br />
== Back projection ==<br />
<br />
Start by back projecting a single projection. Run<br />
<br />
rtkbackprojections -p . -r singleProjection.mha -o singleBackProjection.mha -g singleProjectionGeometry.xml<br />
<br />
Observe the result with vv<br />
<br />
vv singleBackProjection.mha<br />
<br />
As you can see, the projection data seems to be smeared into the volume. Now back project all projections, by running<br />
<br />
rtkbackprojections -p . -r projections.mha -o backProjection.mha -g geometry.xml<br />
<br />
Look at the result with vv. In order to compare it with the original image, run <br />
<br />
vv backProjection.mha muCT.mha --linkall<br />
<br />
Click in one of the display windows, hit 'Ctrl + G' to center the view on the tumor. Hit 'w' to automatically compute reasonable window and level values. You can navigate between "muCT.mha" and "backProjection.mha" by hitting the 'Tab' key.<br />
<br />
== Using different forward and back projection algorithms ==<br />
<br />
Both rtkforwardprojections and rtkbackprojections can use several algorithms to perform the forward or back projections. For forward projections, you can try the following command lines<br />
<br />
rtkforwardprojections -i muCT.mha -o josephProjections.mha -g geometry.xml --fp Joseph<br />
rtkforwardprojections -i muCT.mha -o rayCastInterpolatorProjections.mha -g geometry.xml --fp RayCastInterpolator<br />
<br />
And for back projection<br />
<br />
rtkbackprojections -p . -r projections.mha -o voxelBasedBackProjection.mha -g geometry.xml --bp VoxelBasedBackProjection<br />
rtkbackprojections -p . -r projections.mha -o josephBackProjection.mha -g geometry.xml --bp Joseph<br />
rtkbackprojections -p . -r projections.mha -o normalizedJosephBackProjection.mha -g geometry.xml --bp NormalizedJoseph<br />
<br />
If you have a CUDA-capable graphics card, and have compiled RTK with RTK_USE_CUDA=ON, you can also try the following<br />
<br />
rtkforwardprojections -i muCT.mha -o cudaRayCastProjections.mha -g geometry.xml --fp CudaRayCast<br />
rtkbackprojections -p . -r projections.mha -o cudaRayCastBackProjection.mha -g geometry.xml --bp CudaRayCast<br />
rtkbackprojections -p . -r projections.mha -o cudaBackProjection.mha -g geometry.xml --bp CudaBackProjection<br />
<br />
== Iterative reconstruction algorithms ==<br />
<br />
Various reconstruction algorithms exist, which employ forward and back projection extensively. We will now start performing real reconstructions using some of the algorithms implemented in RTK. Since these algorithms are computationally much more demanding than the standard FDK, we propose to run them with low resolution data. You will be able to re-compute them at full resolution later, since the present page will remain available to you after the training.<br />
<br />
Start by downloading the cone beam CT projection data [http://midas3.kitware.com/midas/download/item/208648/projections.tgz here], and extract it. It contains 644 projections, each one in a ".his" file. You can view them in vv by typing<br />
<br />
vv --sequence *.his<br />
<br />
RTK has a collection of tools to convert and preprocess commercial CBCT projection data, most of which are combined in the application "rtkprojections". To convert and preprocess these projections, run<br />
<br />
rtkprojections -p . -r .*.his -o downsampledProjections.mha --binning "4, 4"<br />
<br />
The '--binning "4, 4"' option downsamples the projections by 4 along both axes. Since this is not enough to reach acceptable reconstruction times for the training, we will build a sub-dataset by selecting only one projection out of 5. You can do this by running <br />
<br />
rtksubselect -p . -r downsampledProjections.mha -g geometry.xml --out_geometry subGeometry.xml --out_proj subProjections.mha -s 5<br />
<br />
This creates a new geometry file and a new projections file, from which even a laptop should be able to perform iterative reconstruction in reasonable time. <br />
<br />
The most popular iterative reconstruction algorithm is the Simultaneous Algebraic Reconstruction Technique (SART). Try it by running<br />
<br />
rtksart -p . -r subProjections.mha -g subGeometry.xml -o SART.mha --dimension 128 --spacing 3<br />
<br />
Another popular technique uses the conjugate gradient algorithm<br />
<br />
rtkconjugategradient -p . -r subProjections.mha -g subGeometry.xml -o CG.mha --dimension 128 --spacing 3 -n 10<br />
<br />
You can compare the results by running<br />
<br />
vv SART.mha CG.mha --linkall<br />
<br />
The SART reconstruction should be sharper than the conjugate gradient one. If you are interested in understanding the reasons for this difference, try running <br />
<br />
rtksart -p . -r subProjections.mha -g subGeometry.xml -o SART.mha --dimension 128 --spacing 3 --nprojspersubset 10</div>Cyril.moryhttps://wiki.openrtk.org/index.php?title=RTK/Meetings/TrainingNov15&diff=408RTK/Meetings/TrainingNov152015-10-26T13:38:33Z<p>Cyril.mory: /* Iterative reconstruction algorithms */</p>
<hr />
<div>Here is a list of the RTK command lines you will have to run during the training, along with the data you will need.<br />
To start, download the following [http://midas3.kitware.com/midas/download/item/318788/muCT.mha CT data] and a relevant Cone-Beam CT [http://midas3.kitware.com/midas/download/item/318790/geometry.xml geometry file].<br />
<br />
== Forward projection ==<br />
<br />
To forward project the CT volume, following the geometry described in geometry.xml, run<br />
<br />
rtkforwardprojections -i muCT.mha -o projections.mha -g geometry.xml<br />
<br />
Look at the result using vv<br />
<br />
vv projections.mha<br />
<br />
There are as many projections as described in the geometry.xml file. You can edit the geometry.xml file, remove all projections except one, and try again. Such a modified geometry file is available [http://midas3.kitware.com/midas/download/item/318789/singleProjectionGeometry.xml here]. Run the following command line<br />
<br />
rtkforwardprojections -i muCT.mha -o singleProjection.mha -g singleProjectionGeometry.xml<br />
<br />
You can check with vv that the file contains only one projection<br />
<br />
vv singleProjection.mha<br />
<br />
== Back projection ==<br />
<br />
Start by back projecting a single projection. Run<br />
<br />
rtkbackprojections -p . -r singleProjection.mha -o singleBackProjection.mha -g singleProjectionGeometry.xml<br />
<br />
Observe the result with vv<br />
<br />
vv singleBackProjection.mha<br />
<br />
As you can see, the projection data seems to be smeared into the volume. Now back project all projections, by running<br />
<br />
rtkbackprojections -p . -r projections.mha -o backProjection.mha -g geometry.xml<br />
<br />
Look at the result with vv. In order to compare it with the original image, run <br />
<br />
vv backProjection.mha muCT.mha --linkall<br />
<br />
Click in one of the display windows, hit 'Ctrl + G' to center the view on the tumor. Hit 'w' to automatically compute reasonable window and level values. You can navigate between "muCT.mha" and "backProjection.mha" by hitting the 'Tab' key.<br />
<br />
== Using different forward and back projection algorithms ==<br />
<br />
Both rtkforwardprojections and rtkbackprojections can use several algorithms to perform the forward or back projections. For forward projections, you can try the following command lines<br />
<br />
rtkforwardprojections -i muCT.mha -o josephProjections.mha -g geometry.xml --fp Joseph<br />
rtkforwardprojections -i muCT.mha -o rayCastInterpolatorProjections.mha -g geometry.xml --fp RayCastInterpolator<br />
<br />
And for back projection<br />
<br />
rtkbackprojections -p . -r projections.mha -o voxelBasedBackProjection.mha -g geometry.xml --bp VoxelBasedBackProjection<br />
rtkbackprojections -p . -r projections.mha -o josephBackProjection.mha -g geometry.xml --bp Joseph<br />
rtkbackprojections -p . -r projections.mha -o normalizedJosephBackProjection.mha -g geometry.xml --bp NormalizedJoseph<br />
<br />
If you have a CUDA-capable graphics card, and have compiled RTK with RTK_USE_CUDA=ON, you can also try the following<br />
<br />
rtkforwardprojections -i muCT.mha -o cudaRayCastProjections.mha -g geometry.xml --fp CudaRayCast<br />
rtkbackprojections -p . -r projections.mha -o cudaRayCastBackProjection.mha -g geometry.xml --bp CudaRayCast<br />
rtkbackprojections -p . -r projections.mha -o cudaBackProjection.mha -g geometry.xml --bp CudaBackProjection<br />
<br />
== Iterative reconstruction algorithms ==<br />
<br />
Various reconstruction algorithms exist, which employ forward and back projection extensively. We will now start performing real reconstructions using some of the algorithms implemented in RTK. Since these algorithms are computationally much more demanding than the standard FDK, we propose to run them with low resolution data. You will be able to re-compute them at full resolution later, since the present page will remain available to you after the training.<br />
<br />
Start by downloading the cone beam CT projection data [http://midas3.kitware.com/midas/download/item/208648/projections.tgz here], and extract it. It contains 644 projections, each one in a ".his" file. You can view them in vv by typing<br />
<br />
vv --sequence *.his<br />
<br />
RTK has a collection of tools to convert and preprocess commercial CBCT projection data, most of which are combined in the application "rtkprojections". To convert and preprocess these projections, run<br />
<br />
rtkprojections -p . -r .*.his -o downsampledProjections.mha --binning "4, 4"<br />
<br />
The '--binning "4, 4"' option downsamples the projections by 4 along both axes. Since this is not enough to reach acceptable reconstruction times for the training, we will build a sub-dataset by selecting only one projection out of 5. You can do this by running <br />
<br />
rtksubselect -p . -r downsampledProjections.mha -g geometry.xml --out_geometry subGeometry.xml --out_proj subProjections.mha -s 5<br />
<br />
This creates a new geometry file and a new projections file, from which even a laptop should be able to perform iterative reconstruction in reasonable time. <br />
<br />
The most popular iterative reconstruction algorithm is the Simultaneous Algebraic Reconstruction Technique (SART). Try it by running<br />
<br />
rtksart -p . -r subProjections.mha -g subGeometry.xml -o SART.mha --dimension 128 --spacing 3<br />
<br />
Another popular technique uses the conjugate gradient algorithm<br />
<br />
rtkconjugategradient -p . -r subProjections.mha -g subGeometry.xml -o CG.mha --dimension 128 --spacing 3 -n 10<br />
<br />
You can compare the results by running<br />
<br />
vv SART.mha CG.mha --linkall<br />
<br />
The SART reconstruction should be sharper than the conjugate gradient one. If you are interested in understanding the reasons for this difference, try running <br />
<br />
"rtksart -p . -r subProjections.mha -g subGeometry.xml -o SART.mha --dimension 128 --spacing 3 --nprojspersubset 10"</div>Cyril.moryhttps://wiki.openrtk.org/index.php?title=RTK/Meetings/TrainingNov15&diff=407RTK/Meetings/TrainingNov152015-10-26T13:37:16Z<p>Cyril.mory: /* Iterative reconstruction algorithms */</p>
<hr />
<div>Here is a list of the RTK command lines you will have to run during the training, along with the data you will need.<br />
To start, download the following [http://midas3.kitware.com/midas/download/item/318788/muCT.mha CT data] and a relevant Cone-Beam CT [http://midas3.kitware.com/midas/download/item/318790/geometry.xml geometry file].<br />
<br />
== Forward projection ==<br />
<br />
To forward project the CT volume, following the geometry described in geometry.xml, run<br />
<br />
rtkforwardprojections -i muCT.mha -o projections.mha -g geometry.xml<br />
<br />
Look at the result using vv<br />
<br />
vv projections.mha<br />
<br />
There are as many projections as described in the geometry.xml file. You can edit the geometry.xml file, remove all projections except one, and try again. Such a modified geometry file is available [http://midas3.kitware.com/midas/download/item/318789/singleProjectionGeometry.xml here]. Run the following command line<br />
<br />
rtkforwardprojections -i muCT.mha -o singleProjection.mha -g singleProjectionGeometry.xml<br />
<br />
You can check with vv that the file contains only one projection<br />
<br />
vv singleProjection.mha<br />
<br />
== Back projection ==<br />
<br />
Start by back projecting a single projection. Run<br />
<br />
rtkbackprojections -p . -r singleProjection.mha -o singleBackProjection.mha -g singleProjectionGeometry.xml<br />
<br />
Observe the result with vv<br />
<br />
vv singleBackProjection.mha<br />
<br />
As you can see, the projection data seems to be smeared into the volume. Now back project all projections, by running<br />
<br />
rtkbackprojections -p . -r projections.mha -o backProjection.mha -g geometry.xml<br />
<br />
Look at the result with vv. In order to compare it with the original image, run <br />
<br />
vv backProjection.mha muCT.mha --linkall<br />
<br />
Click in one of the display windows, hit 'Ctrl + G' to center the view on the tumor. Hit 'w' to automatically compute reasonable window and level values. You can navigate between "muCT.mha" and "backProjection.mha" by hitting the 'Tab' key.<br />
<br />
== Using different forward and back projection algorithms ==<br />
<br />
Both rtkforwardprojections and rtkbackprojections can use several algorithms to perform the forward or back projections. For forward projections, you can try the following command lines<br />
<br />
rtkforwardprojections -i muCT.mha -o josephProjections.mha -g geometry.xml --fp Joseph<br />
rtkforwardprojections -i muCT.mha -o rayCastInterpolatorProjections.mha -g geometry.xml --fp RayCastInterpolator<br />
<br />
And for back projection<br />
<br />
rtkbackprojections -p . -r projections.mha -o voxelBasedBackProjection.mha -g geometry.xml --bp VoxelBasedBackProjection<br />
rtkbackprojections -p . -r projections.mha -o josephBackProjection.mha -g geometry.xml --bp Joseph<br />
rtkbackprojections -p . -r projections.mha -o normalizedJosephBackProjection.mha -g geometry.xml --bp NormalizedJoseph<br />
<br />
If you have a CUDA-capable graphics card, and have compiled RTK with RTK_USE_CUDA=ON, you can also try the following<br />
<br />
rtkforwardprojections -i muCT.mha -o cudaRayCastProjections.mha -g geometry.xml --fp CudaRayCast<br />
rtkbackprojections -p . -r projections.mha -o cudaRayCastBackProjection.mha -g geometry.xml --bp CudaRayCast<br />
rtkbackprojections -p . -r projections.mha -o cudaBackProjection.mha -g geometry.xml --bp CudaBackProjection<br />
<br />
== Iterative reconstruction algorithms ==<br />
<br />
Various reconstruction algorithms exist, which employ forward and back projection extensively. We will now start performing real reconstructions using some of the algorithms implemented in RTK. Since these algorithms are computationally much more demanding than the standard FDK, we propose to run them with low resolution data. You will be able to re-compute them at full resolution later, since the present page will remain available to you after the training.<br />
<br />
Start by downloading the cone beam CT projection data [http://midas3.kitware.com/midas/download/item/208648/projections.tgz here], and extract it. It contains 644 projections, each one in a ".his" file. You can view them in vv by typing<br />
<br />
vv --sequence *.his<br />
<br />
RTK has a collection of tools to convert and preprocess commercial CBCT projection data, most of which are combined in the application "rtkprojections". To convert and preprocess these projections, run<br />
<br />
rtkprojections -p . -r .*.his -o downsampledProjections.mha --binning "4, 4"<br />
<br />
The '--binning "4, 4"' option downsamples the projections by 4 along both axes. Since this is not enough to reach acceptable reconstruction times for the training, we will build a sub-dataset by selecting only one projection out of 5. You can do this by running <br />
<br />
rtksubselect -p . -r downsampledProjections.mha -g geometry.xml --out_geometry subGeometry.xml --out_proj subProjections.mha -s 5<br />
<br />
This creates a new geometry file and a new projections file, from which even a laptop should be able to perform iterative reconstruction in reasonable time. <br />
<br />
The most popular iterative reconstruction algorithm is the Simultaneous Algebraic Reconstruction Technique (SART). Try it by running<br />
<br />
rtksart -p . -r subProjections.mha -g subGeometry.xml -o SART.mha --dimension 128 --spacing 3<br />
<br />
Another popular technique uses the conjugate gradient algorithm<br />
<br />
rtkconjugategradient -p . -r subProjections.mha -g subGeometry.xml -o CG.mha --dimension 128 --spacing 3 -n 10<br />
<br />
You can compare the results by running<br />
<br />
vv SART.mha CG.mha --linkall<br />
<br />
The SART reconstruction should be sharper than the conjugate gradient one. If you are interested in understanding the reasons for this difference, try running <br />
<br />
'rtksart -p . -r subProjections.mha -g subGeometry.xml -o SART.mha --dimension 128 --spacing 3 --nprojspersubset 10'</div>Cyril.moryhttps://wiki.openrtk.org/index.php?title=RTK/Meetings/TrainingNov15&diff=406RTK/Meetings/TrainingNov152015-10-26T13:00:15Z<p>Cyril.mory: /* Iterative reconstruction algorithms */</p>
<hr />
<div>Here is a list of the RTK command lines you will have to run during the training, along with the data you will need.<br />
To start, download the following [http://midas3.kitware.com/midas/download/item/318788/muCT.mha CT data] and a relevant Cone-Beam CT [http://midas3.kitware.com/midas/download/item/318790/geometry.xml geometry file].<br />
<br />
== Forward projection ==<br />
<br />
To forward project the CT volume, following the geometry described in geometry.xml, run<br />
<br />
rtkforwardprojections -i muCT.mha -o projections.mha -g geometry.xml<br />
<br />
Look at the result using vv<br />
<br />
vv projections.mha<br />
<br />
There are as many projections as described in the geometry.xml file. You can edit the geometry.xml file, remove all projections except one, and try again. Such a modified geometry file is available [http://midas3.kitware.com/midas/download/item/318789/singleProjectionGeometry.xml here]. Run the following command line<br />
<br />
rtkforwardprojections -i muCT.mha -o singleProjection.mha -g singleProjectionGeometry.xml<br />
<br />
You can check with vv that the file contains only one projection<br />
<br />
vv singleProjection.mha<br />
<br />
== Back projection ==<br />
<br />
Start by back projecting a single projection. Run<br />
<br />
rtkbackprojections -p . -r singleProjection.mha -o singleBackProjection.mha -g singleProjectionGeometry.xml<br />
<br />
Observe the result with vv<br />
<br />
vv singleBackProjection.mha<br />
<br />
As you can see, the projection data seems to be smeared into the volume. Now back project all projections, by running<br />
<br />
rtkbackprojections -p . -r projections.mha -o backProjection.mha -g geometry.xml<br />
<br />
Look at the result with vv. In order to compare it with the original image, run <br />
<br />
vv backProjection.mha muCT.mha --linkall<br />
<br />
Click in one of the display windows, hit 'Ctrl + G' to center the view on the tumor. Hit 'w' to automatically compute reasonable window and level values. You can navigate between "muCT.mha" and "backProjection.mha" by hitting the 'Tab' key.<br />
<br />
== Using different forward and back projection algorithms ==<br />
<br />
Both rtkforwardprojections and rtkbackprojections can use several algorithms to perform the forward or back projections. For forward projections, you can try the following command lines<br />
<br />
rtkforwardprojections -i muCT.mha -o josephProjections.mha -g geometry.xml --fp Joseph<br />
rtkforwardprojections -i muCT.mha -o rayCastInterpolatorProjections.mha -g geometry.xml --fp RayCastInterpolator<br />
<br />
And for back projection<br />
<br />
rtkbackprojections -p . -r projections.mha -o voxelBasedBackProjection.mha -g geometry.xml --bp VoxelBasedBackProjection<br />
rtkbackprojections -p . -r projections.mha -o josephBackProjection.mha -g geometry.xml --bp Joseph<br />
rtkbackprojections -p . -r projections.mha -o normalizedJosephBackProjection.mha -g geometry.xml --bp NormalizedJoseph<br />
<br />
If you have a CUDA-capable graphics card, and have compiled RTK with RTK_USE_CUDA=ON, you can also try the following<br />
<br />
rtkforwardprojections -i muCT.mha -o cudaRayCastProjections.mha -g geometry.xml --fp CudaRayCast<br />
rtkbackprojections -p . -r projections.mha -o cudaRayCastBackProjection.mha -g geometry.xml --bp CudaRayCast<br />
rtkbackprojections -p . -r projections.mha -o cudaBackProjection.mha -g geometry.xml --bp CudaBackProjection<br />
<br />
== Iterative reconstruction algorithms ==<br />
<br />
Various reconstruction algorithms exist, which employ forward and back projection extensively. We will now start performing real reconstructions using some of the algorithms implemented in RTK. Since these algorithms are computationally much more demanding than the standard FDK, we propose to run them with low resolution data. You will be able to re-compute them at full resolution later, since the present page will remain available to you after the training.<br />
<br />
Start by downloading the cone beam CT projection data [http://midas3.kitware.com/midas/download/item/208648/projections.tgz here], and extract it. It contains 644 projections, each one in a ".his" file. You can view them in vv by typing<br />
<br />
vv --sequence *.his<br />
<br />
RTK has a collection of tools to convert and preprocess commercial CBCT projection data, most of which are combined in the application "rtkprojections". To convert and preprocess these projections, run<br />
<br />
rtkprojections -p . -r .*.his -o downsampledProjections.mha --binning "4, 4"<br />
<br />
The '--binning "4, 4"' option downsamples the projections by 4 along both axes. Since this is not enough to reach acceptable reconstruction times for the training, we will build a sub-dataset by selecting only one projection out of 5. You can do this by running <br />
<br />
rtksubselect -p . -r downsampledProjections.mha -g geometry.xml --out_geometry subGeometry.xml --out_proj subProjections.mha -s 5<br />
<br />
This creates a new geometry file and a new projections file, from which even a laptop should be able to perform iterative reconstruction in reasonable time. <br />
<br />
The most popular iterative reconstruction algorithm is the Simultaneous Algebraic Reconstruction Technique (SART). Try it by running<br />
<br />
rtksart -p . -r subProjections.mha -g subGeometry.xml -o SART.mha --dimension 128 --spacing 3<br />
<br />
Another popular technique uses the conjugate gradient algorithm<br />
<br />
rtkconjugategradient -p . -r subProjections.mha -g subGeometry.xml -o CG.mha --dimension 128 --spacing 3 -n 10<br />
<br />
You can compare the results by running<br />
<br />
vv SART.mha CG.mha --linkall<br />
<br />
The SART reconstruction should be sharper than the conjugate gradient one. If you are interested in understanding the reasons for this difference, try running <br />
<br />
rtksart -p . -r subProjections.mha -g subGeometry.xml -o SART.mha --dimension 128 --spacing 3 --nprojspersubset 10</div>Cyril.moryhttps://wiki.openrtk.org/index.php?title=RTK/Meetings/TrainingNov15&diff=405RTK/Meetings/TrainingNov152015-10-26T12:45:13Z<p>Cyril.mory: /* Iterative reconstruction algorithms */</p>
<hr />
<div>Here is a list of the RTK command lines you will have to run during the training, along with the data you will need.<br />
To start, download the following [http://midas3.kitware.com/midas/download/item/318788/muCT.mha CT data] and a relevant Cone-Beam CT [http://midas3.kitware.com/midas/download/item/318790/geometry.xml geometry file].<br />
<br />
== Forward projection ==<br />
<br />
To forward project the CT volume, following the geometry described in geometry.xml, run<br />
<br />
rtkforwardprojections -i muCT.mha -o projections.mha -g geometry.xml<br />
<br />
Look at the result using vv<br />
<br />
vv projections.mha<br />
<br />
There are as many projections as described in the geometry.xml file. You can edit the geometry.xml file, remove all projections except one, and try again. Such a modified geometry file is available [http://midas3.kitware.com/midas/download/item/318789/singleProjectionGeometry.xml here]. Run the following command line<br />
<br />
rtkforwardprojections -i muCT.mha -o singleProjection.mha -g singleProjectionGeometry.xml<br />
<br />
You can check with vv that the file contains only one projection<br />
<br />
vv singleProjection.mha<br />
<br />
== Back projection ==<br />
<br />
Start by back projecting a single projection. Run<br />
<br />
rtkbackprojections -p . -r singleProjection.mha -o singleBackProjection.mha -g singleProjectionGeometry.xml<br />
<br />
Observe the result with vv<br />
<br />
vv singleBackProjection.mha<br />
<br />
As you can see, the projection data seems to be smeared into the volume. Now back project all projections, by running<br />
<br />
rtkbackprojections -p . -r projections.mha -o backProjection.mha -g geometry.xml<br />
<br />
Look at the result with vv. In order to compare it with the original image, run <br />
<br />
vv backProjection.mha muCT.mha --linkall<br />
<br />
Click in one of the display windows, hit 'Ctrl + G' to center the view on the tumor. Hit 'w' to automatically compute reasonable window and level values. You can navigate between "muCT.mha" and "backProjection.mha" by hitting the 'Tab' key.<br />
<br />
== Using different forward and back projection algorithms ==<br />
<br />
Both rtkforwardprojections and rtkbackprojections can use several algorithms to perform the forward or back projections. For forward projections, you can try the following command lines<br />
<br />
rtkforwardprojections -i muCT.mha -o josephProjections.mha -g geometry.xml --fp Joseph<br />
rtkforwardprojections -i muCT.mha -o rayCastInterpolatorProjections.mha -g geometry.xml --fp RayCastInterpolator<br />
<br />
And for back projection<br />
<br />
rtkbackprojections -p . -r projections.mha -o voxelBasedBackProjection.mha -g geometry.xml --bp VoxelBasedBackProjection<br />
rtkbackprojections -p . -r projections.mha -o josephBackProjection.mha -g geometry.xml --bp Joseph<br />
rtkbackprojections -p . -r projections.mha -o normalizedJosephBackProjection.mha -g geometry.xml --bp NormalizedJoseph<br />
<br />
If you have a CUDA-capable graphics card, and have compiled RTK with RTK_USE_CUDA=ON, you can also try the following<br />
<br />
rtkforwardprojections -i muCT.mha -o cudaRayCastProjections.mha -g geometry.xml --fp CudaRayCast<br />
rtkbackprojections -p . -r projections.mha -o cudaRayCastBackProjection.mha -g geometry.xml --bp CudaRayCast<br />
rtkbackprojections -p . -r projections.mha -o cudaBackProjection.mha -g geometry.xml --bp CudaBackProjection<br />
<br />
== Iterative reconstruction algorithms ==<br />
<br />
Various reconstruction algorithms exist, which employ forward and back projection extensively. We will now start performing real reconstructions using some of the algorithms implemented in RTK. Since these algorithms are computationally much more demanding than the standard FDK, we propose to run them with low resolution data. You will be able to re-compute them at full resolution later, since the present page will remain available to you after the training.<br />
<br />
Start by downloading the cone beam CT projection data [http://midas3.kitware.com/midas/download/item/208648/projections.tgz here], and extract it. It contains 644 projections, each one in a ".his" file. You can view them in vv by typing<br />
<br />
vv --sequence *.his<br />
<br />
RTK has a collection of tools to convert and preprocess commercial CBCT projection data, most of which are combined in the application "rtkprojections". To convert and preprocess these projections, run<br />
<br />
rtkprojections -p . -r .*.his -o downsampledProjections.mha --binning "4, 4"<br />
<br />
The '--binning "4, 4"' option downsamples the projections by 4 along both axes. Since this is not enough to reach acceptable reconstruction times for the training, we will build a sub-dataset by selecting only one projection out of 5. You can do this by running <br />
<br />
rtksubselect -p . -r downsampledProjections.mha -g geometry.xml --out_geometry subGeometry.xml --out_proj subProjections.mha -s 5<br />
<br />
This creates a new geometry file and a new projections file, from which even a laptop should be able to perform iterative reconstruction in reasonable time. <br />
<br />
The most popular iterative reconstruction algorithm is the Simultaneous Algebraic Reconstruction Technique (SART). Try it by running<br />
<br />
rtksart -p . -r subProjections.mha -g subGeometry.xml -o SART.mha --dimension 128 --spacing 3</div>Cyril.moryhttps://wiki.openrtk.org/index.php?title=RTK/Meetings/TrainingNov15&diff=404RTK/Meetings/TrainingNov152015-10-26T11:18:58Z<p>Cyril.mory: /* Iterative reconstruction algorithms */</p>
<hr />
<div>Here is a list of the RTK command lines you will have to run during the training, along with the data you will need.<br />
To start, download the following [http://midas3.kitware.com/midas/download/item/318788/muCT.mha CT data] and a relevant Cone-Beam CT [http://midas3.kitware.com/midas/download/item/318790/geometry.xml geometry file].<br />
<br />
== Forward projection ==<br />
<br />
To forward project the CT volume, following the geometry described in geometry.xml, run<br />
<br />
rtkforwardprojections -i muCT.mha -o projections.mha -g geometry.xml<br />
<br />
Look at the result using vv<br />
<br />
vv projections.mha<br />
<br />
There are as many projections as described in the geometry.xml file. You can edit the geometry.xml file, remove all projections except one, and try again. Such a modified geometry file is available [http://midas3.kitware.com/midas/download/item/318789/singleProjectionGeometry.xml here]. Run the following command line<br />
<br />
rtkforwardprojections -i muCT.mha -o singleProjection.mha -g singleProjectionGeometry.xml<br />
<br />
You can check with vv that the file contains only one projection<br />
<br />
vv singleProjection.mha<br />
<br />
== Back projection ==<br />
<br />
Start by back projecting a single projection. Run<br />
<br />
rtkbackprojections -p . -r singleProjection.mha -o singleBackProjection.mha -g singleProjectionGeometry.xml<br />
<br />
Observe the result with vv<br />
<br />
vv singleBackProjection.mha<br />
<br />
As you can see, the projection data seems to be smeared into the volume. Now back project all projections, by running<br />
<br />
rtkbackprojections -p . -r projections.mha -o backProjection.mha -g geometry.xml<br />
<br />
Look at the result with vv. In order to compare it with the original image, run <br />
<br />
vv backProjection.mha muCT.mha --linkall<br />
<br />
Click in one of the display windows, hit 'Ctrl + G' to center the view on the tumor. Hit 'w' to automatically compute reasonable window and level values. You can navigate between "muCT.mha" and "backProjection.mha" by hitting the 'Tab' key.<br />
<br />
== Using different forward and back projection algorithms ==<br />
<br />
Both rtkforwardprojections and rtkbackprojections can use several algorithms to perform the forward or back projections. For forward projections, you can try the following command lines<br />
<br />
rtkforwardprojections -i muCT.mha -o josephProjections.mha -g geometry.xml --fp Joseph<br />
rtkforwardprojections -i muCT.mha -o rayCastInterpolatorProjections.mha -g geometry.xml --fp RayCastInterpolator<br />
<br />
And for back projection<br />
<br />
rtkbackprojections -p . -r projections.mha -o voxelBasedBackProjection.mha -g geometry.xml --bp VoxelBasedBackProjection<br />
rtkbackprojections -p . -r projections.mha -o josephBackProjection.mha -g geometry.xml --bp Joseph<br />
rtkbackprojections -p . -r projections.mha -o normalizedJosephBackProjection.mha -g geometry.xml --bp NormalizedJoseph<br />
<br />
If you have a CUDA-capable graphics card, and have compiled RTK with RTK_USE_CUDA=ON, you can also try the following<br />
<br />
rtkforwardprojections -i muCT.mha -o cudaRayCastProjections.mha -g geometry.xml --fp CudaRayCast<br />
rtkbackprojections -p . -r projections.mha -o cudaRayCastBackProjection.mha -g geometry.xml --bp CudaRayCast<br />
rtkbackprojections -p . -r projections.mha -o cudaBackProjection.mha -g geometry.xml --bp CudaBackProjection<br />
<br />
== Iterative reconstruction algorithms ==<br />
<br />
Various reconstruction algorithms exist, which employ forward and back projection extensively. We will now start performing real reconstructions using some of the algorithms implemented in RTK. Since these algorithms are computationally much more demanding than the standard FDK, we propose to run them with low resolution data. You will be able to re-compute them at full resolution later, since the present page will remain available to you after the training.<br />
<br />
Start by downloading the cone beam CT projection data [http://midas3.kitware.com/midas/download/item/208648/projections.tgz here], and extract it. It contains 644 projections, each one in a ".his" file. You can view them in vv by typing<br />
<br />
vv --sequence *.his<br />
<br />
RTK has a collection of tools to convert and preprocess commercial CBCT projection data, most of which are combined in the application "rtkprojections". To convert and preprocess these projections, run<br />
<br />
rtkprojections -p . -r .*.his -o projections.mha</div>Cyril.moryhttps://wiki.openrtk.org/index.php?title=RTK/Meetings/TrainingNov15&diff=403RTK/Meetings/TrainingNov152015-10-26T11:18:43Z<p>Cyril.mory: </p>
<hr />
<div>Here is a list of the RTK command lines you will have to run during the training, along with the data you will need.<br />
To start, download the following [http://midas3.kitware.com/midas/download/item/318788/muCT.mha CT data] and a relevant Cone-Beam CT [http://midas3.kitware.com/midas/download/item/318790/geometry.xml geometry file].<br />
<br />
== Forward projection ==<br />
<br />
To forward project the CT volume, following the geometry described in geometry.xml, run<br />
<br />
rtkforwardprojections -i muCT.mha -o projections.mha -g geometry.xml<br />
<br />
Look at the result using vv<br />
<br />
vv projections.mha<br />
<br />
There are as many projections as described in the geometry.xml file. You can edit the geometry.xml file, remove all projections except one, and try again. Such a modified geometry file is available [http://midas3.kitware.com/midas/download/item/318789/singleProjectionGeometry.xml here]. Run the following command line<br />
<br />
rtkforwardprojections -i muCT.mha -o singleProjection.mha -g singleProjectionGeometry.xml<br />
<br />
You can check with vv that the file contains only one projection<br />
<br />
vv singleProjection.mha<br />
<br />
== Back projection ==<br />
<br />
Start by back projecting a single projection. Run<br />
<br />
rtkbackprojections -p . -r singleProjection.mha -o singleBackProjection.mha -g singleProjectionGeometry.xml<br />
<br />
Observe the result with vv<br />
<br />
vv singleBackProjection.mha<br />
<br />
As you can see, the projection data seems to be smeared into the volume. Now back project all projections, by running<br />
<br />
rtkbackprojections -p . -r projections.mha -o backProjection.mha -g geometry.xml<br />
<br />
Look at the result with vv. In order to compare it with the original image, run <br />
<br />
vv backProjection.mha muCT.mha --linkall<br />
<br />
Click in one of the display windows, hit 'Ctrl + G' to center the view on the tumor. Hit 'w' to automatically compute reasonable window and level values. You can navigate between "muCT.mha" and "backProjection.mha" by hitting the 'Tab' key.<br />
<br />
== Using different forward and back projection algorithms ==<br />
<br />
Both rtkforwardprojections and rtkbackprojections can use several algorithms to perform the forward or back projections. For forward projections, you can try the following command lines<br />
<br />
rtkforwardprojections -i muCT.mha -o josephProjections.mha -g geometry.xml --fp Joseph<br />
rtkforwardprojections -i muCT.mha -o rayCastInterpolatorProjections.mha -g geometry.xml --fp RayCastInterpolator<br />
<br />
And for back projection<br />
<br />
rtkbackprojections -p . -r projections.mha -o voxelBasedBackProjection.mha -g geometry.xml --bp VoxelBasedBackProjection<br />
rtkbackprojections -p . -r projections.mha -o josephBackProjection.mha -g geometry.xml --bp Joseph<br />
rtkbackprojections -p . -r projections.mha -o normalizedJosephBackProjection.mha -g geometry.xml --bp NormalizedJoseph<br />
<br />
If you have a CUDA-capable graphics card, and have compiled RTK with RTK_USE_CUDA=ON, you can also try the following<br />
<br />
rtkforwardprojections -i muCT.mha -o cudaRayCastProjections.mha -g geometry.xml --fp CudaRayCast<br />
rtkbackprojections -p . -r projections.mha -o cudaRayCastBackProjection.mha -g geometry.xml --bp CudaRayCast<br />
rtkbackprojections -p . -r projections.mha -o cudaBackProjection.mha -g geometry.xml --bp CudaBackProjection<br />
<br />
== Iterative reconstruction algorithms ==<br />
<br />
Various reconstruction algorithms exists, which employ forward and back projection extensively. We will now start performing real reconstructions using some of the algorithms implemented in RTK. Since these algorithms are computationally much more demanding than the standard FDK, we propose to run them with low resolution data. You will be able to re-compute them at full resolution later, since the present page will remain available to you after the training.<br />
<br />
Start by downloading the cone beam CT projection data [http://midas3.kitware.com/midas/download/item/208648/projections.tgz here], and extract it. It contains 644 projections, each one in a ".his" file. You can view them in vv by typing<br />
<br />
vv --sequence *.his<br />
<br />
RTK has a collection of tools to convert and preprocess commercial CBCT projection data, most of which are combined in the application "rtkprojections". To convert and preprocess these projections, run<br />
<br />
rtkprojections -p . -r .*.his -o projections.mha</div>Cyril.moryhttps://wiki.openrtk.org/index.php?title=RTK/Meetings/TrainingNov15&diff=402RTK/Meetings/TrainingNov152015-10-26T10:38:14Z<p>Cyril.mory: </p>
<hr />
<div>Here is a list of the RTK command lines you will have to run during the training, along with the data you will need.<br />
To start, download the following [http://midas3.kitware.com/midas/download/item/318788/muCT.mha CT data] and a relevant Cone-Beam CT [http://midas3.kitware.com/midas/download/item/318790/geometry.xml geometry file].<br />
<br />
== Forward projection ==<br />
<br />
To forward project the CT volume, following the geometry described in geometry.xml, run<br />
<br />
rtkforwardprojections -i muCT.mha -o projections.mha -g geometry.xml<br />
<br />
Look at the result using vv<br />
<br />
vv projections.mha<br />
<br />
There are as many projections as described in the geometry.xml file. You can edit the geometry.xml file, remove all projections except one, and try again. Such a modified geometry file is available [http://midas3.kitware.com/midas/download/item/318789/singleProjectionGeometry.xml here]. Run the following command line<br />
<br />
rtkforwardprojections -i muCT.mha -o singleProjection.mha -g singleProjectionGeometry.xml<br />
<br />
You can check with vv that the file contains only one projection<br />
<br />
vv singleProjection.mha<br />
<br />
== Back projection ==<br />
<br />
Start by back projecting a single projection. Run<br />
<br />
rtkbackprojections -p . -r singleProjection.mha -o singleBackProjection.mha -g singleProjectionGeometry.xml<br />
<br />
Observe the result with vv<br />
<br />
vv singleBackProjection.mha<br />
<br />
As you can see, the projection data seems to be smeared into the volume. Now back project all projections, by running<br />
<br />
rtkbackprojections -p . -r projections.mha -o backProjection.mha -g geometry.xml<br />
<br />
Look at the result with vv. In order to compare it with the original image, run <br />
<br />
vv backProjection.mha muCT.mha --linkall<br />
<br />
Click in one of the display windows, hit 'Ctrl + G' to center the view on the tumor. Hit 'w' to automatically compute reasonable window and level values. You can navigate between "muCT.mha" and "backProjection.mha" by hitting the 'Tab' key.<br />
<br />
== Using different forward and back projection algorithms ==<br />
<br />
Both rtkforwardprojections and rtkbackprojections can use several algorithms to perform the forward or back projections. For forward projections, you can try the following command lines<br />
<br />
rtkforwardprojections -i muCT.mha -o josephProjections.mha -g geometry.xml --fp Joseph<br />
rtkforwardprojections -i muCT.mha -o rayCastInterpolatorProjections.mha -g geometry.xml --fp RayCastInterpolator<br />
<br />
And for back projection<br />
<br />
rtkbackprojections -p . -r projections.mha -o voxelBasedBackProjection.mha -g geometry.xml --bp VoxelBasedBackProjection<br />
rtkbackprojections -p . -r projections.mha -o josephBackProjection.mha -g geometry.xml --bp Joseph<br />
rtkbackprojections -p . -r projections.mha -o normalizedJosephBackProjection.mha -g geometry.xml --bp NormalizedJoseph<br />
<br />
If you have a CUDA-capable graphics card, and have compiled RTK with RTK_USE_CUDA=ON, you can also try the following<br />
<br />
rtkforwardprojections -i muCT.mha -o cudaRayCastProjections.mha -g geometry.xml --fp CudaRayCast<br />
rtkbackprojections -p . -r projections.mha -o cudaRayCastBackProjection.mha -g geometry.xml --bp CudaRayCast<br />
rtkbackprojections -p . -r projections.mha -o cudaBackProjection.mha -g geometry.xml --bp CudaBackProjection</div>Cyril.moryhttps://wiki.openrtk.org/index.php?title=RTK/Meetings/TrainingNov15&diff=401RTK/Meetings/TrainingNov152015-10-26T10:15:16Z<p>Cyril.mory: /* Forward projection */</p>
<hr />
<div>Here is a list of the RTK command lines you will have to run during the training, along with the data you will need.<br />
To start, download the following [http://midas3.kitware.com/midas/download/item/318788/muCT.mha CT data] and a relevant Cone-Beam CT [http://midas3.kitware.com/midas/download/item/318790/geometry.xml geometry file].<br />
<br />
== Forward projection ==<br />
<br />
To forward project the CT volume, following the geometry described in geometry.xml, run<br />
<br />
rtkforwardprojections -i muCT.mha -o projections.mha -g geometry.xml<br />
<br />
Look at the result using vv<br />
<br />
vv projections.mha<br />
<br />
There are as many projections as described in the geometry.xml file. You can edit the geometry.xml file, remove all projections except one, and try again. Such a modified geometry file is available [http://midas3.kitware.com/midas/download/item/318789/singleProjectionGeometry.xml here]. Run the following command line<br />
<br />
rtkforwardprojections -i muCT.mha -o singleProjection.mha -g singleProjectionGeometry.xml<br />
<br />
You can check with vv that the file contains only one projection<br />
<br />
vv singleProjection.mha<br />
<br />
== Back projection ==<br />
<br />
Start by back projecting a single projection. Run<br />
<br />
rtkbackprojections -p . -r singleProjection.mha -o singleBackProjection.mha -g singleProjectionGeometry.xml<br />
<br />
Observe the result with vv<br />
<br />
vv singleBackProjection.mha<br />
<br />
As you can see, the projection data seems to be smeared into the volume. Now back project all projections, by running<br />
<br />
rtkbackprojections -p . -r projections.mha -o backProjection.mha -g geometry.xml<br />
<br />
Look at the result with vv. In order to compare it with the original image, run <br />
<br />
vv backProjection.mha muCT.mha --linkall<br />
<br />
Click in one of the display windows, hit 'Ctrl + G' to center the view on the tumor. Hit 'w' to automatically compute reasonable window and level values. You can navigate between "muCT.mha" and "backProjection.mha" by hitting the 'Tab' key.</div>Cyril.moryhttps://wiki.openrtk.org/index.php?title=RTK/Meetings/TrainingNov15&diff=400RTK/Meetings/TrainingNov152015-10-26T10:13:44Z<p>Cyril.mory: /* Forward projection */</p>
<hr />
<div>Here is a list of the RTK command lines you will have to run during the training, along with the data you will need.<br />
To start, download the following [http://midas3.kitware.com/midas/download/item/318788/muCT.mha CT data] and a relevant Cone-Beam CT [http://midas3.kitware.com/midas/download/item/318790/geometry.xml geometry file].<br />
<br />
== Forward projection ==<br />
<br />
To forward project the CT volume, following the geometry described in geometry.xml, run<br />
<br />
rtkforwardprojections -i muCT.mha -o projections.mha -g geometry.xml<br />
<br />
Look at the result using vv<br />
<br />
vv projections.mha<br />
<br />
There are as many projections as described in the geometry.xml file. You can edit the geometry.xml file, remove all projections except one, and try again. Such a modified geometry.xml file is already provided along with the data (singleProjectionGeometry.xml). Run the following command line<br />
<br />
rtkforwardprojections -i muCT.mha -o singleProjection.mha -g singleProjectionGeometry.xml<br />
<br />
You can check with vv that the file contains only one projection<br />
<br />
vv singleProjection.mha<br />
<br />
== Back projection ==<br />
<br />
Start by back projecting a single projection. Run<br />
<br />
rtkbackprojections -p . -r singleProjection.mha -o singleBackProjection.mha -g singleProjectionGeometry.xml<br />
<br />
Observe the result with vv<br />
<br />
vv singleBackProjection.mha<br />
<br />
As you can see, the projection data seems to be smeared into the volume. Now back project all projections, by running<br />
<br />
rtkbackprojections -p . -r projections.mha -o backProjection.mha -g geometry.xml<br />
<br />
Look at the result with vv. In order to compare it with the original image, run <br />
<br />
vv backProjection.mha muCT.mha --linkall<br />
<br />
Click in one of the display windows, hit 'Ctrl + G' to center the view on the tumor. Hit 'w' to automatically compute reasonable window and level values. You can navigate between "muCT.mha" and "backProjection.mha" by hitting the 'Tab' key.</div>Cyril.moryhttps://wiki.openrtk.org/index.php?title=RTK/Meetings/TrainingNov15&diff=399RTK/Meetings/TrainingNov152015-10-26T10:13:33Z<p>Cyril.mory: /* Forward projection */</p>
<hr />
<div>Here is a list of the RTK command lines you will have to run during the training, along with the data you will need.<br />
To start, download the following [http://midas3.kitware.com/midas/download/item/318788/muCT.mha CT data] and a relevant Cone-Beam CT [http://midas3.kitware.com/midas/download/item/318790/geometry.xml geometry file].<br />
<br />
== Forward projection ==<br />
<br />
To forward project the CT volume, following the geometry described in geom.xml, run<br />
<br />
rtkforwardprojections -i muCT.mha -o projections.mha -g geometry.xml<br />
<br />
Look at the result using vv<br />
<br />
vv projections.mha<br />
<br />
There are as many projections as described in the geometry.xml file. You can edit the geometry.xml file, remove all projections except one, and try again. Such a modified geometry.xml file is already provided along with the data (singleProjectionGeometry.xml). Run the following command line<br />
<br />
rtkforwardprojections -i muCT.mha -o singleProjection.mha -g singleProjectionGeometry.xml<br />
<br />
You can check with vv that the file contains only one projection<br />
<br />
vv singleProjection.mha<br />
<br />
== Back projection ==<br />
<br />
Start by back projecting a single projection. Run<br />
<br />
rtkbackprojections -p . -r singleProjection.mha -o singleBackProjection.mha -g singleProjectionGeometry.xml<br />
<br />
Observe the result with vv<br />
<br />
vv singleBackProjection.mha<br />
<br />
As you can see, the projection data seems to be smeared into the volume. Now back project all projections, by running<br />
<br />
rtkbackprojections -p . -r projections.mha -o backProjection.mha -g geometry.xml<br />
<br />
Look at the result with vv. In order to compare it with the original image, run <br />
<br />
vv backProjection.mha muCT.mha --linkall<br />
<br />
Click in one of the display windows, hit 'Ctrl + G' to center the view on the tumor. Hit 'w' to automatically compute reasonable window and level values. You can navigate between "muCT.mha" and "backProjection.mha" by hitting the 'Tab' key.</div>Cyril.moryhttps://wiki.openrtk.org/index.php?title=RTK/Meetings/TrainingNov15&diff=398RTK/Meetings/TrainingNov152015-10-26T10:12:55Z<p>Cyril.mory: </p>
<hr />
<div>Here is a list of the RTK command lines you will have to run during the training, along with the data you will need.<br />
To start, download the following [http://midas3.kitware.com/midas/download/item/318788/muCT.mha CT data] and a relevant Cone-Beam CT [http://midas3.kitware.com/midas/download/item/318790/geometry.xml geometry file].<br />
<br />
== Forward projection ==<br />
<br />
To forward project the CT.mha volume, following the geometry described in geom.xml, run<br />
<br />
rtkforwardprojections -i muCT.mha -o projections.mha -g geometry.xml<br />
<br />
Look at the result using vv<br />
<br />
vv projections.mha<br />
<br />
There are as many projections as described in the geometry.xml file. You can edit the geometry.xml file, remove all projections except one, and try again. Such a modified geometry.xml file is already provided along with the data (singleProjectionGeometry.xml). Run the following command line<br />
<br />
rtkforwardprojections -i muCT.mha -o singleProjection.mha -g singleProjectionGeometry.xml<br />
<br />
You can check with vv that the file contains only one projection<br />
<br />
vv singleProjection.mha<br />
<br />
== Back projection ==<br />
<br />
Start by back projecting a single projection. Run<br />
<br />
rtkbackprojections -p . -r singleProjection.mha -o singleBackProjection.mha -g singleProjectionGeometry.xml<br />
<br />
Observe the result with vv<br />
<br />
vv singleBackProjection.mha<br />
<br />
As you can see, the projection data seems to be smeared into the volume. Now back project all projections, by running<br />
<br />
rtkbackprojections -p . -r projections.mha -o backProjection.mha -g geometry.xml<br />
<br />
Look at the result with vv. In order to compare it with the original image, run <br />
<br />
vv backProjection.mha muCT.mha --linkall<br />
<br />
Click in one of the display windows, hit 'Ctrl + G' to center the view on the tumor. Hit 'w' to automatically compute reasonable window and level values. You can navigate between "muCT.mha" and "backProjection.mha" by hitting the 'Tab' key.</div>Cyril.mory