PYME.Analysis.tile_pyramid module

class PYME.Analysis.tile_pyramid.CacheEntry(data, saved)

Bases: tuple

Create new instance of CacheEntry(data, saved)

data

Alias for field number 0

saved

Alias for field number 1

class PYME.Analysis.tile_pyramid.ClusterPZFTileCache(max_size=1000)

Bases: TileCache

class PYME.Analysis.tile_pyramid.ClusterPZFTileIO(base_dir, suff='img')

Bases: PZFTileIO

class PYME.Analysis.tile_pyramid.ImagePyramid(storage_directory, pyramid_tile_size=256, mdh=None, n_tiles_x=0, n_tiles_y=0, depth=0, x0=0, y0=0, pixel_size=1, backend=<class 'PYME.Analysis.tile_pyramid.PZFTileIO'>)

Bases: object

finish_base_tiles()
classmethod frame_weights(frame_shape)
get_layer_tile_coords(level)
get_oversize_tile(layer, x, y, span=2)

Get an over-sized tile - allows processing on overlapping tiles

Parameters
span: size of tile as a multiple of the underlying tile size
get_tile(layer, x, y)
property layers
classmethod load_existing(storage_directory)

loads an ImagePyramid from a given directory.

Parameters
storage_directorystr

root directory of an ImagePyramid instance.

Returns
ImagePyramid

based on storage_directory contents.

property mdh
ndim = 2
update_base_tile(tile_x, tile_y, data, weights, tile_offset=(0, 0), frame_offset=(0, 0), frame_shape=None)
update_base_tiles_from_frame(x, y, frame, weights='auto')

add tile to the pyramid

Parameters
xint

x origin of the tile (frame), relative to minimum x position of all tiles, in units of pixels

yint

y origin of the tile (frame), relative to minimum y position of all tiles, in units of pixels

framendarray

the tile frame to add

weightsndarray

weights for averaging with overlapping base tiles

update_pyramid()
class PYME.Analysis.tile_pyramid.NumpyTileIO(base_dir, suff='img')

Bases: TileIO

delete_tile(layer, x, y)
flush()
get_layer_tile_coords(layer=0)
get_tile(layer, x, y)
save_tile(layer, x, y, data)
tile_exists(layer, x, y)
class PYME.Analysis.tile_pyramid.PZFTileCache(max_size=1000)

Bases: TileCache

class PYME.Analysis.tile_pyramid.PZFTileIO(base_dir, suff='img', tile_cache=<class 'PYME.Analysis.tile_pyramid.PZFTileCache'>)

Bases: NumpyTileIO

class PYME.Analysis.tile_pyramid.PyramidLayer(pyramid, layer)

Bases: object

A layer of and ImagePyramid, implements an array-like interface to the tiles within the layer

dtype

alias of float32

ndim = 5
property shape
class PYME.Analysis.tile_pyramid.SqliteTileIO(base_dir, suff='img')

Bases: TileIO

delete_tile(layer, x, y)
flush()
get_layer_tile_coords(layer=0)
get_tile(layer, x, y)
save_tile(layer, x, y, data)
tile_exists(layer, x, y)
class PYME.Analysis.tile_pyramid.TileCache(max_size=1000)

Bases: object

exists(filename)
flush()
load(filename)
purge()
remove(filename)
save(filename, data)
class PYME.Analysis.tile_pyramid.TileIO

Bases: object

delete_tile(layer, x, y)
flush()
get_layer_tile_coords(layer)
get_tile(layer, x, y)
save_tile(layer, x, y, data)
tile_exists(layer, x, y)
PYME.Analysis.tile_pyramid.atleast_nd(a, n)
PYME.Analysis.tile_pyramid.blob(data)
PYME.Analysis.tile_pyramid.create_pyramid_from_dataset(filename, outdir, tile_size=128, **kwargs)
PYME.Analysis.tile_pyramid.get_position_from_events(events, mdh)

Use acquisition events to create a mapping between frame number and stage position

PYME.Analysis.tile_pyramid.infer_tileio_backend(base_directory)

find TileIO backend for a given ImagePyramid

Parameters
base_directorystr

root directory of an ImagePyramid instance

Returns
class

which TileIO derived class the ImagePyramid can be built with.

Raises
IOError

If no file with an extension in TILEIO_EXT is found.

PYME.Analysis.tile_pyramid.tile_pyramid(out_folder, ds, xm, ym, mdh, split=False, skipMoveFrames=False, shiftfield=None, mixmatrix=[[1.0, 0.0], [0.0, 1.0]], correlate=False, dark=None, flat=None, pyramid_tile_size=256)

Create a tile pyramid from which an ImagePyramid can be created

Parameters
out_folderstr

directory to save pyramid tiles(/directories)

dsPYME.IO.DataSources.BaseDataSource, np.ndarray

array-like image

xmnp.ndarray or PYME.Analysis.piecewiseMapping.piecewiseMap

x positions of frames in ds. Raw stage positions in [um]. ImagePyramid origin will be at at minimum x, and offset to camera chip origin will be handled in SupertileDatasource tile_coords_um method. to the camera chip origin.

ymnp.ndarray or PYME.Analysis.piecewiseMapping.piecewiseMap

y positions of frames in ds. Raw stage positions in [um]. ImagePyramid origin will be at at minimum y, and offset to camera chip origin will be handled in SupertileDatasource tile_coords_um method.

mdhPYME.IO.MetaDataHandler.MDataHandlerBase

metadata for ds

splitbool, optional

whether this is a splitter datasource and should be treated like one, by default False

skipMoveFramesbool, optional

flag to drop frames which are the first frame acquired at a given position, by default False

shiftfield[type], optional

required for splitter data, see PYME.Acquire.Hardware.splitter, by default None

mixmatrixlist, optional

for splitter data, see PYME.Acquire.Hardware.splitter, by default [[1., 0.], [0., 1.]]

correlatebool, optional

whether to add a 300 pixel padding to the edges, by default False

darkndarray, float, optional

(appropriately-cropped or scalar) dark frame (analog-digital offset) calibration to subtract when adding frames to the pyramid, by default None, in which case Camera.ADOffset from metadata will be used, if available

flatndarray, optional

(appropriately-cropped or scalar) flatfield calibration to apply to frames when adding them to the pyramid, by default None

pyramid_tile_sizeint, optional

base tile size, by default 256 pixels

Returns
ImagePyramid

coalesced/averaged/etc multilevel ImagePyramid instance

Notes

Code is currently somewhat alpha in that the splitter functionality is more or less untested, and we only get tile orientations right for primary cameras (i.e. when the stage is registered with multipliers to match the camera, rather than camera registered with orientation metadata to match it to the stage)