TIE_params module¶
Class for TIE reconstruction parameters.
A class for holding TIE images and reconstruction parameters. Also has several methods relating to doing the reconstruction, namely making masks and interactively cropping the image stacks.
AUTHOR: Arthur McCray, ANL, Summer 2019
-
class
TIE_params.
TIE_params
(imstack=None, flipstack=[], defvals=None, scale=None, flip=None, data_loc=None, no_mask=False, v=1)[source]¶ Bases:
object
An object for holding the data and parameters for the reconstruction.
Some params will be obtained directly from the metadata, others given by the user. Also holds some other useful values. An instance is created by the load_data() function in TIE_helper.py.
For more information on how to organize the directory and load the data, as well as how to setup the .fls file please refer to the README or the TIE_template.ipynb notebook.
-
imstack
¶ A list of numpy arrays, one per image in the through focus series (tfs).
Type: list
-
flipstack
¶ A list of numpy arrays for the flip tfs if there is one.
Type: list
-
defvals
¶ List of defocus values in nm from least to most defocus. This assumes a symmetric defocus over/under, so expects 2 values for a 5 image tfs.
Type: list
-
flip
¶ Boolean for whether or not to reconstruct using the flip stack. Even if the flip stack exists the reconstruction will only use the unflip stack if self.flip = False.
Type: bool
-
data_loc
¶ String for location of data folder.
Type: str
-
no_mask
¶ Eliminates mask (generally used with simulated data).
Type: bool
-
num_files
¶ Equiv to len(self.imstack)
Type: int
-
shape
¶ Shape of original image data (y, x)
Type: tuple
-
scale
¶ Scale of images (nm/pixel). Taken from the dm3/tif metadata or set manually.
Type: float
-
rotation
¶ The rotation to apply to the image before reconstruction in deg.
Type: float, int
-
x_transl
¶ The x_translation to apply to the image before reconstruction in pix.
Type: int
-
y_transl
¶ The y_translation to apply to the image before reconstruction in pix.
Type: int
-
infocus
¶ Averaged infocus image between unflip and flip stacks. If no flip stack, just unflip infocus image.
Type: 2D array
-
qi
¶ 2D inverse frequency array, possibly modified with Tikhonov filter.
Type: 2D array
-
crop
¶ Region of interest in pixels used to select the are to be reconstructed. Initialized to full image.
Type: dict
-
mask
¶ Binary mask made form all the images. 1 where all images have nonzero data, 0 where any do not. Made by self.make_mask()
Type: 2D array
-
make_mask
(imstack=None, threshold=0)[source]¶ Sets self.mask to be a binary bounding mask from imstack and flipstack.
Makes all images binary using a threshold value, and then multiplies these arrays. Can also take a stack of images that aren’t signal2D.
The inverse Laplacian reconstruction does not deal well with a mask that is all ones, that is accounted for in TIE() function rather than here.
Parameters: - imstack (list) – (optional) List of arrays or Signal2D objects from which to make mask Default will use self.imstack and self.flipstack
- threshold (float) – (optional) Pixel value with which to threshold the images. Default is 0.
Returns: None. Assigns result to self.mask()
-
pre_Lap
(pscope, def_step=1)[source]¶ Scaling prefactor used in the TIE reconstruction.
Parameters: - pscope (
Microscope
object) – Microscope object from microscopes.py - def_step (float) – The defocus value for which is being reconstructed. If using a longitudinal derivative, def_step should be 1.
Returns: Numerical prefactor
Return type: float
- pscope (
-
select_ROI
(infocus=True)[source]¶ Select a rectangular region of interest (ROI) and assign it to ptie.crop
Parameters: infocus (bool, optional) – Whether to select a region from the infocus image. For some datasets the infocus image will have no contrast, and therefore set infocus=False to select a region from the most underfocused image. Defaults to True.
-