ROI Manager¶
Video Tutorial¶
ModuleGUI¶
The GUI QDockWidget that communicates with the back-end managers
-
class
mesmerize.viewer.modules.roi_manager.
ModuleGUI
(parent, viewer_reference)[source]¶ The GUI front-end for the ROI Manager module
-
manager
¶ The back-end manager instance.
Delete the currently selected ROI
-
start_backend
(type_str: str)[source]¶ Choose backend, one of the Manager classes in the managers module.
-
start_manual_mode
()[source]¶ Start in manual mode. Creates a new back-end manager instance (Uses ManagerManual)
-
package_for_project
() → dict[source]¶ Gets all the ROI states so that they can be packaged along with the rest of the work environment to be saved as a project Sample
-
Managers¶
The back-end managers that are used by the ROI Manager ModuleGUI
The managers hold instances of ROIs in an instance of ROIList
AbstractBaseManager¶
Subclass this if you want to make your own Manager Back-end.
-
class
mesmerize.viewer.modules.roi_manager_modules.managers.
AbstractBaseManager
(parent, ui, viewer_interface: mesmerize.viewer.core.common.ViewerUtils)[source]¶ Base ROI Manager
-
__init__
(parent, ui, viewer_interface: mesmerize.viewer.core.common.ViewerUtils)[source]¶ Set the common attributes
- Parameters
parent – The ModuleGUI QDockWidget instance
ui – The ui of the ModuleGUI QDockWidget instance,
viewer_interface – A ViewerUtils instance for accessing the Viewer the parent QDockWidget belongs to
-
roi_list
¶ The ROIList instance that stores the list of ROIs
-
abstract
add_roi
(*args, **kwargs)[source]¶ Method for adding an ROI, must be implemented in subclass
-
get_all_states
() → dict[source]¶ Get the ROI states for all ROIs in self.roi_list so that they can be restored. The appropriate manager is instantiated based on the ‘roi_type’ key of the returned dict
-
get_plot_item
() → mesmerize.pyqtgraphCore.graphicsItems.PlotDataItem.PlotDataItem[source]¶ Get the viewer plot item that is associated to these ROIs
-
__del__
()[source]¶ Cleanup of all ROIs in the list and deletes the manager instance. Used when switching modes.
-
__weakref__
¶ list of weak references to the object (if defined)
-
ManagerManual¶
-
class
mesmerize.viewer.modules.roi_manager_modules.managers.
ManagerManual
(parent, ui, viewer_interface)[source]¶ Bases:
mesmerize.viewer.modules.roi_manager_modules.managers.AbstractBaseManager
The Manager for the Manual mode
-
__init__
(parent, ui, viewer_interface)[source]¶ Set the common attributes
- Parameters
parent – The ModuleGUI QDockWidget instance
ui – The ui of the ModuleGUI QDockWidget instance,
viewer_interface – A ViewerUtils instance for accessing the Viewer the parent QDockWidget belongs to
-
add_roi
(shape: str) → mesmerize.viewer.modules.roi_manager_modules.roi_types.ManualROI[source]¶ Add an ROI to the list
- Parameters
shape – either “PolyLineROI” or “EllipseROI”
-
import_from_imagej
(path: str)[source]¶ Uses read-roi package created by Hadrien Mary. https://pypi.org/project/read-roi/
- Parameters
path – Full path to the ImageJ ROIs zip file
-
ManagerScatterROI¶
-
class
mesmerize.viewer.modules.roi_manager_modules.managers.
ManagerScatterROI
(parent, ui, viewer_interface: mesmerize.viewer.core.common.ViewerUtils)[source]¶ Bases:
mesmerize.viewer.modules.roi_manager_modules.managers.AbstractBaseManager
Manager for unmoveable ROIs drawn using scatterplots
-
__init__
(parent, ui, viewer_interface: mesmerize.viewer.core.common.ViewerUtils)[source]¶ Set the common attributes
- Parameters
parent – The ModuleGUI QDockWidget instance
ui – The ui of the ModuleGUI QDockWidget instance,
viewer_interface – A ViewerUtils instance for accessing the Viewer the parent QDockWidget belongs to
-
add_roi
(curve: numpy.ndarray, xs: numpy.ndarray, ys: numpy.ndarray, metadata: Optional[dict] = None, dfof_data: Optional[numpy.ndarray] = None, spike_data: Optional[numpy.ndarray] = None) → mesmerize.viewer.modules.roi_manager_modules.roi_types.ScatterROI[source]¶ Add a single ROI
xs and ys arguments are 1D numpy arrays.
- Parameters
curve – curve data, 1-D array, y values/intensity values
xs – x-values for the scatter plot to spatially illustrate the ROI
ys – corresponding y-values for the scatter plot to spatially illustrate the ROI
metadata – Any metadata for this ROI
- Returns
ScatterROI object
-
ManagerVolROI¶
-
class
mesmerize.viewer.modules.roi_manager_modules.managers.
ManagerVolROI
(parent, ui, viewer_interface: mesmerize.viewer.core.common.ViewerUtils)[source]¶ Bases:
mesmerize.viewer.modules.roi_manager_modules.managers.ManagerScatterROI
Manager for 3D ROIs
-
__init__
(parent, ui, viewer_interface: mesmerize.viewer.core.common.ViewerUtils)[source]¶ Set the common attributes
- Parameters
parent – The ModuleGUI QDockWidget instance
ui – The ui of the ModuleGUI QDockWidget instance,
viewer_interface – A ViewerUtils instance for accessing the Viewer the parent QDockWidget belongs to
-
ManagerVolCNMF¶
-
class
mesmerize.viewer.modules.roi_manager_modules.managers.
ManagerVolCNMF
(parent, ui, viewer_interface)[source]¶ Bases:
mesmerize.viewer.modules.roi_manager_modules.managers.ManagerVolROI
Manager for 3D CNMF based ROIs
-
__init__
(parent, ui, viewer_interface)[source]¶ Set the common attributes
- Parameters
parent – The ModuleGUI QDockWidget instance
ui – The ui of the ModuleGUI QDockWidget instance,
viewer_interface – A ViewerUtils instance for accessing the Viewer the parent QDockWidget belongs to
-
add_all_components
(cnmf_data_dict: dict, input_params_dict: dict)[source]¶ Add all components from a CNMF(E) output. Arguments correspond to CNMF(E) outputs
- Parameters
cnmf_data_dict – CNMF results data directly from the HDF5 file
input_params_dict – dict of input params, from the batch manager
calc_raw_min_max – Calculate raw min & max for each ROI
- Returns
-
ManagerCNMFROI¶
-
class
mesmerize.viewer.modules.roi_manager_modules.managers.
ManagerCNMFROI
(parent, ui, viewer_interface)[source]¶ Bases:
mesmerize.viewer.modules.roi_manager_modules.managers.AbstractBaseManager
Manager for ROIs imported from CNMF or CNMFE outputs
-
add_all_components
(cnmf_data_dict, input_params_dict, calc_raw_min_max=False)[source]¶ Add all components from a CNMF(E) output. Arguments correspond to CNMF(E) outputs
- Parameters
cnmf_data_dict – CNMF results data directly from the HDF5 file
input_params_dict – dict of input params, from the batch manager
calc_raw_min_max – Calculate raw min & max for each ROI
- Returns
-
ROI List¶
Used for holding instance of ROIs
-
class
mesmerize.viewer.modules.roi_manager_modules.roi_list.
ROIList
(ui, roi_types: type, viewer_interface: mesmerize.viewer.core.common.ViewerUtils)[source]¶ A list for holding ROIs of one type
-
__init__
(ui, roi_types: type, viewer_interface: mesmerize.viewer.core.common.ViewerUtils)[source]¶ Instantiate
- Parameters
ui – The ui from the parent ModuleGUI, used to interact with the ROI list widget etc.
roi_types – The type of ROI that this list will hold
viewer_interface – ViewerUtils instance for interacting with the parent Viewer
-
list_widget
¶ ROI list widget
Tags list widget
-
vi
¶ ViewrUtils instance
-
current_index
¶ Current index (int)
-
previous_index
¶ Previous index (int)
-
append
(roi: Union[mesmerize.viewer.modules.roi_manager_modules.roi_types.ScatterROI, mesmerize.viewer.modules.roi_manager_modules.roi_types.ManualROI, mesmerize.viewer.modules.roi_manager_modules.roi_types.VolMultiCNMFROI], add_to_list_widget: bool = True)[source]¶ Add an ROI instance to the list
-
__delitem__
(key)[source]¶ Delete an ROI from the list and cleanup from the viewer, reindex the colors etc.
-
reindex_colormap
(random_shuffle=False)[source]¶ Reindex the colors so they sequentially follow the HSV colormap
-
__getitem__
(item) → Union[mesmerize.viewer.modules.roi_manager_modules.roi_types.ManualROI, mesmerize.viewer.modules.roi_manager_modules.roi_types.ScatterROI][source]¶ Get an item (ROI) from the list
-
highlight_roi
(roi: Union[mesmerize.viewer.modules.roi_manager_modules.roi_types.ManualROI, mesmerize.viewer.modules.roi_manager_modules.roi_types.ScatterROI])[source]¶ Highlight an ROI in white, both the spatial visualization and the curve
-
slot_show_all_checkbox_clicked
(b: bool)[source]¶ Show all ROIs in the viewer overlay visualization and curves
-
_show_graphics_object
(ix: int)[source]¶ Show the ROI at the passed index in the viewer overlay visualization
-
_hide_graphics_object
(ix: int)[source]¶ Hide the ROI at the passed index in the viewer overlay visualization
-
plot_manual_roi_regions
()[source]¶ Plot the ROI curves from the regions of all ManualROI instances in the list
-
set_pg_roi_plot
(ix: int)[source]¶ Plot the ROI curve from the region of the ManualROI instance at the passed index
Set the tags list for the ROI at the current index
-
update_roi_defs_from_configuration
()[source]¶ Update ROI_DEFs in the Tags list from the project configuration
-
__weakref__
¶ list of weak references to the object (if defined)
-
ROI Types¶
A list of these are held by an instance of ROIList
AbstractBaseROI¶
-
class
mesmerize.viewer.modules.roi_manager_modules.roi_types.
_AbstractBaseROI
(curve_plot_item: mesmerize.pyqtgraphCore.graphicsItems.PlotDataItem.PlotDataItem, view_box: mesmerize.pyqtgraphCore.graphicsItems.ViewBox.ViewBox.ViewBox, state: Optional[dict])[source]¶ Abstract base class defining an ROI that works with the ROIList and ROI Managers. Inherit from this or BaseROI to make a new ROI class
-
abstract
__init__
(curve_plot_item: mesmerize.pyqtgraphCore.graphicsItems.PlotDataItem.PlotDataItem, view_box: mesmerize.pyqtgraphCore.graphicsItems.ViewBox.ViewBox.ViewBox, state: Optional[dict])[source]¶ Minimum required attributes
- Parameters
curve_plot_item – The plot item that is used for display the curves in the viewer
view_box – ViewBox containing the image sequence, used for overlaying the ROIs on top of the image
state – ROI state, used for restoring the ROIs. Pass None is not restoring an ROI from a state dict
-
abstract
get_roi_graphics_object
() → PyQt5.QtWidgets.QGraphicsObject[source]¶ Get the QGraphicsObject used for visualization of the spatial localization of the ROI
-
abstract
set_roi_graphics_object
(*args, **kwargs)[source]¶ Set the QGraphicsObject used for visualization of the spatial localization of the ROI
-
abstract
set_original_color
(color)[source]¶ Set the original color for this ROI
- Parameters
color – 1D numpy array of 4 floating point numbers (range 0 - 255) in RBGA format, [R, G, B, A]
-
abstract
get_color
() → numpy.ndarray[source]¶ Get the current color of this ROI
- Returns
1D numpy array of 4 floating point numbers (range 0 - 255) in RBGA format, [R, G, B, A]
- Return type
np.ndarray
-
abstract
set_color
(color, *args, **kwargs)[source]¶ Set the current color of this ROI
- Parameters
color – 1D numpy array of 4 floating point numbers (range 0 - 255) in RBGA format, [R, G, B, A]
-
abstract
set_tag
(roi_def: str, tag: str)[source]¶ Set a tag for the passed roi_def
- Parameters
roi_def – The ROI_DEF that should be tagged
tag – The tag to label for the passed ROI_DEF/ROI Type
-
abstract
get_tag
(roi_def) → str[source]¶ Get the tag that is set to the passed ‘roi_def’
- Return type
Get all the tags for all the ROI_DEFs
- Return type
-
abstract classmethod
from_state
(curve_plot_item: mesmerize.pyqtgraphCore.graphicsItems.PlotDataItem.PlotDataItem, view_box: mesmerize.pyqtgraphCore.graphicsItems.ViewBox.ViewBox.ViewBox, state: dict)[source]¶ Restore this ROI from a state
- Parameters
curve_plot_item – The plot item that is used for display the curves in the viewer
view_box – ViewBox containing the image sequence, used for overlaying the ROIs on top of the image
state – ROI state, used for restoring the ROIs. Pass None is not restoring an ROI from a state dict
-
__weakref__
¶ list of weak references to the object (if defined)
-
abstract
BaseROI¶
Subclass from this if you want to make your own ROI Type.
-
class
mesmerize.viewer.modules.roi_manager_modules.roi_types.
BaseROI
(curve_plot_item: mesmerize.pyqtgraphCore.graphicsItems.PlotDataItem.PlotDataItem, view_box: mesmerize.pyqtgraphCore.graphicsItems.ViewBox.ViewBox.ViewBox, state: Optional[dict] = None, metadata: Optional[dict] = None)[source]¶ Bases:
mesmerize.viewer.modules.roi_manager_modules.roi_types._AbstractBaseROI
A base class that is used by ManualROI and CNMFEROI Inherit from this to make a new ROI class
-
__init__
(curve_plot_item: mesmerize.pyqtgraphCore.graphicsItems.PlotDataItem.PlotDataItem, view_box: mesmerize.pyqtgraphCore.graphicsItems.ViewBox.ViewBox.ViewBox, state: Optional[dict] = None, metadata: Optional[dict] = None)[source]¶ Instantiate common attributes
- Parameters
curve_plot_item – The plot item that is used for display the curves in the viewer
view_box – ViewBox containing the image sequence, used for overlaying the ROIs on top of the image
state – ROI state, used for restoring the ROIs. Pass None is not restoring an ROI from a state dict
-
get_roi_graphics_object
() → PyQt5.QtWidgets.QGraphicsObject[source]¶ Get the QGraphicsObject used for visualization of the spatial localization of the ROI
-
set_roi_graphics_object
(*args, **kwargs)[source]¶ Set the QGraphicsObject used for visualization of the spatial localization of the ROI
-
set_original_color
(color)[source]¶ Set the original color for this ROI
- Parameters
color – 1D numpy array of 4 floating point numbers (range 0 - 255) in RBGA format, [R, G, B, A]
-
get_color
()[source]¶ Get the current color of this ROI
- Returns
1D numpy array of 4 floating point numbers (range 0 - 255) in RBGA format, [R, G, B, A]
- Return type
np.ndarray
-
set_color
(color: Union[numpy.ndarray, str], *args, **kwargs)[source]¶ Set the current color of this ROI
- Parameters
color – 1D numpy array of 4 floating point numbers (range 0 - 255) in RBGA format, [R, G, B, A]
-
set_tag
(roi_def: str, tag: str)[source]¶ Set a tag for the passed roi_def
- Parameters
roi_def – The ROI_DEF that should be tagged
tag – The tag to label for the passed ROI_DEF/ROI Type
Get all the tags for all the ROI_DEFs
- Return type
-
classmethod
from_state
(curve_plot_item: mesmerize.pyqtgraphCore.graphicsItems.PlotDataItem.PlotDataItem, view_box: mesmerize.pyqtgraphCore.graphicsItems.ViewBox.ViewBox.ViewBox, state: dict)[source]¶ Restore this ROI from a state
- Parameters
curve_plot_item – The plot item that is used for display the curves in the viewer
view_box – ViewBox containing the image sequence, used for overlaying the ROIs on top of the image
state – ROI state, used for restoring the ROIs. Pass None is not restoring an ROI from a state dict
-
ManualROI¶
-
class
mesmerize.viewer.modules.roi_manager_modules.roi_types.
ManualROI
(curve_plot_item: mesmerize.pyqtgraphCore.graphicsItems.PlotDataItem.PlotDataItem, roi_graphics_object: mesmerize.pyqtgraphCore.graphicsItems.ROI.ROI, view_box: mesmerize.pyqtgraphCore.graphicsItems.ViewBox.ViewBox.ViewBox, state: Optional[dict] = None, spike_data: Optional[numpy.ndarray] = None, dfof_data: Optional[numpy.ndarray] = None)[source]¶ Bases:
mesmerize.viewer.modules.roi_manager_modules.roi_types.BaseROI
A class manually drawn ROIs
-
__init__
(curve_plot_item: mesmerize.pyqtgraphCore.graphicsItems.PlotDataItem.PlotDataItem, roi_graphics_object: mesmerize.pyqtgraphCore.graphicsItems.ROI.ROI, view_box: mesmerize.pyqtgraphCore.graphicsItems.ViewBox.ViewBox.ViewBox, state: Optional[dict] = None, spike_data: Optional[numpy.ndarray] = None, dfof_data: Optional[numpy.ndarray] = None)[source]¶
-
property
curve_data
¶ tuple of (xs, ys)
- Type
return
-
get_roi_graphics_object
() → mesmerize.pyqtgraphCore.graphicsItems.ROI.ROI[source]¶ Get the QGraphicsObject used for visualization of the spatial localization of the ROI
-
set_roi_graphics_object
(graphics_object: mesmerize.pyqtgraphCore.graphicsItems.ROI.ROI)[source]¶ Set the QGraphicsObject used for visualization of the spatial localization of the ROI
-
classmethod
from_state
(curve_plot_item: mesmerize.pyqtgraphCore.graphicsItems.PlotDataItem.PlotDataItem, view_box: mesmerize.pyqtgraphCore.graphicsItems.ViewBox.ViewBox.ViewBox, state: dict)[source]¶ Restore this ROI from a state
- Parameters
curve_plot_item – The plot item that is used for display the curves in the viewer
view_box – ViewBox containing the image sequence, used for overlaying the ROIs on top of the image
state – ROI state, used for restoring the ROIs. Pass None is not restoring an ROI from a state dict
-
reset_color
()¶ Reset the color of this ROI back to the original color
-
set_original_color
(color)¶ Set the original color for this ROI
- Parameters
color – 1D numpy array of 4 floating point numbers (range 0 - 255) in RBGA format, [R, G, B, A]
-
get_color
()¶ Get the current color of this ROI
- Returns
1D numpy array of 4 floating point numbers (range 0 - 255) in RBGA format, [R, G, B, A]
- Return type
np.ndarray
-
set_color
(color: Union[numpy.ndarray, str], *args, **kwargs)¶ Set the current color of this ROI
- Parameters
color – 1D numpy array of 4 floating point numbers (range 0 - 255) in RBGA format, [R, G, B, A]
-
set_tag
(roi_def: str, tag: str)¶ Set a tag for the passed roi_def
- Parameters
roi_def – The ROI_DEF that should be tagged
tag – The tag to label for the passed ROI_DEF/ROI Type
Get all the tags for all the ROI_DEFs
- Return type
-
add_to_viewer
()¶ Add this ROI to the viewer.
-
remove_from_viewer
()¶ Remove this ROI from the viewer
-
ScatterROI¶
-
class
mesmerize.viewer.modules.roi_manager_modules.roi_types.
ScatterROI
(curve_plot_item: mesmerize.pyqtgraphCore.graphicsItems.PlotDataItem.PlotDataItem, view_box: mesmerize.pyqtgraphCore.graphicsItems.ViewBox.ViewBox.ViewBox, state: Optional[dict] = None, curve_data: Optional[numpy.ndarray] = None, xs: Optional[numpy.ndarray] = None, ys: Optional[numpy.ndarray] = None, metadata: Optional[dict] = None, spike_data: Optional[numpy.ndarray] = None, dfof_data: Optional[numpy.ndarray] = None, **kwargs)[source]¶ Bases:
mesmerize.viewer.modules.roi_manager_modules.roi_types.BaseROI
A class for unmoveable ROIs drawn using scatter points
-
__init__
(curve_plot_item: mesmerize.pyqtgraphCore.graphicsItems.PlotDataItem.PlotDataItem, view_box: mesmerize.pyqtgraphCore.graphicsItems.ViewBox.ViewBox.ViewBox, state: Optional[dict] = None, curve_data: Optional[numpy.ndarray] = None, xs: Optional[numpy.ndarray] = None, ys: Optional[numpy.ndarray] = None, metadata: Optional[dict] = None, spike_data: Optional[numpy.ndarray] = None, dfof_data: Optional[numpy.ndarray] = None, **kwargs)[source]¶ - Parameters
curve_plot_item –
view_box –
state –
curve_data – 1D numpy array of y values
kwargs –
-
set_roi_graphics_object
(xs: numpy.ndarray, ys: numpy.ndarray)[source]¶ Set the QGraphicsObject used for visualization of the spatial localization of the ROI
-
get_roi_graphics_object
() → mesmerize.pyqtgraphCore.graphicsItems.ScatterPlotItem.ScatterPlotItem[source]¶ Get the QGraphicsObject used for visualization of the spatial localization of the ROI
-
classmethod
from_state
(curve_plot_item: mesmerize.pyqtgraphCore.graphicsItems.PlotDataItem.PlotDataItem, view_box: mesmerize.pyqtgraphCore.graphicsItems.ViewBox.ViewBox.ViewBox, state: dict, **kwargs)[source]¶ Restore this ROI from a state
- Parameters
curve_plot_item – The plot item that is used for display the curves in the viewer
view_box – ViewBox containing the image sequence, used for overlaying the ROIs on top of the image
state – ROI state, used for restoring the ROIs. Pass None is not restoring an ROI from a state dict
-
reset_color
()¶ Reset the color of this ROI back to the original color
-
set_original_color
(color)¶ Set the original color for this ROI
- Parameters
color – 1D numpy array of 4 floating point numbers (range 0 - 255) in RBGA format, [R, G, B, A]
-
get_color
()¶ Get the current color of this ROI
- Returns
1D numpy array of 4 floating point numbers (range 0 - 255) in RBGA format, [R, G, B, A]
- Return type
np.ndarray
-
set_color
(color: Union[numpy.ndarray, str], *args, **kwargs)¶ Set the current color of this ROI
- Parameters
color – 1D numpy array of 4 floating point numbers (range 0 - 255) in RBGA format, [R, G, B, A]
-
set_tag
(roi_def: str, tag: str)¶ Set a tag for the passed roi_def
- Parameters
roi_def – The ROI_DEF that should be tagged
tag – The tag to label for the passed ROI_DEF/ROI Type
Get all the tags for all the ROI_DEFs
- Return type
-
add_to_viewer
()¶ Add this ROI to the viewer.
-
remove_from_viewer
()¶ Remove this ROI from the viewer
-
VolCNMF¶
-
class
mesmerize.viewer.modules.roi_manager_modules.roi_types.
VolCNMF
(curve_plot_item: mesmerize.pyqtgraphCore.graphicsItems.PlotDataItem.PlotDataItem, view_box: mesmerize.pyqtgraphCore.graphicsItems.ViewBox.ViewBox.ViewBox, cnmf_idx: Optional[int] = None, curve_data: Optional[numpy.ndarray] = None, contour: Optional[dict] = None, state: Optional[dict] = None, spike_data: Optional[numpy.ndarray] = None, dfof_data: Optional[numpy.ndarray] = None, metadata: Optional[dict] = None, zlevel: int = 0)[source]¶ Bases:
mesmerize.viewer.modules.roi_manager_modules.roi_types.ScatterROI
3D ROI for CNMF data
-
__init__
(curve_plot_item: mesmerize.pyqtgraphCore.graphicsItems.PlotDataItem.PlotDataItem, view_box: mesmerize.pyqtgraphCore.graphicsItems.ViewBox.ViewBox.ViewBox, cnmf_idx: Optional[int] = None, curve_data: Optional[numpy.ndarray] = None, contour: Optional[dict] = None, state: Optional[dict] = None, spike_data: Optional[numpy.ndarray] = None, dfof_data: Optional[numpy.ndarray] = None, metadata: Optional[dict] = None, zlevel: int = 0)[source]¶ - Parameters
curve_plot_item –
view_box –
state –
curve_data – 1D numpy array of y values
kwargs –
-
set_roi_graphics_object
()[source]¶ Set the QGraphicsObject used for visualization of the spatial localization of the ROI
-
set_zlevel
(z: int)[source]¶ Set the z-level of the ROI to correspond with the z-level of the image.
Different from setZValue!!
-
get_roi_graphics_object
() → mesmerize.pyqtgraphCore.graphicsItems.ScatterPlotItem.ScatterPlotItem¶ Get the QGraphicsObject used for visualization of the spatial localization of the ROI
-
reset_color
()¶ Reset the color of this ROI back to the original color
-
set_original_color
(color)¶ Set the original color for this ROI
- Parameters
color – 1D numpy array of 4 floating point numbers (range 0 - 255) in RBGA format, [R, G, B, A]
-
get_color
()¶ Get the current color of this ROI
- Returns
1D numpy array of 4 floating point numbers (range 0 - 255) in RBGA format, [R, G, B, A]
- Return type
np.ndarray
-
set_color
(color: Union[numpy.ndarray, str], *args, **kwargs)¶ Set the current color of this ROI
- Parameters
color – 1D numpy array of 4 floating point numbers (range 0 - 255) in RBGA format, [R, G, B, A]
-
set_tag
(roi_def: str, tag: str)¶ Set a tag for the passed roi_def
- Parameters
roi_def – The ROI_DEF that should be tagged
tag – The tag to label for the passed ROI_DEF/ROI Type
Get all the tags for all the ROI_DEFs
- Return type
-
add_to_viewer
()¶ Add this ROI to the viewer.
-
remove_from_viewer
()¶ Remove this ROI from the viewer
-
classmethod
from_state
(curve_plot_item: mesmerize.pyqtgraphCore.graphicsItems.PlotDataItem.PlotDataItem, view_box: mesmerize.pyqtgraphCore.graphicsItems.ViewBox.ViewBox.ViewBox, state: dict, **kwargs)¶ Restore this ROI from a state
- Parameters
curve_plot_item – The plot item that is used for display the curves in the viewer
view_box – ViewBox containing the image sequence, used for overlaying the ROIs on top of the image
state – ROI state, used for restoring the ROIs. Pass None is not restoring an ROI from a state dict
-
CNMFROI¶
-
class
mesmerize.viewer.modules.roi_manager_modules.roi_types.
CNMFROI
(curve_plot_item: mesmerize.pyqtgraphCore.graphicsItems.PlotDataItem.PlotDataItem, view_box: mesmerize.pyqtgraphCore.graphicsItems.ViewBox.ViewBox.ViewBox, cnmf_idx: Optional[int] = None, curve_data: Optional[numpy.ndarray] = None, contour: Optional[dict] = None, state: Optional[dict] = None, spike_data: Optional[numpy.ndarray] = None, dfof_data: Optional[numpy.ndarray] = None, metadata: Optional[dict] = None, **kwargs)[source]¶ Bases:
mesmerize.viewer.modules.roi_manager_modules.roi_types.ScatterROI
A class for ROIs imported from CNMF(E) output data
-
get_roi_graphics_object
() → mesmerize.pyqtgraphCore.graphicsItems.ScatterPlotItem.ScatterPlotItem¶ Get the QGraphicsObject used for visualization of the spatial localization of the ROI
-
set_roi_graphics_object
(xs: numpy.ndarray, ys: numpy.ndarray)¶ Set the QGraphicsObject used for visualization of the spatial localization of the ROI
-
reset_color
()¶ Reset the color of this ROI back to the original color
-
set_original_color
(color)¶ Set the original color for this ROI
- Parameters
color – 1D numpy array of 4 floating point numbers (range 0 - 255) in RBGA format, [R, G, B, A]
-
get_color
()¶ Get the current color of this ROI
- Returns
1D numpy array of 4 floating point numbers (range 0 - 255) in RBGA format, [R, G, B, A]
- Return type
np.ndarray
-
set_color
(color: Union[numpy.ndarray, str], *args, **kwargs)¶ Set the current color of this ROI
- Parameters
color – 1D numpy array of 4 floating point numbers (range 0 - 255) in RBGA format, [R, G, B, A]
-
set_tag
(roi_def: str, tag: str)¶ Set a tag for the passed roi_def
- Parameters
roi_def – The ROI_DEF that should be tagged
tag – The tag to label for the passed ROI_DEF/ROI Type
Get all the tags for all the ROI_DEFs
- Return type
-
add_to_viewer
()¶ Add this ROI to the viewer.
-
remove_from_viewer
()¶ Remove this ROI from the viewer
-
classmethod
from_state
(curve_plot_item: mesmerize.pyqtgraphCore.graphicsItems.PlotDataItem.PlotDataItem, view_box: mesmerize.pyqtgraphCore.graphicsItems.ViewBox.ViewBox.ViewBox, state: dict, **kwargs)¶ Restore this ROI from a state
- Parameters
curve_plot_item – The plot item that is used for display the curves in the viewer
view_box – ViewBox containing the image sequence, used for overlaying the ROIs on top of the image
state – ROI state, used for restoring the ROIs. Pass None is not restoring an ROI from a state dict
-
__init__
(curve_plot_item: mesmerize.pyqtgraphCore.graphicsItems.PlotDataItem.PlotDataItem, view_box: mesmerize.pyqtgraphCore.graphicsItems.ViewBox.ViewBox.ViewBox, cnmf_idx: Optional[int] = None, curve_data: Optional[numpy.ndarray] = None, contour: Optional[dict] = None, state: Optional[dict] = None, spike_data: Optional[numpy.ndarray] = None, dfof_data: Optional[numpy.ndarray] = None, metadata: Optional[dict] = None, **kwargs)[source]¶ Instantiate attributes.
- Type
curve_data: np.ndarray
- Parameters
curve_data – 1D numpy array of y values
cnmf_idx – original index of the ROI from cnmf idx_components
-