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.ControlPanelThe
ClusterPanelshows a table of cluster results from the analysis associated with aFEATImageoverlay. AClusterPanellooks something like the following:
The
ClusterPanelcontains 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.selectedOverlayproperty), aClusterPaneltries to identify the FEAT analysis associated with the overlay. If the overlay is aFEATImage, then no work needs to be done. Otherwise, theClusterPaneluses functions in thefeatanalysismodule to identify the FEAT directory. Ultimately, a reference to aFEATImageassociated with the currently selected overlay is obtained, so theClusterPanelcan retrieve contrast and cluster information.A
ClusterPaneluses aWidgetGridto display information about the clusters associated with a contrast. Because creating all of the widgets contained in theWidgetGridis expensive, aClusterPanelcreates (on demand) and cachesWidgetGridinstances for allFEATImageoverlay 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
ClusterPanelis restricted for use withOrthoPanel,LightBoxPanelandScene3DPanelviews.
-
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
wxparent object.overlayList – The
OverlayListinstance.displayCtx – The
DisplayContextinstance.viewPanel – The
ViewPanelinstance.
-
destroy()[source]¶ Must be called when this
ClusterPanelis no longer needed. Removes some property listeners, and callsControlPanel.destroy().
-
__calcMinSize()¶ Figures out the minimum size that this
ClusterPanelshould have. Called by__init__().When the
ClusterPanelis 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 appropriateWidgetGridfor the currently selected overlay / contrast. The appropriateWidgetGridis 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
WidgetGridwhich contains the given list of clusters, which are related to the given contrast.Note
This method assumes that the given
overlayis anImagewhich 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
FEATImageto 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
OverlayListchanges. Destroys any cachedWidgetGridinstances 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.selectedOverlaychanges, 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'¶