microfilm.dataset package

Submodules

microfilm.dataset.dataset module

class microfilm.dataset.dataset.Data(expdir, channel_name=None, bad_frames=[], step=1, max_time=None, data_type=None)

Bases: object

Class defining and handling datasets of 2D multi-channel time-lapse images. Given an experiment directory (tiff files or stacks) or a a file (ND2, H5) the available data are automatically parsed. Parameters specific to an analysis run such as bad frame indices or the time steps are also stored in the Data object.

Parameters
  • expdir (str) – path to data folder (tif) or file (ND2)

  • channel_name (list of str) – names of data to use as channels

  • bad_frames (list, optional) – list of time-points to discard

  • step (int) – time step to use when iterating across frames

  • max_time (int. optional) – last frame to consider

  • data_type (str,) – type of data considers (“series”, “multi”, “nd2”, “h5)

K

Number of frames considered (including steps, bad frames)

Type

int

dims

XY image dimensions

Type

tuple

valid_frames

indices of considered frames

Type

1D array

channelfile
‘series’:

list of list of str, each element is a filename, files are grouped in a list for each channel, and all list grouped in a larger list

‘multi’, ‘h5’:

list of str, each element is a filename corresponding to a channel

‘nd2’:

list of str, each element is a channel name matching metadata information

Type

str or list

check_channel_time_available(channel, frame)

Given a channel and frame index, check that they exist

find_files(folderpath, check_time=True)

Given a folder, find all tif files contained in it and try to sort as time-lapse

frame_generator(channel)

Create a generator returning successive frames of a given channel. The channel parameter can be either a channel name or a list of those.

get_channel_name(m)

Get name of channel index m

load_frame(channel_name, frame)

Load index k of valid frames of channel index m in self.channelfile

set_valid_frames()

Create a list of indices of valid frames given a set of bad frames

update_params(params)

Update frame parameters

class microfilm.dataset.dataset.H5(expdir, channel_name=None, bad_frames=[], step=1, max_time=None, data_type='h5')

Bases: microfilm.dataset.dataset.Data

Data class for digesting H5 data. The h5 file is expected to contain a “volume” object of dimension TXY. A folder should contain on h5 file per channel.

initialize()
load_frame(channel_name, frame)

Load index k of valid frames of channel index m in self.channelfile

class microfilm.dataset.dataset.MultipageTIFF(expdir, channel_name=None, bad_frames=[], step=1, max_time=None, data_type='multi')

Bases: microfilm.dataset.dataset.Data

Data class to ingest multipage tiff files. A folder should contain multiple single-plane multi-page tif files, one for each channel.

initialize()
load_frame(channel_name, frame)

Load index k of valid frames of channel index m in self.channelfile

class microfilm.dataset.dataset.ND2(expdir, channel_name=None, bad_frames=[], step=1, max_time=None, data_type='nd2')

Bases: microfilm.dataset.dataset.Data

Data class for digesting ND2 files containing multi-channel time-lapse data. This class is very brittle and highly dependent on the version of NIS Elements used.

initialize()
load_frame(channel_name, frame)

Load index k of valid frames of channel index m in self.channelfile

class microfilm.dataset.dataset.Nparray(nparray, expdir='', channel_name=None, bad_frames=[], step=1, max_time=None, data_type='np')

Bases: microfilm.dataset.dataset.Data

Data class for digesting numpy arrays. The expected dimensions of the input array are CT(Z)XY

initialize()
load_frame(channel_name, frame)

Load index k of valid frames of channel index m in self.channelfile

class microfilm.dataset.dataset.TIFFSeries(expdir, channel_name=None, bad_frames=[], step=1, max_time=None, data_type='series')

Bases: microfilm.dataset.dataset.Data

Data class to ingest series of single tif files. Channels are organised by folder and frames ideally denoted as xxxx_t1.tif, xxxx_t2.tif etc. Otherwise frames are sorted using natsort.

initialize()
load_frame(channel_name, frame)

Load index k of valid frames of channel index m in self.channelfile

microfilm.dataset.dataset.findfiles(which, where='.')

Returns list of filenames from where path matched by ‘which’ shell pattern. Matching is case-insensitive.

Module contents