fsleyes.plugins.tools.correlate¶
This module provides the PearsonCorrelateAction class, which is
an Action that calculates seed-based correlation on 4D
Image overlays.
-
class
fsleyes.plugins.tools.correlate.CorrelateAction(overlayList, displayCtx, panel)[source]¶ Bases:
fsleyes.actions.base.ActionThe
CorrelateActionis a base class for thePearsonCorrelateActionandPCACorrelateActionclasses, which manages adding/removing correlation overlays to/from theOverlayList, and manages execution of the correlation.When a 4D
Imageis selected and theCorrelateActionis invoked, a new 3DImageis created and added to theOverlayList- this image is referred to as a correlate overlay, and is used to store and display the correlation values.-
static
supportedViews()[source]¶ The
CorrelateActionis restricted for use withOrthoPanelviews.
-
static
ignoreTool()[source]¶ Tells the FSLeyes plugin system not to add the
CorrelateActionclass as an option to the FSLeyes toolsmenu. Instead, thePearsonCorrelateActionaction (and other potential future sub-classes) is added.
-
__init__(overlayList, displayCtx, panel)[source]¶ Create a
CorrelateAction.- Parameters
overlayList – The
OverlayList.displayCtx – The
DisplayContext.panel – The
OrthoPanelthat owns this action.
-
destroy()[source]¶ Removes listeners from the
DisplayContextandOverlayList, and callsAction.destroy().
-
__selectedOverlayChanged(*a)¶ Called when the selected overlay, or overlay list, changes.
Enables/disables this action depending on the nature of the selected overlay.
-
__overlayListChanged(*a)¶ Called when the
OverlayListchanges. Makes sure that there are no obsolete correlate overlays in the list, and calls__selectedOverlayChanged().
-
__clearCorrelateOverlays()¶ Called by
__overlayListChanged(). Clears internal references to any obsolete correlate overlays.
-
__createCorrelateOverlay(overlay, data)¶ Creates a correlate overlay for the given
overlay, adds it to theOverlayList, and initialises some display properties.
-
__runCorrelateAction()¶ Called when this
Actionis invoked. Calculates correlation values from the voxel at the currentDisplayContext.location(relative to the currently selected overlay) to all other voxels, and updates the correlate overlay.The correlation calculation and overlay update is performed on a separate thread (via
idle.run()), with a call tocalculateCorrelation().
-
calculateCorrelation(seed, data)[source]¶ Calculates correlation values between the given
seedvoxel (an(x, y, z)tuple) and all other voxels. This method must be implemented by sub-classes.- Parameters
seed – An
(x, y, z)tuple specifying the seed voxeldata – A 4D
numpyarray containing all of the data.
- Returns
A 3D
numpyarray containing the correlation values.
-
__module__= 'fsleyes.plugins.tools.correlate'¶
-
static
-
class
fsleyes.plugins.tools.correlate.PearsonCorrelateAction(overlayList, displayCtx, panel)[source]¶ Bases:
fsleyes.plugins.tools.correlate.CorrelateActionThe
PearsonCorrelateActionis aCorrelateActionwhich calculates Pearson correlation coefficient values between the seed voxel and all other voxels.-
calculateCorrelation(seed, data)[source]¶ Calculates Pearson correlation between the data at the specified seed voxel, and all other voxels.
-
__module__= 'fsleyes.plugins.tools.correlate'¶
-