PYME.Analysis.splitting module

Takes the analysis part of spltter.py from PYMEAcquire.

Functions for unmixing and unsplitting multichannel data that has been acquired using an image splitting device which splits the channels onto a single camera.

PYME.Analysis.splitting.LoadShiftField(filename=None)
class PYME.Analysis.splitting.ShiftCorrector(shiftfield=None)

Bases: object

Nearest pixel shift correction for a single channel.

correct(data, voxelsize, origin_nm=None)

Correct a single channel of data for chromatic shift.

set_shiftfield(shiftfield)
class PYME.Analysis.splitting.SplittingInfo(mdh=None, data_shape=None, ROI=None, chanROIs=None, flip=False)

Bases: object

Common class which captures all the splitter ROI information

Uses the metadata if available, otherwise falls back to legacy defaults. Gives priority to Splitter.Channel0ROI and Splitter.Channel1ROI, but uses Multiview metadata if present.

Note that the flip parameter is ignored if there is metadata

property channel_rois
property channel_shape
property num_chans
class PYME.Analysis.splitting.Unmixer(shiftfield=None, pixelsize=70.0, flip=True, axis='up_down', chanROIs=None)

Bases: object

SetShiftField(shiftField, scope=None)
Unmix(data, mixMatrix, offset, ROI=[0, 0, 512, 512])

Extract channels and do linear unmixing.

TODO - separate out the channel extraction, shift correction and unmixing steps.

PYME.Analysis.splitting.get_channel(data, splitting_info: SplittingInfo, chan=0)

Extract a channel from an image which has been recorded using an image splitting device.

Parameters
dataarray_like (2D)

The image data to extract the channel from.

ROIarray_like (4 elements)

The region of interest which was used to acquire the data. Channel ROIs are speficied with respect to the full chip, so we need to correct for any acquisition ROI.

flipOne of False, ‘left_right’, or ‘up_down’

Whether, and in which direction to flip the channel data. This is necessary if the channel was flipped by the splitter.

chanROIsarray_like (Nx4 elements)

The ROIs on the unclipped sensor corresponding to the individual channels. Each ROI is a 4-tuple of (x,y,w,h) where x and y are the ROI origin (0-indexed) and w, h are the width and height of the ROI.

chanint

The index of the channel to extract.

chanShapearray_like (2 elements)

Used to specify the shape of the extracted data if it should be smaller than provided for by the chanROIs spec. This can be indicated if an acquisition ROI has cropped one or more of the channels (i.e. to specify the shape of the largest common ROI between channels). TODO - move the logic for determining this in here??