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(*args, **kwargs)[source]
Bases:
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 or f-test for which cluster results are displayed
Add a Z statistic overlay for the currently displayed COPE/f-test
Add a cluster mask overlay for the currently displayed COPE/f-test
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().
- property statSelect
Return a reference to the
wx.Choicewidget used to select the current contrast/f-test.
- property addZStats
Return a reference to the
wx.Buttonwidget used to add the Z-statistic image for the current test to the overlay list.
- property addClustMask
Return a reference to the
wx.Buttonwidget used to add the cluster mask image for the current test to the overlay list.
- __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 or f-test.
- __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, testidx)
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.testidx – The internal index identifying the contrast/f-test.
- __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. The buttons are only enabled if the corresponding overlays are not already loaded.
- __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.
- __lookupFEATImage(overlay)
Searches for a
FEATImagefor the FEAT analysis thatoverlayis associated with. Loads and caches if if necessary. ReturnsNoneifoverlayis not associated with a FEAT analysis.
- __loadClusterResults(featImage)
Loads cluster results for all contrasts and f-tests from the FEAT analysis for
featImage. Returns a list of tuples, with each tuple containing:The test index, starting from 0, relative to the total number of contrasts/f-tests. Contrasts and f-tests are indexed separately.
A boolean indicating whether the test is a contrast or an f-test
The test name
A list of cluster results (see
featanalysis.loadClusterResults()). This will beNoneif the results could not be loaded for some reason.
- __annotations__ = {}
- __module__ = 'fsleyes.plugins.controls.clusterpanel'