Process
- class celltk.process.Process(output='process', **kwargs)
- Parameters
output (
str
, default:'process'
) –
- align_by_cross_correlation(image=(), mask=(), align_with='image', crop=True, normalization='phase')
Uses phase cross-correlation to shift the images to align them. Optionally can crop the images to align. Align with can be used to specify which of the inputs to use. Uses the first stack in the given list.
- Parameters
image (
Image
, default:()
) – List of image stacks to be aligned.mask (
Mask
, default:()
) – List of mask stacks to be aligned.align_with (
str
, default:'image'
) – Can be one of ‘image’, ‘mask’, or ‘track’. Defines which of the input stacks should be used for alignment.crop (
bool
, default:True
) – If True, the aligned stacks are cropped based on the largest frame to frame shifts.normalization (
str
, default:'phase'
) –
- Return type
Stack
- Returns
Aligned input stack.
- Raises
AssertionError – If input stacks have different shapes.
- apply_log_bias_field(image, bias_field)
Applies a log bias field (for example, calculated using N4 bias illumination correction) to the input image.
- Parameters
image (
Image
) –bias_field (
Image
) –
- Return type
Image
- binomial_blur(image, iterations=7)
Applies a binomial blur to the image.
- Parameters
image (
Image
) –iterations (
int
, default:7
) –
- Return type
Image
- crop_to_area(images=(), masks=(), crop_factor=0.6)
Crops provided images to a specifc area set by crop_factor.
- Parameters
images (
Image
[Optional
], default:()
) –masks (
Mask
[Optional
], default:()
) –crop_factor (
float
, default:0.6
) –
- Return type
Stack
- Returns
- curvature_anisotropic_diffusion(image, iterations=5, time_step=0.125, conductance=1.0)
Applies curvature anisotropic diffusion blurring to the image. Useful for smoothing out noise, while preserving the edges of objects.
- Parameters
image (
Image
) –iterations (
int
, default:5
) –time_step (
float
, default:0.125
) –conductance (
float
, default:1.0
) –
- Return type
Image
- gaussian_filter(image, sigma=2.5, dtype=<class 'numpy.float32'>)
Applies a multidimensional Gaussian filter to the image.
- Parameters
image (
Image
) –sigma (
float
, default:2.5
) –dtype (
type
, default:<class 'numpy.float32'>
) –
- Return type
Image
- Returns
- gaussian_laplace_filter(image, sigma=2.5)
Multidimensional Laplace filter using Gaussian second derivatives.
- Parameters
image (
Image
) –sigma (
float
, default:2.5
) –
- Return type
Image
- histogram_matching(image, bins=1000, match_pts=100, threshold=False, ref_frame=0)
Rescales input image frames to match the intensity of a reference image. By default, the reference image is the first frame of the input image stack.
- Parameters
image (
Image
) –bins (
int
, default:1000
) –match_pts (
int
, default:100
) –threshold (
bool
, default:False
) –ref_frame (
int
, default:0
) –
- Return type
Image
- inverse_gaussian_gradient(image, alpha=100.0, sigma=5.0)
Calculates gradients and inverts them on the range [0, 1], such that pixels close to borders have values close to 0, while all other pixels have values close to 1.
- Parameters
image (
Image
) –alpha (
float
, default:100.0
) –sigma (
float
, default:5.0
) –
- Return type
Image
- make_edge_potential_image(image, method='sigmoid', alpha=None, beta=None, k1=None, k2=None)
Calculates an edge potential image from images with edges highlighted. An edge potential image has values close to 0 at edges, and values close to 1 else where. The quality of the edge potential image depends highly on the input image and the function/parameters used. The default function is ‘sigmoid’, which accepts two parameters to define the sigmoid function, alpha and beta. If you don’t already know good values, heuristics can be used to estimate alpha and beta based on the minimum value along an edge (k1) and the average value away from an edge (k2). If no parameters are supplied, this function will attempt to guess.
- Parameters
image (
Image
) –method (
str
, default:'sigmoid'
) –alpha (
Optional
[float
], default:None
) –beta (
Optional
[float
], default:None
) –k1 (
Optional
[float
], default:None
) –k2 (
Optional
[float
], default:None
) –
- Return type
Image
- make_maurer_distance_map(image, value_range=None, inside_positive=False, use_euclidian=False, use_image_spacing=False)
Applies a filter to calculate the distance map of a binary image with objects. The distance inside objects is negative.
- Parameters
image (
Image
) –value_range (
Optional
[Collection
[float
]], default:None
) –inside_positive (
bool
, default:False
) –use_euclidean –
use_image_spacing (
bool
, default:False
) –use_euclidian (
bool
, default:False
) –
- Return type
Image
- n4_illumination_bias_correction(image, mask=None, iterations=50, num_points=4, histogram_bins=200, spline_order=3, subsample_factor=1, save_bias_field=False)
Applies N4 bias field correction to the image. Can optionally return the calculated log bias field, which can be applied to the image with
Process.apply_log_bias_field
.- Parameters
image (
Image
) –mask (
Optional
[Mask
], default:None
) –iterations (
Collection
[int
], default:50
) –num_points (
Collection
[int
], default:4
) –histogram_bins (
int
, default:200
) –spline_order (
int
, default:3
) –subsample_factor (
int
, default:1
) – Amount to shrink image before calculating log_bias_field. Speeds up calculation.save_bias_field (
bool
, default:False
) – If True, returns calculated log bias field instead of corrected image.
- Return type
Image
- recurssive_gauss_gradient(image, sigma=1.0, use_direction=True)
Applies recursive Gaussian filters to detect edges.
- Parameters
image (
Image
) –sigma (
float
, default:1.0
) –use_direction (
bool
, default:True
) –
- Return type
Image
- recurssive_gauss_magnitude(image, sigma=1.0)
Applies recursive Gaussian filters to detect edges and returns the gradient magnitude at each pixel.
- Parameters
image (
Image
) –sigma (
float
, default:1.0
) –
- Return type
Image
- roberts_edge_detection(image)
Applies Roberts filter for edge detection.
- Parameters
image (
Image
) –- Return type
Image
- rolling_ball_background_subtract(image, radius=100, kernel=None, nansafe=False, return_bg=False)
Estimate background intensity by rolling/translating a kernel, and subtract from the input image.
- Parameters
image (
Image
) –radius (
float
, default:100
) –kernel (
Optional
[ndarray
], default:None
) –nansafe (
bool
, default:False
) –return_bg (
bool
, default:False
) – If True, returns background instead of image with background subtracted.
- Return type
Image
- sobel_edge_detection(image, orientation='both')
Applies Sobel filter for edge detection. Can detect edges in only one dimension by using the orientation argument.
- Parameters
image (
Image
) –orientation (
str
, default:'both'
) –
- Return type
Image
- sobel_edge_magnitude(image)
Similar to
Process.sobel_edge_detection
, but returns the magnitude of the gradient at each pixel, without regard for direction.- Parameters
image (
Image
) –- Return type
Image
- tile_images(image=(), mask=(), layout=None, border_value=0.0)
Tiles image stacks side by side to produced a single image. Attempts to do some rescaling to match intensities first, but likely will not produce good results for images with large differences in intensity.
- Parameters
image (
Image
[Optional
], default:()
) – List of image stacks to be tiled.mask (
Mask
[Optional
], default:()
) – List of mask stacks to be tiled.layout (
Optional
[Tuple
[int
]], default:None
) –border_value (
Union
[int
,float
], default:0.0
) – Value of the default pixels.
- Return type
Image
- unet_predict(image, weight_path, roi=2, batch=None, classes=3)
Uses a UNet-based neural net to predict the label of each pixel in the input image. This function returns the probability of a specific region of interest, not a labeled mask.
- Parameters
image (
Image
) –weight_path (
str
) –roi (
Union
[int
,str
], default:2
) –batch (
Optional
[int
], default:None
) –classes (
int
, default:3
) –
- Return type
Image
- Returns
- uniform_filter(image, size=3, mode='reflect', cval=0)
Applies a multidimensional uniform filter to the input image.
- Parameters
image (
Image
) –size (
int
, default:3
) –mode (
str
, default:'reflect'
) –cval (
int
, default:0
) –
- Return type
Image
- wavelet_background_subtract(image, wavelet='db4', mode='symmetric', level=None, blur=False, return_bg=False)
Uses discrete wavelet transformation to estimate and remove the background from an image.
- Parameters
image (
Image
) –wavelet (
str
, default:'db4'
) –mode (
str
, default:'symmetric'
) –level (
Optional
[int
], default:None
) –blur (
bool
, default:False
) –return_bg (
bool
, default:False
) – If True, returns estimated background, instead of image with background subtracted.
- Return type
Image
- wavelet_noise_subtract(image, noise_level=1, thres=2, wavelet='db1', mode='smooth', level=None)
Uses discrete wavelet transformation to estimate and remove noise from an image.
- Parameters
image (
Image
) –noise_level (
int
, default:1
) –thres (
int
, default:2
) –wavelet (
str
, default:'db1'
) –mode (
str
, default:'smooth'
) –level (
Optional
[int
], default:None
) –
- Return type
Image