utils

freeart.utils

Python utils for freeart.

freeart.utils.reconstrutils: some utils linked to the reconstruction

freeart.utils.reconstrutils.decreaseMatSize(mat)[source]

will decrease the matrice size if possible where one dimension has only one element

freeart.utils.reconstrutils.increaseMatSize(mat, firstPos)[source]

Simple function which will add a dimension to the current matrice

Parameters:
  • mat – the matrice for which we want to remove a dimension
  • firstPos – if true remove the first position else remove the last
freeart.utils.reconstrutils.savePhantom(data, fileName, overwrite=False)[source]

will create an edf file to store the given data

Parameters:
  • data – the data to save
  • fileName – the localisation to know where to save the data
freeart.utils.reconstrutils.LoadEdf_2D(fName, frame=0)[source]

Load data from the given edf file

Parameters:
  • fName – the name of the file
  • frame – if multiple frame file, will use theis parameter to load a specific frame
freeart.utils.reconstrutils.makeFreeARTFluoSinogram(phantom, absMat, selfAbsMat, numAngle, detSetup, oversampling, beamCalcMeth, outRayPtCalcMeth, minAngle=0.0, maxAngle=6.283185307179586, subdivisionValue=3, turnOffSolidAngle=False, I0=1.0, voxelSize=1.0)[source]

Generate the fluorescence sinogram

Parameters:
  • phantom – The initial phantom (density * probability of emission of photon…)
  • absMat – absorption of the incoming. Aka \({\mu}_{E_0}{\rho}x\)
Returns:

  • sinogram (numpy array of float64 )
  • angles list of angles of projection

Warning

all angle values must be given in rad

freeart.utils.reconstrutils.convertToFisxMaterial(materialName, material)[source]

convert a material defined in a dictionnary (from tomoGUI for example. Used to be saved and loaded ) in a fisx Material. Won’t do the registration

Parameters:
  • materialName – the name to attribute to the fisx material
  • material – the material defined in a dictionary
Returns:

the fisx material

initial material structure looks like : materialName = “My_mat” material = {‘Comment’:”No comment”,

‘CompoundList’:[‘Cr’, ‘Fe’, ‘Ni’], ‘CompoundFraction’:[18.37, 69.28, 12.35], ‘Density’:1.0, ‘Thickness’:1.0}

Final structure is a fisx Material : steel = {“Cr”:18.37,

“Fe”:69.28, # calculated by subtracting the sum of all other elements “Ni”:12.35 }

material = Material(“My_mat”, 1.0, 1.0) material.setComposition(steel)

freeart.utils.genph: phantom generator

class freeart.utils.genph.PhantomGenerator[source]

Bases: object

Class for generating different Phantoms

get3DPhantomSheppLogan(n)[source]
Parameters:n – The width (and height) of the phantom to generate
Returns:A numpy array of dimension n*n fit with the sheppLogan phantom
get2DPhantomSheppLogan(n, ellipsoidID=None)[source]
Parameters:
  • n – The width (and height) of the phantom to generate
  • ellipsoidID – The Id of the ellipsoid to pick. If None will produce all the ellipsoid
get2DPhantomMetal(n, ellipsoidID=None)[source]
Parameters:
  • n – The width (and height) of the phantom to generate
  • ellipsoidID – The Id of the ellipsoid to pick. If None will produce all the ellipsoid

freeart.utils.benchmark: tool for benchmarking

Benchmark file.

freeart.utils.benchmark.benchmark_tx_projection(oversamplings, widthsToTest, nbAngle)[source]

Create a graph for benchmarking the transmission forward projector

Parameters:
  • oversamplings – the list of oversamplings to test
  • widthsToTest – the list of phantom width to test
  • nbAngle – the number of projection to test
freeart.utils.benchmark.benchmark_tx_reconstruction(oversamplings, widthsToTest, nbAngle, nbIter)[source]

Create a graph for benchmarking the transmission reconstructor

Parameters:
  • oversamplings – the list of oversamplings to test
  • widthsToTest – the list of phantom width to test
  • nbAngle – the number of projection to test
  • nbIter – the number of iteration to test (one iteration launch nbAngle back projection)
freeart.utils.benchmark.benchmark_fluo_projection(oversamplings, widthsToTest, nbAngle, outgoingraypointsmethods)[source]

Benchmark the fluo projection

Parameters:
  • oversamplings – the list of oversamplings to test
  • widthsToTest – the list of phantom width to test
  • nbAngle – the number of projection to test
  • outgoingraypointsmethods – the list of outgoingrayalgorithm to test
freeart.utils.benchmark.benchmark_fluo_reconstruction(oversamplings, widthsToTest, nbAngle, outgoingraypointsmethods, nbIter)[source]

benchmark the fluo reconstruction

Parameters:
  • oversamplings – the list of oversamplings to test
  • widthsToTest – the list of phantom width to test
  • nbAngle – the number of projection to test
  • outgoingraypointsmethods – the list of outgoingrayalgorithm to test
  • nbIter – the number of iteration to test (one iteration launch nbAngle back projection)