Get started in Matlab

From NiftyRec
(Difference between revisions)
Jump to: navigation, search
(Recovered from spam flood)
 

Latest revision as of 11:22, 31 August 2012

Contents

[edit] Install

In order to make Matlab aware that NiftyRec is installed in the system use the 'addpath' command pointing to the 'matlab' subfolder in the NiftyRec installation directory. With default directories that is:

MAC OSx and Linux

>> addpath('/usr/local/niftyrec/matlab/');

Windows

>> addpath('C:/Program Files/niftyrec/matlab/');

You are ready to run one of the demos. When you run the first demo, Matlab might display an error message like this (this is in MAC-OS, but similar messages are displayed in Windows and Linux):

Invalid MEX-file '/Applications/NiftyRec/niftyrec/matlab/et_project_mex.mexmaci64': dlopen(/Applications/NiftyRec/niftyrec/matlab/et_project_mex.mexmaci64, 1): Library not loaded: lib_et.dylib Referenced from: /Applications/NiftyRec/niftyrec/matlab/et_project_mex.mexmaci64 Reason: image not found

This error message means that Matlab could not find the NiftyRec libraries in the system. Make sure that the NiftyRec libraries are in the system path. To do so, close Matlab, in MAC-OSx and Linux open the Terminal and type

MAC-OSx

$ extern DYLD_LIBRARY_PATH=/Applications/NiftyRec/lib/:$DYLD_LIBRARY_PATH $ /Applications/MATLAB_R2012a.app/bin/matlab

(modify according to the NiftyRec installation path and to the Matlab installation path and version)

Linux

$ extern LD_LIBRARY_PATH=/home/yourusername/NiftyRec/lib/:$LD_LIBRARY_PATH $ /usr/local/matlab/bin/matlab

(modify according to the NiftyRec installation path and to the Matlab installation path)

Windows Start the System Control Panel applet (Start - Settings - Control Panel - System). Select the Advanced tab. Click the Environment Variables button. Under System Variables, select Path, then click Edit. You'll see a list of folders, add 'C:/path_to_niftyrec/lib;' at the end of the list and click ok. Restart Matlab.

[edit] Inline documentation

To see a list of functions for Emission Tomography, digit 'et_' then press the Tab key, this will list all the functions for Emission Tomography. 'tt_' for transmission tomography, 'seg_' for segmentation functions and 'reg_' for registration functions. Digit 'help' then the name of a function to visualise the documentation, e.g.:

>> help et_project


[edit] Demos

[edit] SPECT OSEM reconstruction demo

Ordered subsets expectation maximisation (OSEM) reconstruction of synthetic SPECT data. The following demos generate a simple synthetic phantom, a sphere in uniform background, simulate a SPECT acquisition of the synthetic uptake, and reconstruct with OSEM.

2D

>> et_demo_osem_2D;

3D

>> et_demo_osem;

(it's preferred to have a CUDA compatible GPU installed for 3D, it can make the reconstructions up to about 80x faster)

[edit] SPECT MLEM reconstruction demo

Maximum likelihood expectation maximisation (MLEM) reconstruction of synthetic SPECT data. The following demo generates a simple synthetic phantom, a sphere in uniform background, simulates a SPECT acquisition of the synthetic uptake, and reconstructs with MLEM.


3D

>> et_demo_mlem;

(it's preferred to have a CUDA compatible GPU installed for 3D, it can make the reconstructions up to about 80x faster)

[edit] Simind demo

This demo imports a sinogram produced by the Simind Monte Carlo simulator and reconstructs the activity with OSEM. The sinogram is included in the NiftyRec installation since version 1.6. If you built NiftyRec from source, make sure that the option INCLUDE_DATA was enabled. Otherwise go and find the data in the NiftyRec source folder /data.

>> et_demo_simind;

[edit] PET-Sorteo demo

This demo imports a sinogram produced by the PET-Sorteo Monte Carlo simulator and reconstructs the activity with OSEM. The simulation data is included in the NiftyRec installation since version 1.6. If you built NiftyRec from source, make sure that the option INCLUDE_DATA was enabled. Otherwise go and find the data in the NiftyRec source folder /data.

>> et_demo_pet_sorteo;

[edit] Transmission Tomography, parallel beam, iterative reconstruction, 3D

This demo performs iterative reconstruction of parallel beam CT using the MLEM algorithm on GPU.

>> tt_demo_mlem_parallel;

[edit] Transmission Tomography, cone beam projection, 3D

This demo calculates a cone beam X-ray projection on the GPU.

>> tt_demo_project;
Personal tools
Namespaces

Variants
Actions
Navigation
Toolbox