PYME.LMVis.Extras.multiviewMapping module

PYME.LMVis.Extras.multiviewMapping.Plug(visFr)

Plugs this module into the gui

class PYME.LMVis.Extras.multiviewMapping.multiviewMapper(visFr)

multiviewMapper provides methods for registering multiview channels as acquired in multicolor or biplane imaging. Image frames for multiview data should have channels concatenated horizontally, such that the x-dimension is the only dimension that needs to be folded into the first channel. The shiftmaps are functions that interface like bivariate splines, but can be recreated from a dictionary of their fit-model parameters, which are stored in a dictionary in the shiftmap object. In the multiviewMapper class, shiftmaps for multiview data sources are stored in a dictionary of dictionaries. Each shiftmap is stored as a dictionary so that it can be easily written into a human-readable json file.

Methods

OnCalibrateShifts(event) Generates multiview shiftmaps on bead-data.
OnCheckAstigCalibration([event]) For use with dyes on a coverslip.
OnCorrectFolded([event]) Applies chromatic shift correction to folded localization data that was acquired with an image splitting device, but localized without splitter awareness.
OnFindClumps([event]) Determines which localizations are likely to be the same molecule and assigns them the same label.
OnFold([event]) See multiview.foldX.
OnMapZ([event, useMD]) Uses sigmax and sigmay values from astigmatic fits to look up a z-position using calibration curves.
OnMergeClumps([event]) Coalesces clusters of localization data considered to be the same molecule.
OnCalibrateShifts(event)

Generates multiview shiftmaps on bead-data. Only beads which show up in all channels are used to generate the shiftmap.

Parameters:searchRadius: Radius within which to clump bead localizations that appear in all channels. Units of pixels.
OnCheckAstigCalibration(event=None)

For use with dyes on a coverslip. NB localizations from transient frames should be filtered prior to calling this function

Parameters:event: GUI event
OnCorrectFolded(event=None)

Applies chromatic shift correction to folded localization data that was acquired with an image splitting device, but localized without splitter awareness. See recipes.localizations.MultiviewShiftCorrect.

Parameters:None
OnFindClumps(event=None)

Determines which localizations are likely to be the same molecule and assigns them the same label.

Parameters:

gap_tolerance: number of frames acceptable for a molecule to go MIA and still be called the same molecule

when it returns

radius_scale: multiplicative factor applied to the error_x term in deciding search radius for pairing radius_offset: term added to radius_scale*error_x to set search radius probeAwareClumping: boolean flag to tell FindClumps recipe module to cluster each probe separately

OnFold(event=None)

See multiview.foldX. At this point the origin of x should be the corner of the concatenated frame. Note that a probe key will be mapped into the data source to designate colour channel, but the colour channel will not be selectable in the GUI until after mergeClumps is called (due to the possibility of using this module with ratio-metric data).

Parameters:None, but requires metadata.
OnMapZ(event=None, useMD=True)

Uses sigmax and sigmay values from astigmatic fits to look up a z-position using calibration curves. See Analysis.points.astigmatism.astigTools.lookup_astig_z

Parameters:None
OnMergeClumps(event=None)

Coalesces clusters of localization data considered to be the same molecule. See recipes.localizations.MergeClumps. Additionally, this function updates the colour filter after the merge, and updates the GUI to allow for selecting individual colour channels.

Parameters:None
PYME.LMVis.Extras.multiviewMapping.pairMolecules(tIndex, x, y, whichChan, deltaX=[None], appearIn=array([0, 1, 2, 3]), nFrameSep=5, returnPaired=True)

pairMolecules uses pyDeClump functions to group localization clumps into molecules for registration.

Args:

tIndex: from fitResults x: x positions of localizations AFTER having been folded into the first channel y: y positions of localizations whichChan: a vector containing channel assignments for each localization deltaX: distance within which neighbors will be clumped is set by 2*deltaX[i])**2 appearIn: a clump must have localizations in each of these channels in order to be a keep-clump nFrameSep: number of frames a molecule is allowed to blink off and still be clumped as the same molecule returnPaired: boolean flag to return a boolean array where True indicates that the molecule is a member of a

clump whose members span the appearIn channels.
Returns:
assigned: clump assignments for each localization. Note that molecules whose whichChan entry is set to a
negative value will not be clumped, i.e. they will have a unique value in assigned.

keep: a boolean vector encoding which molecules are in kept clumps Note that outputs are of length #molecules, and the keep vector that is returned needs to be applied as: xkept = x[keep] in order to only look at kept molecules.

PYME.LMVis.Extras.multiviewMapping.plotFolded(X, Y, multiviewChannels, title='')

Plots localizations with color based on multiview channel Args:

X: array of localization x-positions Y: array of localization y-positions multiviewChannels: array of channel assignment of localizations title: title of plot

Returns: nothing