PYME.recipes.processing module

Created on Mon May 25 17:15:01 2015

@author: david

class PYME.recipes.processing.AverageFramesByZStep(parent=None, invalidate_parent=True, **kwargs)

Bases: ModuleBase

Averages frames acquired at the same z-position, as determined by the associated events, or (fall-back) metadata.

Parameters
input_imagestring

name of an ImageStack instance, with metadata / events describing which frames were taken at which z-position.

input_zvalsstring

[optional] name of a table mapping frames to z values. If empty, the image events are used.

Returns
outputtraits.Output

ImageStack instance, where frames taken at the same z-position have been averaged together.

input_image = <PYME.recipes.traits.Input object>
input_zvals = <PYME.recipes.traits.Input object>
output = <PYME.recipes.traits.Output object>
run(input_image, input_zvals=None)

OVERRIDE THIS in derived classes to implement module functionality. Parameters are passed in by keyword, and keyword names must be a 1:1 match to the module input traits.

The function should return either a dict (multiple outputs, keyed with output trait keys), or

z_column_name = <PYME.misc.mock_traits.CStr object>
class PYME.recipes.processing.BackgroundSubtractionMovingAverage(parent=None, invalidate_parent=True, **kwargs)

Bases: ModuleBase

Estimates and subtracts the background of a series using a sliding window average on a per-pixel basis.

Parameters
input_nameInput

PYME.IO.ImageStack

window = List

Describes the window, much like range or numpy.arrange, format is [start, finish, stride]

Returns
output_name = Output

PYME.IO.ImageStack of the background-subtracted ‘input_name’ series

Notes

input and output images are the same size.

input_name = <PYME.recipes.traits.Input object>
output_name = <PYME.recipes.traits.Output object>
percentile = 0
run(input_name)

OVERRIDE THIS in derived classes to implement module functionality. Parameters are passed in by keyword, and keyword names must be a 1:1 match to the module input traits.

The function should return either a dict (multiple outputs, keyed with output trait keys), or

window = <PYME.misc.mock_traits.List object>
class PYME.recipes.processing.BackgroundSubtractionMovingPercentile(parent=None, invalidate_parent=True, **kwargs)

Bases: BackgroundSubtractionMovingAverage

Estimates the background of a series using a sliding window and taking an (adjusted) percentile (e.g. median at percentile = 0.5) over that window on a per-pixel basis.

Parameters
input_nameInput

PYME.IO.ImageStack

percentileFloat

Percentile to take as the background after sorting within the time window along each pixel

window = List

Describes the window, much like range or numpy.arrange, format is [start, finish, stride]

Returns
output_name = Output

PYME.IO.ImageStack of the background-subtracted ‘input_name’ series

Notes

The percentile background isn’t a simple percentile, but is adjusted slightly - see PYME.IO.DataSource.BGSDataSource

input and output images are the same size.

percentile = <PYME.misc.mock_traits.Float object>
class PYME.recipes.processing.BinaryDilation(parent=None, invalidate_parent=True, **kwargs)

Bases: Filter

apply_filter(data, voxelsize)
iterations = <PYME.misc.mock_traits.CStr object>
radius = <PYME.misc.mock_traits.Float object>
class PYME.recipes.processing.BinaryErosion(parent=None, invalidate_parent=True, **kwargs)

Bases: Filter

apply_filter(data, voxelsize)
iterations = <PYME.misc.mock_traits.CStr object>
radius = <PYME.misc.mock_traits.Float object>
class PYME.recipes.processing.BinaryFillHoles(parent=None, invalidate_parent=True, **kwargs)

Bases: Filter

apply_filter(data, voxelsize)
radius = <PYME.misc.mock_traits.Float object>
class PYME.recipes.processing.CaWave(wavefronts, intensity, trange, recipe='')

Bases: object

default_recipe = "\n    - processing.OpticalFlow:\n        filterRadius: 10.0\n        inputName: intensity\n        outputNameX: flow_x\n        outputNameY: flow_y\n        regularizationLambda: 0.1\n        supportRadius: 30.0\n    - filters.GaussianFilter:\n        inputName: flow_x\n        outputName: flow_xf\n        processFramesIndividually: false\n        sigmaX: 1.0\n        sigmaY: 1.0\n        sigmaZ: 5.0\n    - filters.GaussianFilter:\n        inputName: flow_y\n        outputName: flow_yf\n        processFramesIndividually: false\n        sigmaX: 1.0\n        sigmaY: 1.0\n        sigmaZ: 5.0\n    - processing.WavefrontVelocity:\n        inputFlowX: flow_xf\n        inputFlowY: flow_yf\n        inputWavefronts: wavefronts\n        outputName: wavefront_velocities\n        timeWindow: 5\n    - measurement.ImageHistogram:\n        inputImage: wavefront_velocities\n        inputMask: wavefronts\n        left: 0.0\n        nbins: 50\n        outputName: velocity_histogram\n        right: 16.0\n        normalize: True\n    - processing.VectorfieldAngle:\n        inputX: flow_xf\n        inputY: flow_yf\n        inputZ: ''\n        outputPhi: phi\n        outputTheta: theta\n    - measurement.ImageHistogram:\n        inputImage: theta\n        inputMask: wavefronts\n        left: -3.15\n        nbins: 120\n        outputName: angle_hist\n        right: 3.15\n        normalize: True\n    "
property direction_data
property direction_plot
property end_frame
property start_frame
property velocity_data
property velocity_image
property velocity_plot
property wavefront_image
class PYME.recipes.processing.Colocalisation(parent=None, invalidate_parent=True, **kwargs)

Bases: ModuleBase

Calculate thresholded manders and Pearsons coefficients

inputImageA = <PYME.recipes.traits.Input object>
inputImageB = <PYME.recipes.traits.Input object>
inputMaskA = <PYME.recipes.traits.Input object>
inputMaskB = <PYME.recipes.traits.Input object>
inputRoiMask = <PYME.recipes.traits.Input object>
outputTable = <PYME.recipes.traits.Output object>
run(inputImageA, inputMaskA, inputImageB, inputMaskB, inputRoiMask=None)

OVERRIDE THIS in derived classes to implement module functionality. Parameters are passed in by keyword, and keyword names must be a 1:1 match to the module input traits.

The function should return either a dict (multiple outputs, keyed with output trait keys), or

class PYME.recipes.processing.ColocalisationEDT(parent=None, invalidate_parent=True, **kwargs)

Bases: ModuleBase

Perform distance-transform based colocalisation of an image with a mask. Returns the relative enrichment, and the total signal contained within a given distance from a mask.

Parameters
inputImagean intensity image
maska mask (usually derived from a different channel)
inputImageB[optional] the intensity image for the channel used to create the mask. If present, this is used to

assess the colocalisation of the mask channel with itself as a control.

outputTabletable into which to save results
minimumDistance, maximumDistance, binSizefloat, nm the range of distances to calculate the histogram over
Returns
outputTablea table containing the following columns:

‘bins’ : the right hand edges of the histogram bins (as suitable for the cdf plots) ‘enrichment’ : the enrichment of the label at a given distance from the mask (when compared to a uniform spatial distribution) ‘enclosed’ : the fraction of the signal enclosed within a given distance from the mask ‘enclosed_area’ : the fraction of the total area enclosed within a given radius. This gives you the curve you

would see if the label was randomly distributed.

‘enrichment_m’ : enrichment of the mask source channel (if provided) at a given distance from the mask. This is a control for the thresholding ‘enclosed_m’ : fraction of mask source channel signal (if provided) within a given distance from the mask. This is a control for the thresholding.

Notes

  • If the input image has multiple colour channels, the 0th channel will be taken (i.e. split channels first)

  • To do colocalisation both ways between two images, you will need two copies of this module

TODO: handle channel names appropriately, support for ROI masks

binSizeNM = <PYME.misc.mock_traits.Float object>
inputImage = <PYME.recipes.traits.Input object>
inputImageB = <PYME.recipes.traits.Input object>
inputMask = <PYME.recipes.traits.Input object>
inputRoiMask = <PYME.recipes.traits.Input object>
maximumDistanceNM = <PYME.misc.mock_traits.Float object>
minimumDistanceNM = <PYME.misc.mock_traits.Float object>
outputPlot = <PYME.recipes.traits.Output object>
outputTable = <PYME.recipes.traits.Output object>
run(inputImage, inputMask, inputImageB=None, inputRoiMask=None)

OVERRIDE THIS in derived classes to implement module functionality. Parameters are passed in by keyword, and keyword names must be a 1:1 match to the module input traits.

The function should return either a dict (multiple outputs, keyed with output trait keys), or

class PYME.recipes.processing.Composite(parent=None, invalidate_parent=True, **kwargs)

Bases: ModuleBase

Combine multiple single-channel images into a multi-channel image. Goes further than base.JoinChannels in that it supports re-scaling to match voxel sizes and optionally shift correction.

input0 is used to set the voxel size, with other images being re-scaled to match

execute(namespace)

takes a namespace (a dictionary like object) from which it reads its inputs and into which it writes outputs

NOTE: This was previously the function to define / override to make a module work. To support automatic metadata propagation and reduce the ammount of boiler plate, new modules should override the run() method instead.

ignoreZOrigin = <PYME.misc.mock_traits.CStr object>
input0 = <PYME.recipes.traits.Input object>
input1 = <PYME.recipes.traits.Input object>
input2 = <PYME.recipes.traits.Input object>
input3 = <PYME.recipes.traits.Input object>
property inputs

Redefine inputs to remove channel suffixes

interpolate = <PYME.misc.mock_traits.CStr object>
output = <PYME.recipes.traits.Output object>
shiftmap0 = <PYME.recipes.traits.FileOrURI object>
shiftmap1 = <PYME.recipes.traits.FileOrURI object>
shiftmap2 = <PYME.recipes.traits.FileOrURI object>
shiftmap3 = <PYME.recipes.traits.FileOrURI object>
class PYME.recipes.processing.DarkAndVarianceMap(parent=None, invalidate_parent=True, **kwargs)

Bases: ModuleBase

blemish_variance = <PYME.misc.mock_traits.Float object>
dark_threshold = <PYME.misc.mock_traits.Float object>
end = <PYME.misc.mock_traits.CStr object>
input = <PYME.recipes.traits.Input object>
output_dark = <PYME.recipes.traits.Output object>
output_variance = <PYME.recipes.traits.Output object>
run(input)

OVERRIDE THIS in derived classes to implement module functionality. Parameters are passed in by keyword, and keyword names must be a 1:1 match to the module input traits.

The function should return either a dict (multiple outputs, keyed with output trait keys), or

start = <PYME.misc.mock_traits.CStr object>
variance_threshold = <PYME.misc.mock_traits.Float object>
class PYME.recipes.processing.Deconvolve(parent=None, invalidate_parent=True, **kwargs)

Bases: Filter

GetDec(dp, vshint)

Get a (potentially cached) deconvolution object

GetPSF(vshint, psfFilename=None)
apply_filter(data, voxelsize)
beadDiameter = <PYME.misc.mock_traits.Float object>
default_traits_view()

This is the traits stock method to specify the default view

dimensionality = <PYME.misc.mock_traits.CStr object>
gaussianFWHM = <PYME.misc.mock_traits.Float object>
iterations = <PYME.misc.mock_traits.CStr object>
lorentzianFWHM = <PYME.misc.mock_traits.Float object>
method = <PYME.misc.mock_traits.CStr object>
offset = <PYME.misc.mock_traits.Float object>
overlap = <PYME.misc.mock_traits.CStr object>
padding = <PYME.misc.mock_traits.CStr object>
psfFilename = <PYME.recipes.processing.PSFFile object>
psfType = <PYME.misc.mock_traits.CStr object>
regularisationLambda = <PYME.misc.mock_traits.Float object>
zPadding = <PYME.misc.mock_traits.CStr object>
class PYME.recipes.processing.DeconvolveMotionCompensating(parent=None, invalidate_parent=True, **kwargs)

Bases: Deconvolve

GetDec(dp, vshint)

Get a (potentially cached) deconvolution object

applyFilter(data, chanNum, frNum, im)
default_traits_view()

This is the traits stock method to specify the default view

flowScale = <PYME.misc.mock_traits.Float object>
inputFlowX = <PYME.recipes.traits.Input object>
inputFlowY = <PYME.recipes.traits.Input object>
method = <PYME.misc.mock_traits.CStr object>
processFramesIndividually = <PYME.misc.mock_traits.CStr object>
run(inputName, inputFlowX, inputFlowY)

OVERRIDE THIS in derived classes to implement module functionality. Parameters are passed in by keyword, and keyword names must be a 1:1 match to the module input traits.

The function should return either a dict (multiple outputs, keyed with output trait keys), or

class PYME.recipes.processing.DirectionToMask3D(parent=None, invalidate_parent=True, **kwargs)

Bases: ModuleBase

Estimates the direction from a pixel to the edge of a mask.

calc_grad(data, chanNum)
inputName = <PYME.recipes.traits.Input object>
kernelSize = <PYME.misc.mock_traits.CStr object>
outputNameX = <PYME.recipes.traits.Output object>
outputNameY = <PYME.recipes.traits.Output object>
outputNameZ = <PYME.recipes.traits.Output object>
run(inputName)

OVERRIDE THIS in derived classes to implement module functionality. Parameters are passed in by keyword, and keyword names must be a 1:1 match to the module input traits.

The function should return either a dict (multiple outputs, keyed with output trait keys), or

class PYME.recipes.processing.DistanceTransform(parent=None, invalidate_parent=True, **kwargs)

Bases: Filter

apply_filter(data, voxelsize)
class PYME.recipes.processing.FindCaWaves(parent=None, invalidate_parent=True, **kwargs)

Bases: ModuleBase

Finds contiguous calcium wave events from detected wavefronts.

inputIntensity = <PYME.recipes.traits.Input object>
inputWavefronts = <PYME.recipes.traits.Input object>
minActivePixels = <PYME.misc.mock_traits.CStr object>
minWaveFrames = <PYME.misc.mock_traits.CStr object>
outputName = <PYME.recipes.traits.Output object>
run(inputWavefronts, inputIntensity)

OVERRIDE THIS in derived classes to implement module functionality. Parameters are passed in by keyword, and keyword names must be a 1:1 match to the module input traits.

The function should return either a dict (multiple outputs, keyed with output trait keys), or

waveRecipeFileName = <PYME.misc.mock_traits.CStr object>
class PYME.recipes.processing.FlatfiledAndDarkCorrect(parent=None, invalidate_parent=True, **kwargs)

Bases: ModuleBase

darkFilename = <PYME.misc.mock_traits.CStr object>
flatfieldFilename = <PYME.misc.mock_traits.CStr object>
inputImage = <PYME.recipes.traits.Input object>
outputName = <PYME.recipes.traits.Output object>
run(inputImage)

OVERRIDE THIS in derived classes to implement module functionality. Parameters are passed in by keyword, and keyword names must be a 1:1 match to the module input traits.

The function should return either a dict (multiple outputs, keyed with output trait keys), or

class PYME.recipes.processing.FractionalThreshold(parent=None, invalidate_parent=True, **kwargs)

Bases: Filter

Chose a threshold such that the given fraction of the total labelling is included in the mask.

apply_filter(data, voxelsize)
fractionThreshold = <PYME.misc.mock_traits.Float object>
class PYME.recipes.processing.Gradient2D(parent=None, invalidate_parent=True, **kwargs)

Bases: ModuleBase

Calculate the gradient along x and y for each channel of an ImageStack

Parameters
inputNamePYME.IO.image.ImageStack

input image

unitsEnum

specify whether to return gradient in units of intensity/pixel or intensity/um. Note that intensity/um will account for anisotropic voxels, while the per pixel in intensity/pixel can be direction dependent.

calc_grad(data, chanNum)
inputName = <PYME.recipes.traits.Input object>
outputNameX = <PYME.recipes.traits.Output object>
outputNameY = <PYME.recipes.traits.Output object>
run(inputName)

OVERRIDE THIS in derived classes to implement module functionality. Parameters are passed in by keyword, and keyword names must be a 1:1 match to the module input traits.

The function should return either a dict (multiple outputs, keyed with output trait keys), or

units = <PYME.misc.mock_traits.CStr object>
class PYME.recipes.processing.Gradient3D(parent=None, invalidate_parent=True, **kwargs)

Bases: ModuleBase

Calculate the gradient along x, y, and z for each channel of an ImageStack

Parameters
inputNamePYME.IO.image.ImageStack

input image

unitsEnum

specify whether to return gradient in units of intensity/pixel or intensity/um. Note that intensity/um will account for anisotropic voxels, while the per pixel in intensity/pixel can be direction dependent.

calc_grad(data, chanNum)
inputName = <PYME.recipes.traits.Input object>
outputNameX = <PYME.recipes.traits.Output object>
outputNameY = <PYME.recipes.traits.Output object>
outputNameZ = <PYME.recipes.traits.Output object>
run(inputName)

OVERRIDE THIS in derived classes to implement module functionality. Parameters are passed in by keyword, and keyword names must be a 1:1 match to the module input traits.

The function should return either a dict (multiple outputs, keyed with output trait keys), or

units = <PYME.misc.mock_traits.CStr object>
class PYME.recipes.processing.GreyDilation(parent=None, invalidate_parent=True, **kwargs)

Bases: Filter

apply_filter(data, voxelsize)
radius = <PYME.misc.mock_traits.Float object>
class PYME.recipes.processing.GreyErosion(parent=None, invalidate_parent=True, **kwargs)

Bases: Filter

apply_filter(data, voxelsize)
radius = <PYME.misc.mock_traits.Float object>
class PYME.recipes.processing.Label(parent=None, invalidate_parent=True, **kwargs)

Bases: Filter

Asigns a unique integer label to each contiguous region in the input mask. Optionally throws away all regions which are smaller than a cutoff size.

NB - minRegionPixels is currently ignored when running chunked

apply_filter(data, voxelsize)
completeMetadata(im)
minRegionPixels = <PYME.misc.mock_traits.CStr object>
run(inputName)

OVERRIDE THIS in derived classes to implement module functionality. Parameters are passed in by keyword, and keyword names must be a 1:1 match to the module input traits.

The function should return either a dict (multiple outputs, keyed with output trait keys), or

class PYME.recipes.processing.LocalMaxima(parent=None, invalidate_parent=True, **kwargs)

Bases: Filter

apply_filter(data, voxelsize)
minDistance = <PYME.misc.mock_traits.CStr object>
threshold = <PYME.misc.mock_traits.Float object>
class PYME.recipes.processing.Offset(parent=None, invalidate_parent=True, **kwargs)

Bases: Filter

Offset the grayscale value by a certain number

Parameters
offset_constanta constant that the image will subtract, float
offset_selectionwhich kind of image offset is set to process
applyFilter(data, chanNum, i, image0)
dimensionality = <PYME.misc.mock_traits.CStr object>
offset_constant = <PYME.misc.mock_traits.Float object>
offset_selection = <PYME.misc.mock_traits.CStr object>
class PYME.recipes.processing.OpticalFlow(parent=None, invalidate_parent=True, **kwargs)

Bases: ModuleBase

calc_flow(data, chanNum)
calc_flow_mp(data, chanNum)
filterRadius = <PYME.misc.mock_traits.Float object>
inputName = <PYME.recipes.traits.Input object>
outputNameX = <PYME.recipes.traits.Output object>
outputNameY = <PYME.recipes.traits.Output object>
regularizationLambda = <PYME.misc.mock_traits.Float object>
run(inputName)

OVERRIDE THIS in derived classes to implement module functionality. Parameters are passed in by keyword, and keyword names must be a 1:1 match to the module input traits.

The function should return either a dict (multiple outputs, keyed with output trait keys), or

supportRadius = <PYME.misc.mock_traits.Float object>
class PYME.recipes.processing.PSFFile(*args, **kwargs)

Bases: FileOrURI

Custom trait that verifies that the file can be loaded as a PSF

info_text = 'a file name for a pyme PSF (.tif or .psf)'
validate(object, name, value)
class PYME.recipes.processing.ProjectOnVector(parent=None, invalidate_parent=True, **kwargs)

Bases: ModuleBase

Project onto a set of direction vectors, producing p and s components

calc_proj(inpX, inpY, dirX, dirY, chanNum)
do_proj(inpX, inpY, dirX, dirY)

project onto basis vectors

inputDirX = <PYME.recipes.traits.Input object>
inputDirY = <PYME.recipes.traits.Input object>
inputX = <PYME.recipes.traits.Input object>
inputY = <PYME.recipes.traits.Input object>
outputNameP = <PYME.recipes.traits.Output object>
outputNameS = <PYME.recipes.traits.Output object>
run(inputX, inputY, inputDirX, inputDirY)

OVERRIDE THIS in derived classes to implement module functionality. Parameters are passed in by keyword, and keyword names must be a 1:1 match to the module input traits.

The function should return either a dict (multiple outputs, keyed with output trait keys), or

class PYME.recipes.processing.Projection(parent=None, invalidate_parent=True, **kwargs)

Bases: Filter

Project image along an axis

TODO - make this more efficient - we currently force the whole stack into memory

NOTE: coloured max returns results encoded as a complex number out = np.max(data, axis) + 1j*np.argmax(data, axis)

apply_filter(data, voxelsize)
axis = <PYME.misc.mock_traits.CStr object>
dimensionality = <PYME.misc.mock_traits.CStr object>
kind = <PYME.misc.mock_traits.CStr object>
class PYME.recipes.processing.RawADUToElectronsPerSecond(parent=None, invalidate_parent=True, **kwargs)

Bases: ModuleBase

Converts and image series from raw analog-digital units [ADU] to photoelectrons per second [e/s]

Parameters
input_nameInput

PYME.IO.ImageStack in units of ADU

Returns
output_nameOutput

PYME.IO.ImageStack in units of photoelectrons/second

Warning

A lot of PYME assumes that image units are in ADUs. This means that it would be easy to end up doing this correction in downstream modules as well as here and ending up with erroneous data as a result. Safe usage of this module in complex workflows will require building enhanced unit awareness into other parts of PYME which is not currently present.

At this point there is not much certainty about how unit awareness should be done, and it is likely to change signficantly from the first attempt here. In practice this means:

  • this should be viewed as experimental

  • before building extensive pipelines that depend on Units metadata, or saving large numbers of files calibrated in e/s please force the issue (through, e.g an issue on github and a discussion) so we can finalise what unit support is going to look like and what metadata should be used).

input_name = <PYME.recipes.traits.Input object>
output_name = <PYME.recipes.traits.Output object>
run(input_name)

OVERRIDE THIS in derived classes to implement module functionality. Parameters are passed in by keyword, and keyword names must be a 1:1 match to the module input traits.

The function should return either a dict (multiple outputs, keyed with output trait keys), or

class PYME.recipes.processing.ResampleZ(parent=None, invalidate_parent=True, **kwargs)

Bases: ModuleBase

Resamples input stack at even intervals along z using a linear interpolation. If the input stack contains multiple frames taken at the same z position, the stack should first be run through AverageFramesByZStep.

Parameters
input: Input

ImageStack instance

z_sampling: Float

Spacing to resample the stack axially, units of micrometers

Returns
output: Output

ImageStack instance

input = <PYME.recipes.traits.Input object>
output = <PYME.recipes.traits.Output object>
run(input)

OVERRIDE THIS in derived classes to implement module functionality. Parameters are passed in by keyword, and keyword names must be a 1:1 match to the module input traits.

The function should return either a dict (multiple outputs, keyed with output trait keys), or

z_sampling = <PYME.misc.mock_traits.Float object>
class PYME.recipes.processing.Rotate180(parent=None, invalidate_parent=True, **kwargs)

Bases: Filter

Rotate the image 180 degrees in x-y

Parameters
input_namePYME.IO.ImageStack
output_namePYME.IO.ImageStack
apply_filter(data, voxelsize)
dimensionality = <PYME.misc.mock_traits.CStr object>
class PYME.recipes.processing.SelectLabel(parent=None, invalidate_parent=True, **kwargs)

Bases: Filter

Creates a mask corresponding to all pixels with the given label

apply_filter(data, voxelsize)
label = <PYME.misc.mock_traits.CStr object>
class PYME.recipes.processing.SelectLargestLabel(parent=None, invalidate_parent=True, **kwargs)

Bases: Filter

Creates a mask corresponding to all pixels with the largest label

NOTE: the input image must be a labeled image (e.g. the output of Processing.Label) in which contiguous areas have unique integer IDs

apply_filter(data, voxelsize)
class PYME.recipes.processing.SimpleThreshold(parent=None, invalidate_parent=True, **kwargs)

Bases: Filter

apply_filter(data, voxelsize)
threshold = <PYME.misc.mock_traits.Float object>
class PYME.recipes.processing.SplineFitBackgroundEstimate(parent=None, invalidate_parent=True, **kwargs)

Bases: Filter

Background subtraction using a 2D smoothing spline fit

Parameters
smoothPositive smoothing factor defined for estimation
apply_filter(data, voxelsize)
dimensionality = <PYME.misc.mock_traits.CStr object>
smooth = <PYME.misc.mock_traits.Float object>
class PYME.recipes.processing.StatisticsByFrame(parent=None, invalidate_parent=True, **kwargs)

Bases: ModuleBase

Iterates through the time/z-position dimension of an ImageStack, calculating basic statistics for each frame, optionally using a 2D or 3D mask in the process.

NOTE: only operates on first colour channel of stack.

Parameters
input_nameInput

PYME.IO.ImageStack

maskInput

PYME.IO.ImageStack. Optional mask to only calculate metrics

Returns
output_name = Output
input_name = <PYME.recipes.traits.Input object>
mask = <PYME.recipes.traits.Input object>
output_name = <PYME.recipes.traits.Output object>
run(input_name, mask=None)

OVERRIDE THIS in derived classes to implement module functionality. Parameters are passed in by keyword, and keyword names must be a 1:1 match to the module input traits.

The function should return either a dict (multiple outputs, keyed with output trait keys), or

class PYME.recipes.processing.Threshold(parent=None, invalidate_parent=True, **kwargs)

Bases: Filter

catch all class for automatic thresholding

apply_filter(data, voxelsize)
bin_spacing = <PYME.misc.mock_traits.CStr object>
method = <PYME.misc.mock_traits.CStr object>
n_histogram_bins = <PYME.misc.mock_traits.CStr object>
class PYME.recipes.processing.VectorfieldAngle(parent=None, invalidate_parent=True, **kwargs)

Bases: ModuleBase

Calculates the angle of a vector field.

Theta is the angle in the x-y plane, and phi is the dip angle

Notes

returns .. math:

sqrt(x*x + y*y + z*z)

Also works for 2D vector fields if inputZ is an empty string.

inputX = <PYME.recipes.traits.Input object>
inputY = <PYME.recipes.traits.Input object>
inputZ = <PYME.recipes.traits.Input object>
outputPhi = <PYME.recipes.traits.Output object>
outputTheta = <PYME.recipes.traits.Output object>
class PYME.recipes.processing.VectorfieldCurl(parent=None, invalidate_parent=True, **kwargs)

Bases: ModuleBase

Calculates the curl of a vector field defined by three inputs.

rac{del F_z}{del y} - rac{del F_y}{del z}, rac{del F_x}{del z} - rac{del F_z}{del x}, rac{del F_y}{del x} - rac{del F_x}{del y})$$

inputX = <PYME.recipes.traits.Input object>
inputY = <PYME.recipes.traits.Input object>
inputZ = <PYME.recipes.traits.Input object>
outputX = <PYME.recipes.traits.Output object>
outputY = <PYME.recipes.traits.Output object>
outputZ = <PYME.recipes.traits.Output object>
run(inputX, inputY, inputZ)

OVERRIDE THIS in derived classes to implement module functionality. Parameters are passed in by keyword, and keyword names must be a 1:1 match to the module input traits.

The function should return either a dict (multiple outputs, keyed with output trait keys), or

class PYME.recipes.processing.VectorfieldNorm(parent=None, invalidate_parent=True, **kwargs)

Bases: ModuleBase

Calculates the norm of a vector field defined by three inputs.

Notes

returns .. math:

sqrt(x*x + y*y + z*z)

Also works for 2D vector fields if inputZ is an empty string.

inputX = <PYME.recipes.traits.Input object>
inputY = <PYME.recipes.traits.Input object>
inputZ = <PYME.recipes.traits.Input object>
outputName = <PYME.recipes.traits.Output object>
run(inputX, inputY, inputZ)

OVERRIDE THIS in derived classes to implement module functionality. Parameters are passed in by keyword, and keyword names must be a 1:1 match to the module input traits.

The function should return either a dict (multiple outputs, keyed with output trait keys), or

class PYME.recipes.processing.Watershed(parent=None, invalidate_parent=True, **kwargs)

Bases: ModuleBase

Module with one image input and one image output

filter(image, markers, mask=None)
inputImage = <PYME.recipes.traits.Input object>
inputMarkers = <PYME.recipes.traits.Input object>
inputMask = <PYME.recipes.traits.Input object>
outputName = <PYME.recipes.traits.Output object>
processFramesIndividually = <PYME.misc.mock_traits.CStr object>
run(inputImage, inputMarkers, inputMask=None)

OVERRIDE THIS in derived classes to implement module functionality. Parameters are passed in by keyword, and keyword names must be a 1:1 match to the module input traits.

The function should return either a dict (multiple outputs, keyed with output trait keys), or

class PYME.recipes.processing.WavefrontDetection(parent=None, invalidate_parent=True, **kwargs)

Bases: ModuleBase

Detect Ca2+ wavefronts by looking at the difference images between two consecutive frames.

Wavefront position corresponds to the position of the transient maximum (i.e. the zero-crossing in the temporal derivative), detected by finding all pixels where the magnitude of the temporal derivative is less than gradientThreshold. An intensity threshold is also used to reject areas of the image where temporal changes are due to noise alone.

Works best on low-pass filtered data.

gradientThreshold = <PYME.misc.mock_traits.Float object>
inputName = <PYME.recipes.traits.Input object>
intensityThreshold = <PYME.misc.mock_traits.Float object>
outputName = <PYME.recipes.traits.Output object>
run(inputName)

OVERRIDE THIS in derived classes to implement module functionality. Parameters are passed in by keyword, and keyword names must be a 1:1 match to the module input traits.

The function should return either a dict (multiple outputs, keyed with output trait keys), or

class PYME.recipes.processing.WavefrontVelocity(parent=None, invalidate_parent=True, **kwargs)

Bases: ModuleBase

Calculates wavefront velocity given a wavefront image and optic flow images

inputFlowX = <PYME.recipes.traits.Input object>
inputFlowY = <PYME.recipes.traits.Input object>
inputWavefronts = <PYME.recipes.traits.Input object>
outputName = <PYME.recipes.traits.Output object>
run(inputWavefronts, inputFlowX, inputFlowY)

OVERRIDE THIS in derived classes to implement module functionality. Parameters are passed in by keyword, and keyword names must be a 1:1 match to the module input traits.

The function should return either a dict (multiple outputs, keyed with output trait keys), or

timeWindow = <PYME.misc.mock_traits.CStr object>
class PYME.recipes.processing.WhiteTophat(parent=None, invalidate_parent=True, **kwargs)

Bases: Filter

apply_filter(data, voxelsize)
radius = <PYME.misc.mock_traits.Float object>
PYME.recipes.processing.run(self, inputX, inputY, inputZ)