fsleyes.actions.correlate¶
This module provides the PearsonCorrelateAction class, which is
an Action that calculates seed-based correlation on 4D
Image overlays.
-
class
fsleyes.actions.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.-
__init__(overlayList, displayCtx, panel)[source]¶ Create a
CorrelateAction.- Parameters
overlayList – The
OverlayList.displayCtx – The
DisplayContext.panel – The
CanvasPanelthat owns this action.
-
destroy()[source]¶ Removes listeners from the
DisplayContextandOverlayList, and callsAction.destroy().
-
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.
-
_CorrelateAction__clearCorrelateOverlays()¶ Called by
__overlayListChanged(). Clears internal references to any obsolete correlate overlays.
-
_CorrelateAction__createCorrelateOverlay(overlay, data)¶ Creates a correlate overlay for the given
overlay, adds it to theOverlayList, and initialises some display properties.
-
_CorrelateAction__overlayListChanged(*a)¶ Called when the
OverlayListchanges. Makes sure that there are no obsolete correlate overlays in the list, and calls__selectedOverlayChanged().
-
_CorrelateAction__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().
-
_CorrelateAction__selectedOverlayChanged(*a)¶ Called when the selected overlay, or overlay list, changes.
Enables/disables this action depending on the nature of the selected overlay.
-
__module__= 'fsleyes.actions.correlate'¶
-
-
class
fsleyes.actions.correlate.PearsonCorrelateAction(overlayList, displayCtx, panel)[source]¶ Bases:
fsleyes.actions.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.actions.correlate'¶
-