Viewer Modules

Batch Manager

class mesmerize.viewer.modules.batch_manager.ModuleGUI(parent, run_batch: list = None, testing: bool = False)[source]

GUI for the Batch Manager

__init__(parent, run_batch: list = None, testing: bool = False)[source]

Initialize self. See help(type(self)) for accurate signature.

add_item(module: str, input_workEnv: mesmerize.viewer.core.viewer_work_environment.ViewerWorkEnv, input_params: dict, name: str = '', info: dict = '') → uuid.UUID[source]

Add an item to the currently open batch

Parameters:
  • module – The module to run from /batch_run_modules.
  • input_workEnv – Input workEnv that the module will use
  • input_params – Input params that the module will use. Depends on your subclass of BatchRunInterface.process() method
  • name – A name for the batch item
  • info – A dictionary with any metadata information to display in the scroll area label.
Returns:

UUID of the added item

df = None

pandas.DataFrame that stores a “database” of information on the batch

get_item_index(u: Union[uuid.UUID, str]) → int[source]

Get DataFrame index from UUID

Parameters:u – UUID or str representing UUID
Returns:numerical index of the DataFrame corresponding to the UUID
load_item_input(viewers: Union[mesmerize.viewer.main_window.MainWindow, collections.UserList], r: pandas.core.series.Series = None, UUID: uuid.UUID = None)[source]

Pass either the batch DataFrame row or UUID of the item of which to load the input into a viewer

Parameters:
  • viewers – ViewerWindow or list of ImageView
  • r – Row of batch DataFrame corresponding to the selected item
  • UUID – UUID of the item to load input from
load_item_output(module: str, viewers: Union[mesmerize.viewer.main_window.MainWindow, mesmerize.pyqtgraphCore.imageview.ImageView.ImageView, collections.UserList], UUID: uuid.UUID)[source]

Calls subclass of BatchRunInterface.show_output()

Parameters:
  • module – The module name under /batch_run_modules that the batch item is from
  • viewers – ViewerWindow, ImageView, or list of ViewerWindows
  • UUID – UUID of the item to load input from
process_batch(start_ix: Union[int, uuid.UUID] = 0, clear_viewers=False)[source]

Process everything in the batch by calling subclass of BatchRunInterface.process() for all items in batch

Parameters:
  • start_ix – Either DataFrame index (int) or UUID of the item to start from.
  • clear_viewers – Clear work environments in all viewers that are open
show_item_info(s: PyQt5.QtWidgets.QListWidgetItem)[source]

Shows any info (such as the batch module’s params) in the meta-info label

Tiff Module

Uses the tifffile package created by Christoph Gohlke: https://pypi.org/project/tifffile/

Can be used with scripts within Mesmerize for loading tiff files without using the API of Viewer Core

class mesmerize.viewer.modules.tiff_io.ModuleGUI(parent, viewer_reference)[source]
load_tiff_file(tiff_path, meta_path, method)[source]

Load a tiff file along with associated meta data

Parameters:
  • tiff_path – path to the tiff file
  • meta_path – path to the json meta data file
  • method – one of “asarray”, “asarray-multi”, or “imread” “asarray” and “asarray-multi” uses tifffile.asarray() “asarray-multi” is for multi-page tiffs “imread” uses tifffile.imread()

Caiman Motion Correction

Front-end for Caiman NoRMCorre parameters entry

Can be used with scripts for adding batch items.

See also

User guide

class mesmerize.viewer.modules.caiman_motion_correction.ModuleGUI(parent, viewer_reference)[source]
get_params() → dict[source]

Get a dict of the set parameters :return: parameters dict :rtype: dict

set_params(params: dict)[source]

Set all parameters from a dict. All keys must be present in the dict and of the correct type.

Parameters:params – dict of parameters
add_to_batch_elas_corr()[source]

Add a batch item with the currently set parameters and the current work environment.

CNMF

Front-end for Caiman CNMF parameter entry

Can be used with scripts for adding batch items.

See also

User guide

class mesmerize.viewer.modules.cnmf.ModuleGUI(parent, viewer_reference)[source]
get_params(*args, **kwargs) → dict[source]

Get a dict of the set parameters. If the work environment was loaded from a motion correction batch item it put the bord_px in the dict. Doesn’t use any arguments

Returns:parameters dict
Return type:dict
set_params(d: dict)[source]

Set all parameters from a dict. All keys must be present in the dict.

Parameters:d – parameters dict
add_to_batch_cnmf()[source]

Add a CNMF batch item with the currently set parameters and the current work environment.

CNMFE

Front-end for Caiman CNMFE parameter entry

Can be used with scripts for adding batch items.

See also

User guide

class mesmerize.viewer.modules.cnmfe.ModuleGUI(parent, viewer_reference)[source]
get_params(*args, **kwargs) → dict[source]

Get a dict of the set parameters. If the work environment was loaded from a motion correction batch item it put the bord_px in the dict. Doesn’t use any arguments

Returns:parameters dict
Return type:dict
set_params(params: dict)[source]

Set all parameters from a dict. All keys must be present in the dict.

Parameters:params – parameters dict
add_to_batch_corr_pnr()[source]

Add a Corr PNR batch item with the currently set parameters and the current work environment.

add_to_batch_cnmfe()[source]

Add a CNMFE batch item with the currently set parameters and the current work environment.