ImageD11.sinograms.roi_iradon module#

This code came from skimage.transform and then was modified

  • Added mask ROI for back projection. Optimisation for small grains in big maps. Should allow threading (one thread per tile)

  • Added projection shifts (sinogram shaped array of dty shifts). Should work the same way for both forward and back projection. Probably only for small offsets

ImageD11.sinograms.roi_iradon.apply_halfmask_to_sino(sino, axis_row=None, real_mask=None)#

Weight a half-scan sinogram before reconstruction.

In a half scan the dty range covers the rotation axis and one side of the sample only, with omega over 360 degrees. Every point off the axis is then seen at half the omega values, which is a complete half turn and enough to reconstruct. A point on the axis has dty = y0 at every omega, so it is measured twice and needs weight 0.5; the unmeasured side is padded data and gets weight 0.

sino : (ny, nangles), dty along the first axis axis_row : index of the rotation axis row. Defaults to len(sino) // 2, which is

where correct_bins_for_half_scan puts it.

real_maskoptional bool array over the ny rows, True on measured bins

(ds.ybin_real_mask). Used to decide which side was scanned. If not given, the side holding more signal is used.

ImageD11.sinograms.roi_iradon.correct_recon_central_zingers(recon, radius=25)#
ImageD11.sinograms.roi_iradon.fxyrot(colrow, angle=0, center=0, projection_shifts=None)#
ImageD11.sinograms.roi_iradon.iradon(radon_image, theta, output_size=None, filter_name='ramp', interpolation='linear', projection_shifts=None, mask=None, workers=1)#

Inverse radon transform. From skimage.transform. Simplified then ruined.

  • allow projection offset/shifts to be used

    1D = constant offset for this projection (why?) 2D = offset versus dty for this projection

  • allow a mask to be used for roi reconstruction

  • run over several threads (each one doing a different roi)

ImageD11.sinograms.roi_iradon.mlem(sino, theta, startvalue=1, projection_shifts=None, output_size=None, mask=None, workers=1, niter=50, divtol=1e-05)#

# Also called “MART” for Multiplicative ART # This keeps a positivity constraint for both the data and reconstruction # # This implementation was inspired from from: # https://www.youtube.com/watch?v=IhETD4nSJec # by Andrew Reader # # ToDo : implement a mask # ToDo : check about the corners / circle=False aspects #

An “MLEM” algorithm from XRDUA was used in this paper:

“Impurity precipitation in atomized particles evidenced by nano x-ray diffraction computed tomography” Anne Bonnin; Jonathan P. Wright; Remi Tucoulou; Herve Palancher Appl. Phys. Lett. 105, 084103 (2014) https://doi.org/10.1063/1.4894009

This python code implements something similar based on a youtube video (https://www.youtube.com/watch?v=IhETD4nSJec)

There are lots of papers from mathematicians in the literature about MART (multiplicative ART). The conversion of latex algebra back and forth into computer code seems to be a bit of a problem for me (Jon Wright - Nov 2023).

ImageD11.sinograms.roi_iradon.radon(image, theta, output_size=None, projection_shifts=None, mask=None, workers=1)#

From skimage.transform. Modified to have projection shifts and roi to match the masked iradon here. And spread theta over threads.

Calculates the radon transform of an image given specified projection angles.

Parameters:
  • image (array_like) – Input image. The rotation axis will be located in the pixel with indices (image.shape[0] // 2, image.shape[1] // 2).

  • theta (array_like) – Projection angles (in degrees).

  • output_size (shape of the output sinogram. Matches [:, len(theta)])

Returns:

radon_image – Radon transform (sinogram). The tomography rotation axis will lie at the pixel index radon_image.shape[0] // 2 along the 0th dimension of radon_image.

Return type:

ndarray

References

Notes

Based on code of Justin K. Romberg (https://www.clear.rice.edu/elec431/projects96/DSP/bpanalysis.html)

ImageD11.sinograms.roi_iradon.recon_cens(omega, dty, ybins, imsize, wt, y0=0.0)#

Back project the peak centers into a map

omega, dty = peak co-ordinates in the sinogram (degrees) ybins = spatial binning. Usually dataset.ybincens imsize = probably len(ybins)+1 wt = intensity, probably ones()

see test/silicon/check_centers.ipynb

ImageD11.sinograms.roi_iradon.run_iradon(sino, angles, pad=20, shift=0, workers=1, mask=None, apply_halfmask=False, mask_central_zingers=False, central_mask_radius=25, filter_name='hamming')#

Applies an iradon to a sinogram, with an optional pad Calculates scaled-up output size from pad value Applies projection shifts of shift Optionally mask the returned reconstruction with sample_mask Optionally apply halfmask to correct artifacts with half-scans (from -ny to 0 rather than -ny/2 to +ny/2 Optionally apply a circular median filter mask to the center of the reconstruction given a radius in central_mask_radius

ImageD11.sinograms.roi_iradon.run_mlem(sino, angles, mask=None, pad=20, shift=0, workers=1, niter=20, apply_halfmask=False, mask_central_zingers=False, central_mask_radius=25)#

Applies an MLEM reconstruction to a sinogram, with an optional pad Calculates scaled-up output size from pad value Applies projection shifts of shift Optionally mask the returned reconstruction with sample_mask Optionally apply halfmask to correct artifacts with half-scans (from -ny to 0 rather than -ny/2 to +ny/2 Optionally apply a circular median filter mask to the center of the reconstruction given a radius in central_mask_radius