User API#

Most functions can be accessed by importing mbirjax and creating a model or through mbirjax directly. Most commonly used functions are described below. See Demos and FAQs for examples.

Geometry Models#

The first step is to create an instance with a specific geometry. This is done by initializing one of the following geometry classes:

mbirjax.ParallelBeamModel(sinogram_shape, angles)

A class designed for handling forward and backward projections in a parallel beam geometry, extending the TomographyModel.

mbirjax.ConeBeamModel(sinogram_shape, ...)

A class designed for handling forward and backward projections in a cone beam geometry, extending the TomographyModel.

Reconstruction and Projection#

Each geometry class is derived from TomographyModel, which includes a number of powerful methods listed below for manipulating sinograms and reconstructions. Detailed documentation for each geometry class is provided in ParallelBeamModel and ConeBeamModel.

Note that ParallelBeamModel also includes fbp_recon and ConeBeamModel includes fdk_recon for direct (non-iterative) reconstruction in the case of many views and low-noise data.

mbirjax.TomographyModel.recon(sinogram[, ...])

Perform MBIR reconstruction using the Multi-Granular Vector Coordinate Descent algorithm.

mbirjax.TomographyModel.scale_recon_shape([...])

Scale the recon shape by the given factors.

mbirjax.TomographyModel.prox_map(prox_input, ...)

Proximal Map function for use in Plug-and-Play applications.

mbirjax.TomographyModel.forward_project(recon)

Perform a full forward projection at all voxels in the field-of-view.

mbirjax.TomographyModel.back_project(sinogram)

Perform a full back projection at all voxels in the field-of-view.

mbirjax.TomographyModel.gen_weights(...)

Compute the optional weights used in MBIR reconstruction.

mbirjax.TomographyModel.gen_weights_mar(sinogram)

Generates the weights used for reducing metal artifacts in MBIR reconstruction.

mbirjax.TomographyModel.gen_modified_3d_sl_phantom()

Generates a simplified, low-dynamic range version of the 3D Shepp-Logan phantom.

Saving and Loading#

Saving and loading are implemented in TomographyModel, with methods overridden in geometry-specific models as needed.

mbirjax.TomographyModel.to_file(filename)

Save parameters to yaml file.

mbirjax.TomographyModel.from_file(filename)

Construct a TomographyModel (or a subclass) from parameters saved using to_file()

Parameter Handling#

See the Primary Parameters page for a description of the primary parameters. Parameter handling uses the following primary methods.

mbirjax.ParameterHandler.set_params([...])

Updates parameters using keyword arguments.

mbirjax.ParameterHandler.get_params(...)

Get the values of the listed parameter names from the internal parameter dict.

mbirjax.ParameterHandler.print_params()

Prints out the parameters of the model.

Preprocessing#

Preprocessing functions are implemented in Preprocess utilities. This includes various methods to compute and correct the sinogram data as needed. The following are functions specific to NSI scanners. See demo_nsi.py in the mbirjax_applications repo.

preprocess.nsi.compute_sino_and_params(...)

Load NSI sinogram data and prepare all needed arrays and parameters for a ConeBeamModel reconstruction.

preprocess.nsi.load_scans_and_params(dataset_dir)

Load the object scan, blank scan, dark scan, view angles, defective pixel information, and geometry parameters from an NSI scan directory.

The remaining functions can be used for multiple types of scan data.

preprocess.compute_sino_transmission(...[, ...])

Compute sinogram from object, blank, and dark scans.

preprocess.interpolate_defective_pixels(sino)

Interpolates defective sinogram entries with the mean of neighboring pixels.

preprocess.correct_det_rotation(sino[, ...])

Correct sinogram data and weights to account for detector rotation.

preprocess.estimate_background_offset(sino)

Estimate background offset of a sinogram using JAX for GPU acceleration.