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

del_item()[source]

Delete the currently selected item from the batch and any corresponding dependents of the item’s output

df

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, *args)[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 output 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]
check_meta_path()bool[source]

check if a file exists with the same name and the meta data extension specified by the selected meta data format

load(tiff_path: str, method: str, axes_order: Optional[str] = None, meta_path: Optional[str] = None, meta_format: Optional[str] = None) → mesmerize.viewer.core.viewer_work_environment.ViewerWorkEnv[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()

  • axes_order – axes order, examples: txy, xyt, tzxy, xytz etc.

  • meta_format – name of function from viewer.core.organize_meta that should be used to organize the meta data.

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(group_params: bool = False)dict[source]

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

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, group_params: bool = False)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

add_to_batch(params: dict = None)uuid.UUID[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(item_type: str, group_params: bool = False)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

Parameters

item_type – one of corr_pnr or cnmfe

add_to_batch_corr_pnr(params: dict = None)uuid.UUID[source]

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

add_to_batch_cnmfe(params: dict = None)uuid.UUID[source]

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

MESc Importer

MESc importer for exploring & importing image sequences from .mesc HDF5 files.

ModuleGUI

class mesmerize.viewer.modules.femtonics_mesc.ModuleGUI(parent, viewer_ref)[source]
mesc_navigator

instance of MEScNavigator

plot_widgets

list of plot widgets

set_file(path: str, *args)[source]

Create an h5py file handle from the .mesc file at the given path.

*args are not used, its just there for compatibility with the decorator.

Parameters
  • path (str) – path to the .mes file

  • args – not used

close_file(*args)[source]

Close the file handle

Parameters

args*args not used, just there for compatibility with the decorator

import_recording(*args)[source]

Imports the chosen recording into the Viewer Work Environment based on the user selected hpath from the list widgets

*args not used, just there for compatibility with the decorator

MEScNavigator

Takes care of navigating through the HDF5 data structure of the .mesc file.

class mesmerize.viewer.modules.femtonics_mesc.MEScNavigator(parent, list_widgets: List[mesmerize.pyqtgraphCore.widgets.ListWidget.ListWidget])[source]
sig_hpath_changed: PyQt5.QtCore.pyqtSignal

emitted every time the hdf path changes

sig_channel_doubleclicked: PyQt5.QtCore.pyqtSignal

emitted when a Channel or Curve item is double clicked

path: str

system path to the hdf5 file

file: h5py.File

h5py file handle

session: str

currently selected MSession

sessions: List[str]

list of MSession options available in current file

listw_sessions: ListWidget

ui list of MSession options

unit: str

currently selected MUnit

units: List[str]

list of MUnit options available in current MSession

listw_units: ListWidget

ui list of MUnit options

channel: str

currently selected Channel

channels: List[str]

list of Channel options available in current MUnit

listw_channels: ListWidget

ui list of Channel options

set_file_path(path: str)[source]

set the path to the .mesc file

Parameters

path – path to the .mesc hdf5 file

close_file()[source]

Close the h5py file handle that is currently open.

set_session(key: Union[str, PyQt5.QtWidgets.QListWidgetItem])[source]

Set the MSession option

Parameters

key – a valid MSession

Returns

set_unit(key: Union[str, PyQt5.QtWidgets.QListWidgetItem])[source]

Set the MUnit option

Parameters

key – a valid MUnit

Returns

set_channel(key: Union[str, PyQt5.QtWidgets.QListWidgetItem])[source]

Set a Channel or Curve option

Parameters

key – a valid Channel or Curve

Returns

get_hpath(astype: type) → Union[str, list, dict][source]

get the current hdf path

Parameters

astype – one of str, list, or dict

Returns

the hdf path as the chosen data type