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.Action
The
CorrelateAction
is a base class for thePearsonCorrelateAction
andPCACorrelateAction
classes, which manages adding/removing correlation overlays to/from theOverlayList
, and manages execution of the correlation.When a 4D
Image
is selected and theCorrelateAction
is invoked, a new 3DImage
is 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
CanvasPanel
that owns this action.
- destroy()[source]¶
Removes listeners from the
DisplayContext
andOverlayList
, 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
OverlayList
changes. 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
Action
is 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
seed
voxel (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
numpy
array containing all of the data.
- Returns
A 3D
numpy
array containing the correlation values.
- __annotations__ = {}¶
- __module__ = 'fsleyes.actions.correlate'¶
- class fsleyes.actions.correlate.PearsonCorrelateAction(overlayList, displayCtx, panel)[source]¶
Bases:
fsleyes.actions.correlate.CorrelateAction
The
PearsonCorrelateAction
is aCorrelateAction
which 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.
- __annotations__ = {}¶
- __module__ = 'fsleyes.actions.correlate'¶