vamtoolbox.geometry#
Module Contents#
Classes#
Functions#
|
|
|
Load saved vamtoolbox.geometry.Volume object |
|
Generates a boolean mask of the inscribed circle of a square array |
|
Gets gel and void indices of the boolean target array |
|
Rebins a parallel ray projection geometry (telecentric) to a converging fan beam projection geometry that can be used when the photopolymer vial is NOT indexed matched to its surrounding, i.e. when the projector light is directly incident on the outer wall of the vial at an air-vial interface. |
- vamtoolbox.geometry.defaultKwargs(**default_kwargs)#
- class vamtoolbox.geometry.ProjectionGeometry(angles, ray_type, CUDA=False, **kwargs)#
- calcZeroDoseSinogram(A, target_geo)#
- calcAbsorptionMask(target_geo)#
- class vamtoolbox.geometry.Volume(array: numpy.ndarray, proj_geo: ProjectionGeometry = None, options=None, **kwargs)#
- segmentZ(slices)#
Segment volume object by chosen z slices. Modifies the array attribute of the volume object.
- Parameters:
slices (int or list) – index of the slice or slices to keep
Examples
Keep z slices between and including 1 and 10
>>> vol.segmentZ([1,10])
Keep single z slice at index 10, converts volume object to 2D
>>> vol.segmentZ(10)
- save(name: str)#
Save geometry object
- show(savepath=None, dpi='figure', transparent=False, **kwargs)#
- Parameters:
savepath (str, optional) –
dpi (int, optional) – image dots per inch from matplotlib.pyplot.savefig
transparent (bool, optional) –
sets transparency of the axes patch matplotlib.pyplot.savefig
**kwargs – accepts matplotlib.pyplot.imshow keyword arguments
- constructCoordGrid(spatial_sampling_rate=None, device=None)#
Get coordinate grid centered around the object (target/recon) in physical length unit using spatial_sampling_rate. Unit of spatial_samplign_rate is voxel/cm
- constructCoordVec(spatial_sampling_rate=None, device=None)#
Get coordinate vectors centered around the object (target/recon) in physical length unit using spatial_sampling_rate. Unit of spatial_samplign_rate is voxel/cm
- class vamtoolbox.geometry.TargetGeometry(target=None, stlfilename=None, resolution=None, imagefilename=None, pixels=None, rot_angles=[0, 0, 0], bodies='all', binarize_image=True, clip_to_circle=True, options=None)#
Bases:
Volume- segmentZ(slices)#
Segment target geometry by chosen z slices. Modifies the array and insert attributes of the target geometry.
- Parameters:
slices (int or list) – index of the slice or slices to keep
Examples
Keep z slices between and including 1 and 10
>>> target_geo.segmentZ([1,10])
Keep single z slice at index 10, converts target_geo to 2D
>>> target_geo.segmentZ(10)
- show(show_bodies=False, savepath=None, dpi='figure', transparent=False, **kwargs)#
- Parameters:
savepath (str, optional) –
dpi (int, optional) –
image dots per inch from matplotlib.pyplot.savefig
transparent (bool, optional) –
sets transparency of the axes patch matplotlib.pyplot.savefig
**kwargs –
accepts matplotlib.pyplot.imshow keyword arguments
- class vamtoolbox.geometry.Sinogram(sinogram: numpy.ndarray, proj_geo: ProjectionGeometry, options=None)#
Bases:
Volume
- class vamtoolbox.geometry.Reconstruction(reconstruction: numpy.ndarray, proj_geo: ProjectionGeometry, options=None)#
Bases:
Volume
- vamtoolbox.geometry.loadVolume(file_name: str)#
Load saved vamtoolbox.geometry.Volume object
- Parameters:
file_name (str) – filepath to Volume object e.g. “C:\A\sinogram.sino”
- Return type:
- vamtoolbox.geometry.getCircleMask(target: numpy.ndarray)#
Generates a boolean mask of the inscribed circle of a square array
- Parameters:
target (np.ndarray) – square array to create a boolean mask
- Returns:
boolean mask where inscribed circle is True, outside the circle is False
- Return type:
circle_mask
- vamtoolbox.geometry.getInds(target: numpy.ndarray)#
Gets gel and void indices of the boolean target array
- Parameters:
target (np.ndarray) – binary target array
- Returns:
gel_inds, void_inds – boolean arrays where the target is 1 (gel_inds) and where the target is 0 (void_inds)
- Return type:
np.ndarray
- vamtoolbox.geometry.rebinFanBeam(sinogram, vial_width, N_screen, n_write, throw_ratio)#
Rebins a parallel ray projection geometry (telecentric) to a converging fan beam projection geometry that can be used when the photopolymer vial is NOT indexed matched to its surrounding, i.e. when the projector light is directly incident on the outer wall of the vial at an air-vial interface.
- Parameters:
sinogram (geometry.Sinogram) – sinogram generated for parallel ray geometry that is to be rebinned for use in a non telecentric VAM geometry
vial_width (int) – Apparent vial width in projector pixels. Apparent vial width is only equal to true vial width if projection is telecentric.
N_screen (tuple) – (N_U,N_v), (# of pixels in u-axis, # of pixels in v-axis) of the projected screen
n_write (float) – refractive index at the wavelength used for writing (projector wavelength)
throw_ratio (float) – Throw ratio of projector
- Return type:
Rebinned sinogram in geometry.Sinogram object
Based on code by @author: Antony Orth
Antony Orth, Kathleen L. Sampson, Kayley Ting, Jonathan Boisvert, and Chantal Paquet, “Correcting ray distortion in tomographic additive manufacturing,” Opt. Express 29, 11037-11054 (2021)
Please use the above citation if used in your work.
Note The resampling process can be thought of as a resampling from the parallel beam case to the non-parallel beam case (ie. virtual projector to physical projector), where refraction alters the tranjectory of the rays in the vial. The basic idea is to consider that the physical projector should sample Radon space (virtual projector space) at the appropriate coordinates in the virtual projector space. In other words, each pixel on the physical projector at each instant in time, corresponds to a particular position in Radon space. The correspondence is calculated with the equations for xv and thetav in the paper above. The desired object is Radon transformed (corresponding to the virtual projector space) and then resampled in the altered space that is accessible by the physical projector.
In the paper above, the process is described as a resampling from the physical projector space to the virtual projector space. However, it makes more sense to think of it the other way around (virtual to physical). This may be addressed by a correction to the paper above in the near future (as of 18 Jan 2022).