fsleyes.plugins.controls.clusterpanel
¶
This module provides the ClusterPanel
class, a FSLeyes control
panel for viewing cluster results from a FEAT analysis.
-
class
fsleyes.plugins.controls.clusterpanel.
ClusterPanel
(parent, overlayList, displayCtx, viewPanel)[source]¶ Bases:
fsleyes.controls.controlpanel.ControlPanel
The
ClusterPanel
shows a table of cluster results from the analysis associated with aFEATImage
overlay. AClusterPanel
looks something like the following:The
ClusterPanel
contains controls which allow the user to:Select the COPE for which cluster results are displayed
Add a Z statistic overlay for the currently displayed COPE
Add a cluster mask overlay for the currently displayed COPE
Navigate to the Z maximum location, Z centre-of-gravity location, or COPE maximum location, for a specific cluster.
When an overlay is selected (detected via the
DisplayContext.selectedOverlay
property), aClusterPanel
tries to identify the FEAT analysis associated with the overlay. If the overlay is aFEATImage
, then no work needs to be done. Otherwise, theClusterPanel
uses functions in thefeatanalysis
module to identify the FEAT directory. Ultimately, a reference to aFEATImage
associated with the currently selected overlay is obtained, so theClusterPanel
can retrieve contrast and cluster information.A
ClusterPanel
uses aWidgetGrid
to display information about the clusters associated with a contrast. Because creating all of the widgets contained in theWidgetGrid
is expensive, aClusterPanel
creates (on demand) and cachesWidgetGrid
instances for allFEATImage
overlay and contrasts. This means that when the user changes the currently selected overlay, or the current contrast, the displayed cluster information is updated quickly.-
static
supportedViews
()[source]¶ The
ClusterPanel
is restricted for use withOrthoPanel
,LightBoxPanel
andScene3DPanel
views.
-
static
defaultLayout
()[source]¶ Returns a dictionary containing layout settings to be passed to
ViewPanel.togglePanel
.
-
__init__
(parent, overlayList, displayCtx, viewPanel)[source]¶ Create a
ClusterPanel
.- Parameters
parent – The
wx
parent object.overlayList – The
OverlayList
instance.displayCtx – The
DisplayContext
instance.viewPanel – The
ViewPanel
instance.
-
destroy
()[source]¶ Must be called when this
ClusterPanel
is no longer needed. Removes some property listeners, and callsControlPanel.destroy()
.
-
__calcMinSize
()¶ Figures out the minimum size that this
ClusterPanel
should have. Called by__init__()
.When the
ClusterPanel
is created, the COPE combo box is not populated, so has no minimum size. Here, we figure out a good minimum size for it. We can then calculate a good minimum size for the entire panel.
-
__disable
(message)¶ Disables the
ClusterPanel
, and displays the given message. Called when the selected overlay is not associated with a FEAT analysis, or when cluster results cannot be displayed for some reason.
-
__enable
()¶ Enables the
ClusterPanel
. This amounts to hiding the disabled message panel, and showing the appropriateWidgetGrid
for the currently selected overlay / contrast. The appropriateWidgetGrid
is assumed to have already been created.
-
__statSelected
(ev=None)¶ Called when a COPE is selected. Retrieves a cached
WidgetGrid
, or creates a new one (via the__genClusterGrid()
method) which displays information about the clusters associated with the currently selected contrast.
-
__addZStatsClick
(ev)¶ Called when the Add Z statistics button is pushed. Retrieves the Z statistic image for the current COPE (see the
FEATImage.getZStats()
method), and adds it as an overlay to theOverlayList
.
-
__addClustMaskClick
(ev)¶ Called when the Add cluster mask button is pushed. Retrieves the cluster mask image for the currewnt contrast (see the
FEATImage.getClusterMask()
method)
-
__genClusterGrid
(overlay, featImage, contrast, clusters)¶ Creates and returns a
WidgetGrid
which contains the given list of clusters, which are related to the given contrast.Note
This method assumes that the given
overlay
is anImage
which has the same voxel dimensions as, and shares the the same world coordinate system as thefeatImage
.- Parameters
overlay – The overlay for which clusters are currently being displayed.
featImage – The
FEATImage
to which the clusters are related.contrast – The (0-indexed) number of the contrast to which the clusters are related.
clusters – A sequence of objects, each representing one cluster. See the
FEATImage.clusterResults()
method.
-
__overlayListChanged
(*a)¶ Called when the
OverlayList
changes. Destroys any cachedWidgetGrid
instances as needed, updates the Add Z statistic and Add cluster mask buttons, in case the user removed them, and calls__selectedOverlayChanged()
.
-
__enableOverlayButtons
()¶ Enables/disables the Add Z statistic and Add cluster mask buttons depending on whether the corresponding overlays are in the
OverlayList
.
-
__selectedOverlayChanged
(*a)¶ Called when the
DisplayContext.selectedOverlay
changes, and by the__overlayListChanged()
method.If the newly selected overlay is a
FEATImage
(or is otherwise associated with a FEAT analysis) which has cluster results, they are loaded in, and displayed on aWidgetGrid
.
-
__module__
= 'fsleyes.plugins.controls.clusterpanel'¶