iradonIT: Iterative Inverse Radon Transformation

Description Usage Arguments Details Value Author(s) References See Also Examples

View source: R/iradonIT.r

Description

The function implements three of the major iterative reconstruction techniques: ART (Algebraic Reconstruction Technique), EM (Likelihood Reconstruction using Expectation Maximization) and LSCG (Least Squares Conjugate Method).

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
iradonIT(rData, XSamples, YSamples, StartImage = "None", 
         mode = "EM", UseFast = 1, RadonKernel = "NN", 
         Iterations = 20, IterationsType = "random", 
         SaveIterations = 0, SaveIterationsName = "", 
         LowestALevel = 0, ConstrainMin = -1, 
         ConstrainMax = -1, Alpha = 1, Beta = 1, 
         Regularization = 0, KernelFileSave = 0, 
         KernelFileName = "", RefFileName = "None", 
         ThetaSamples = nrow(rData), RhoSamples = ncol(rData), 
         ThetaMin = 0, RhoMin = -0.5*((2*round(sqrt(XSamples^2+
         YSamples^2)/2)+1)-1), DeltaTheta = pi/ThetaSamples, 
         DeltaRho = (2*abs(RhoMin)+1)/RhoSamples, 
         Xmin = -0.5*(XSamples-1), Ymin = -0.5*(YSamples-1), 
         DeltaX = 1, DeltaY = 1, OverSamp = 0, 
         DebugLevel = "Normal", iniFile = NULL)

Arguments

rData

(matrix) A matrix that contains the sinogram. The rows of the image correspond to the sampled angles θ and the columns correspond to the sampled distance ρ. These both parameters determine the lines.

XSamples

(integer) XSamples is the number of samples on the x-axis (rows) in the reconstructed image.

YSamples

(integer) YSamples is the number of samples on the y-axis (columns) in the reconstructed image.

StartImage

(matrix) If provided, then the initial guess on the reconstructed image is taken from this image, otherwise a constant solution will be assumed from the start. Default is set to StartImage="None". Note, that the dimension of the StartImage has to be dim(StartImage)==c(XSamples,YSamples).

mode

(character) The iterative reconstruction method. Default is mode="EM" for Likelihood Reconstruction using Expectation Maximization. Additional implementations are "ART" (Algebraic Reconstruction Technique) and "CG" (Least Squares Conjugate Method).

UseFast

(logical) If UseFast=1 fast reconstruction is used, where the system matrix is stored (in case of KernelFileSave=1) using sparse techniques, otherwise a slower but more efficient memory reconstruction is used. Default is UseFast=1.

RadonKernel

(character) The type of kernel is used to model the system matrix. Default is RadonKernel="NN" for two-level Nearest Neighbour approximation (Memory consuming). Additional implementations are "RNN" for ray driven Nearest Neighbour approximation discrete Radon transformation based (very fast with small system matrix), "RL" for ray driven Linear Interpolation discrete Radon transformation based (fast with small system matrix), "P1" for method based on Radon transformation of square with pre-guidance (slow but good) and "P2" for method based on Radon transformation of square with no pre-guidance (slower but better).

Iterations

(integer) Using mode="EM" or "CG", it is the number of iterations before the iteration ends. Using mode="ART", it is the number of full iterations, i.e., divided by the number of rows in the system matrix. Defaults to Iterations=20.

IterationsType

(character) Using mode="ART", two iterations types are possible:
"cyclic" selection of the row index or "random" selection. Defaults to IterationsType = "random".

SaveIterations

(integer) If it is set to SaveIterations=1, the current solution will be saved after each iteration under the name SaveIterationsName + CurrentIteration (also possible 2,3 ...). Defaults to SaveIterations=0.
NOTE: When Iterations/itINI.SaveIterations>300 then too many new files are requested. In this case default is used.

SaveIterationsName

(character) In case of SaveIteration is non-zero, the parameter determines the name of the currently saved iteration. It contains the path to the file and the filename. The path contains the path relatively to the working-directory of your R-session or it contains the full path of the file. Defaults to SaveIterationsName="".

LowestALevel

(double) If fast reconstruction is used, the matrix elements will be truncated to this level relatively to the sampling distance of x. Defaults to LowestALevel=0.0.

ConstrainMin

(double) After each iteration the solution in each sample will be forced above this limit. Defaults to ConstrainMin=0.

ConstrainMax

(double) After each iteration the solution in each sample will be forced below this limit. Defaults to ConstrainMax=-1.
NOTE: For both limit it is assumed that negative limits imply that the feature is not used.

Alpha

(double) If mode="ART", it will be the initial update weight. Defaults to Alpha=1.0.

Beta

(double) If mode="ART", it will be the multiplicative change to the weight factor, which should be less than one. Default is set to Beta=1.

Regularization

(double) If the Regularization is not zero and positive and using fast reconstruction, rows will be appended to the system matrix with a simple Laplace operator. A weight factor should also be incorporated. If negative, identity matrix will be used. Defaults to Regularization=0.

KernelFileSave

(logical) If KernelFileSave=1 and fast reconstruction is used, the system matrix will be saved under the name KernelFileName. Defaults to KernelFileSave=0.

KernelFileName

(character) If fast reconstruction is used, the system matrix will be saved and restored with this sif-name. If the system matrix is incompatible to the sampling parameters, a new one will be generated. KernelFileName contains the path to the filename and the filename. The path contains the path relatively to the working-directory of your R-session or it contains the full path to the file. Defaults to KernelFileName="".

RefFileName

(character) Error measures can be made between the image which is contained in RefFileName and the reconstructed image from rData. The file has to be either a fif-file or a pet-file (type ?writeData or ?readData in R to get more information about these formats). If RefFileName exists, the measures will be logged in a file with the name of RefFileName and extension 'dif'. Defaults to RefFileName="None".

ThetaSamples

(integer) Number of angular samples θ in the sinogram.
Defaults to ThetaSamples=nrow(rData).

RhoSamples

(integer) Number of samples in the sinogram ρ in the ρ-direction. Defaults to RhoSamples=ncol(rData).

ThetaMin

(double) Start of the angular sampling (should be set to zero). Defaults to ThetaMin=0.

RhoMin

(double) Start of sampling positions in rho.
Defaults to RhoMin=-0.5* ((2*round(sqrt(XSamples^2+YSamples^2)/2)+1)-1).

DeltaTheta

(double) Angular sampling distance. Should be set to the default DeltaTheta = pi/ThetaSamples.

DeltaRho

(double) Sampling distance in rho. Defaults to DeltaRho=(2*abs(RhoMin)+1)/RhoSamples.

Xmin

(double) The minimum x-position of the reconstructed image. Defaults to Xmin=-0.5*(XSamples-1).

Ymin

(double) The minimum y-position of the reconstructed image. Defaults to Ymin=-0.5*(YSamples-1).

DeltaX

(double) Sampling distance on the x-axis. Defaults to DeltaX=1.

DeltaY

(double) Sampling distance on the y-axis. Defaults to DeltaY=1.

OverSamp

(integer) Uses oversampling - squared number of samples are used. Defaults to OverSamp=0.

DebugLevel

(character) This parameter controls the level of output. Defaults to DebugLevel="Normal" for a standard level output. Alternative implementations are "Detail" if it is desirable to show almost all output on screen or "HardCore" for no information at all.

iniFile

(character) If iniFile!=NULL, iniFile has to be the name of an ini-file including a pathname to the file. In the case of a specified iniFile all parameters are read from the file. Note that in this case contingently setting parameters (except for DebugLevel) in R are ignored when calling iradonIT. The parameters which are not specified in iniFile are set to defaults. Default of iniFile is iniFile=NULL.

Details

The function implements three of the major iterative reconstruction techniques: ART (Algebraic Reconstruction Technique), EM (Likelihood Reconstruction using Expectation Maximization) and LSCG (Least Squares Conjugate Method). The reconstruction methods were developed by P. Toft (1996) and implemented in R by J. Schulz (2006). For detailed theoretical information about the Radon-transformation see references.

There are a lot of different parameters which influence the reconstruction method. In common cases, it should be enough to determine rData, XSamples and YSamples. For the default parameters, it is assumed that the sinogram is standardised to a coordinate system with theta from 0 to π and rho from -0.5*((2*round(sqrt(M^2+N^2)/2)+1)-1) to 0.5*((2*round(sqrt(M^2+N^2)/2)+1)-1). It is also assumed that the reconstructed image is standardised to a coordinate system with x from -0.5*(M-1) to 0.5*(M-1) and y from -0.5*(N-1) to 0.5*(N-1). R, M and N are the number of sampling parameters in ρ, x and y. If that is not true, you will have to adapt the parameters.
Several things must be fulfilled to ensure a reasonable performance. Firstly sampling must be adequate in all parameters (see to references to get detail information). This will imply bounds on the sampling intervals. Secondly it is assumed that the fundamental function f(x,y) to be reconstructed have compact support, or more precisely is zero if sqrt(x^2+y^2) > |rho_{max}|. This demand will ensure that Rf(rho,theta)=0, if |rho|>|rho_{max}|. If this cannot be fulfilled, numerical problems must be expected.
Assuming that f(x,y) has compact support, then (x,y)=(0,0) should be placed to minimize |rho_{max}|. This will reduce the size of the data array used for the discrete Radon transform.

The numerical complexity of the procedure is mainly determined by Iterations, the size of rData, XSamples, YSamples and by the use of fast reconstruction method.
Fast reconstruction is used in case of UseFast=1. It is possible to store the computed system matrix (KernelFileSave=1) under the name KernelFileName. The speed of the reconstruction can obviously be increased by using of an existing system matrix. NOTE: This is only possible, if the sampling parameters are compatible with the system matrix. That means, that the fifteen parameters XSamples, YSamples, DeltaX, DeltaY, Xmin, Ymin, ThetaSamples, RhoSamples, DeltaRho, DeltaTheta, ThetaMin, RhoMin, LowestALevel, RadonKernel and OverSamp are equal to the parameter from which the system matrix is generated. If the system matrix is incompatible to the sampling parameters, a new one will be generated.

Another variation to determine the parameter is the offer with iniFile. iniFile has to be the name of a file (e.g. iniFile="/home/work/sino.ini") with the following structure. Each line contains at first the name of a parameter, then an equal sign follows and the value of the parameter. The first line must contain the parameter mode. Characters are not written in "", e.g. RadonKernel=NN and not RadonKernel="NN". Furthermore note that in an ini-file rData and StartImage are to be of type character, videlicet the name of the corresponding file. Supported file formats are ".txt", ".dat", ".fif", ".pet", ".tif", ".tiff", ".pgm", ".ppm", ".png", ".pnm", ".gif", ".jpg", ".jpeg". See ?readData to get detailed information about supported formats.
If a file of the type ".fif", ".pet" or ".dat" is specified for rData (see ?writeData or ?readData in R to get more information about these formats), the parameters ThetaSamples, RhoSamples, ThetaMin, RhoMin, DeltaTheta and DeltaRho will be read from the file-header of rData, but only in case of unspecified corresponding parameters. Just as, if a file of type ".fif", ".pet" or ".dat" is specified for StartImage, then the parameters XSamples, YSamples, XMin, YMin, DeltaX and DeltaY will be read from the file-header.
Note that in case of an ini-file, contingently setting parameters (except for DebugLevel) in R are ignored when calling iradonIT. Parameters that are not specified in the iniFile are set to defaults.

Value

irData

A matrix, that contains the reconstructed image (matrix) of rData.

Header

A list of following values:

SignalDim

The dimension of the irData.

XYmin

The minimum x- and y-position in irData.

DeltaXY

Sampling distance on the x- and y-axis in irData.

call

Arguments of the call to iradonIT.

Author(s)

Joern Schulz [email protected], Peter Toft.

References

Toft, Peter, Ph.D. Thesis, The Radon Transform - Theory and Implementation, Department of Mathematical Modelling Section for Digital Signal Processing, Technical University of Denmark, 1996.
http://eivind.imm.dtu.dk/staff/ptoft/ptoft_papers.html

Schulz, Joern, Diploma Thesis: Analyse von PET Daten unter Einsatz adaptiver Glaettungsverfahren, Humboldt-Universitaet zu Berlin, Institut fuer Mathematik, 2006.

See Also

radon, iradon

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#    
# Compare the results of iterative reconstruction method "EM" and 
# direct reconstruction method "FB"
#
## Not run: 
P <- phantom(design="B")
rP <- markPoisson(P, nSample=1600000 )
irP1 <- iradon(rP$rData , nrow(P), ncol(P))
irP2 <- iradonIT(rP$rData , nrow(P), ncol(P))
viewData(list(P, rP$rData, irP1$irData, irP2$irData),
         list("Generated unnoisy Phantom", "Generated PET Data",
         "Direct rec.: mode='FB'", "Iterative rec.: mode='EM'"))
rm(irP1,irP2,P,rP)

## End(Not run)

#    
# Compare the results from the iterative reconstruction methods "EM"
# "CG" and "ART"
#
## Not run: 
P <- phantom(n=151, addIm="blurred1")
rP <- markPoisson(P, nSample=2000000, RhoSamples=401)
irP1 <- iradonIT(rP$rData , nrow(P), ncol(P), Iterations=20, 
        ConstrainMin=0, ConstrainMax=10)
irP2 <- iradonIT(rP$rData , nrow(P), ncol(P), mode="CG", 
        Iterations=4, ConstrainMin=0, ConstrainMax=10)
irP3 <- iradonIT(rP$rData , nrow(P), ncol(P), mode="ART", 
        Iterations=5, ConstrainMin=0, ConstrainMax=10, 
        Alpha=0.1, Beta=0.5)
viewData(list(P,irP1$irData,irP2$irData,irP3$irData),
         list("Generated unnoisy Phantom",
         "mode='EM', Iterations=20","mode='CG', Iterations=4", 
         "mode='ART', Iter.=20, Alpha=0.1, Beta=0.5"))
rm(irP1,irP2,irP3,P,rP)

## End(Not run)

PET documentation built on May 2, 2019, 2:43 a.m.