FreeARTBaseClass

FreeART API

Transmission class

import freeart
import scipy.misc
import numpy

# forward projection
image = scipy.misc.ascent()
image.reshape(image.shape[0], image.shape[1], 1)
freeart.TxBckProjection(image.astype(numpy.float64), numpy.linspace(0, numpy.pi))

algoProj = freeart.TxFwdProjection(l.astype(numpy.float64), minAngle=0, maxAngle=numpy.pi, anglesNb=360)
sino, angles = algoProj.makeSinogram()

# backward projection
algoRecons = freeart.TxBckProjection(sino, angles)
recons = algoRecons.iterate(1)
class freeart.FreeART.TxFwdProjection

Bases: freeart.python_interface.FreeART.FreeARTFwdProjection

Class to do a FreeART sinogram generation in transmision mode. The angles at which the sinogram must be computed is defined either by the angleList parameter either by the three parameters minAngle, maxAngle and AnglesNb

Parameters:
  • phMatr – The phantom matrix. It has to be a numpy ndarray with data type float32 or float64
  • angleList – The angle (degree) list for which the sinogram has to be generated. It has to be a numpy ndarray. Data type has to be float32 or float64 - Optional
  • minAngle – The smallest angle (degree) - Optional
  • maxAngle – The largest angle (degree) - Optional
  • anglesNb – The angle number - Optional
makeSinogram()

Ask algorithm to generate a sinogram. The mask has to be a numpy 2 dimensions array (data type bool) with one element per phantom matrix pixel. In transmission mode, the specification of a ROI using the mask parameter is not supported.

Parameters:mask – mask to specify a Region Of Interest (ROI) - Optional
Returns:
  • A tuple with two elements which are:
  • The sinogram data as a 3 dimensions numpy array. The dimensions are slice number,
    rotation number and ray number. Today, slice number is always 1
  • The sinogram angles (degree) as a numpy array
class freeart.FreeART.TxBckProjection

Bases: freeart.python_interface.FreeART.FreeARTBckProjection

Class to do a FreeART reconstruction in Transmission mode

Parameters:
  • sinoDat – Sinogram data. It has to be a numpy ndarray with data type float32 or float64. The first array dimension is the slice number, the second array dimension is the angles number and the third one is the ray number. Today, slice number has to be 1 Sinogram data has to be -ln(I / I0) with I0 being the incoming beam intensity and I the beam intensity on the detector
  • sinoAngles – Sinogram angles (degree). It has to be a numpy ndarray. Data type has to be float32 or float64
iterate()

Ask algorithm to do the required number of iteration This method releases the python GIL in order to let other Python thread(s) run.

Parameters:numIter – Iteration number
Returns:The phantom absorption matrix as a 3D numpy array

Fluorescence class

import freeart
from freeart.utils import genph
import numpy

# forward projection
phGenerator = genph.PhantomGenerator()
sheppLogan_phantom = phGenerator.get2DPhantomSheppLogan(128)
sheppLogan_phantom.shape = (sheppLogan_phantom.shape[0], sheppLogan_phantom.shape[1], 1)

absMat     = sheppLogan_phantom * 20.0
selfAbsMat = sheppLogan_phantom / 10.0

detPos = (0., 1000., 0.)
detSetup = [(detPos, 10.)]

alProj = freeart.FluoFwdProjection(phMatr=sheppLogan_phantom,
                                                  expSetUp=detSetup,
                                                  absorpMatr=absMat,
                                                  selfAbsorpMatrix=selfAbsMat,
                                                  minAngle=0.,
                                                  maxAngle=numpy.pi*2.0,
                                                  anglesNb=360)

sinogram, angles = alProj.makeSinogram()

# backward projection
alRecons = freeart.FluoBckProjection(sinoDat=sinogram, sinoAngles=angles, expSetUp=detSetup,
         absorp=absMat, selfAbsorp=selfAbsMat)
recons = alRecons.iterate(1)
class freeart.FreeART.FluoFwdProjection

Bases: freeart.python_interface.FreeART.FreeARTFwdProjection

Class to do a FreeART sinogram generation in fluorescence mode. The angles at which the sinogram must be computed is defined either by the angleList parameter either by the three parameters minAngle, maxAngle and AnglesNb

Parameters:
  • phMatr – The phantom matrix. It has to be a numpy ndarray with data type float32 or float64
  • expSetUp

    The experiment detector set up. This is a list with one element per detector. Each detector is represented by a tuple with two elements which are

    1. The detector center position for the FIRST angle defined in the sinogram. This is a tuple with 3 elements which are the x, y and z coordinates. The coordinate system origin is the sample center. The unit is defined by the sinogram lines. For instance, if the sinogram line is 256 points long for a sample motion of 10 mm, the unit is 10/256 mm.
    2. The detector size. The detector is supposed to be a square. The unit is the same than previously described.
  • absorpMatrix – The absorption matrix for the incoming beam for fluorescence mode
  • selfAbsorpMatrix – The self absorption matrix for the outgoing beam for fluorescence mode
  • angleList – The angle (degree) list for which the sinogram has to be generated. It has to be a numpy ndarray. Data type has to be float32 or float64 - Optional
  • minAngle – The smallest angle (degree) - Optional
  • maxAngle – The largest angle (degree) - Optional
  • anglesNb – The angle number - Optional
makeSinogram()

Ask algorithm to generate a sinogram. The mask has to be a numpy 2 dimensions array (data type bool) with one element per phantom matrix pixel. In transmission mode, the specification of a ROI using the mask parameter is not supported.

Parameters:mask – mask to specify a Region Of Interest (ROI) - Optional
Returns:
  • A tuple with two elements which are:
  • The sinogram data as a 3 dimensions numpy array. The dimensions are slice number,
    rotation number and ray number. Today, slice number is always 1
  • The sinogram angles (degree) as a numpy array
class freeart.FreeART.FluoBckProjection

Bases: freeart.python_interface.FreeART.FreeARTBckProjection

Class to do a FreeART reconstruction in Fluorescence mode

Parameters:
  • sinoDat – Sinogram data. It has to be a numpy 3D ndarray with data type float32 or float64 The first array dimension is the slice number, the second array dimension is the angles number and the third one is the ray number. Today, slice number has to be 1 Sinogram data has to be -ln(I / I0) with I0 being the incoming beam intensity and I the beam intensity on the detector
  • sinoAngles – Sinogram angles (degree). It has to be a numpy ndarray. Data type has to be float32 or float64
  • expSetUp

    The experiment detector set up. This is a list with one element per detector. Each detector is represented by a tuple with two elements which are

    1. The detector center position for the FIRST angle defined in the sinogram. This is a tuple with 3 elements which are the x, y and z coordinates. The coordinate system origin is the sample center. The unit is defined by the sinogram lines. For instance, if the sinogram line is 256 points long for a sample motion of 10 mm, the unit is 10/256 mm.
    2. The detector size. The detector is supposed to be a square. The unit is the same than previously described.
  • absorp – The phantom absorption matrix (retrieved using a previous Tx reconstruction for instance)
  • selfAbsorp – The phantom absorption matrix in case fluorescence self absorption is taken into account
iterate()

Ask algorithm to do the required number of iteration This method releases the python GIL in order to let other Python thread(s) run.

Parameters:numIter – Iteration number
Returns:The phantom absorption matrix as a 3D numpy array