fsleyes.plugins.controls.atlaspanel.atlaspanel
¶
This module provides the AtlasPanel
, a FSLeyes control panel
which allows the user to browse the FSL atlas images. See the
fsleyes
package documentation for more details on control panels,
and the atlases
module for more details on the atlases available in
FSL.
- class fsleyes.plugins.controls.atlaspanel.atlaspanel.AtlasPanel(parent, overlayList, displayCtx, viewPanel)[source]¶
Bases:
fsleyes.controls.controlpanel.ControlPanel
An
AtlasPanel
is aControlPanel
which allows the user to view atlas information, and to browse through the atlases that come shipped with FSL. TheAtlasPanel
interface is provided by some sub-panels, which are displayed in afsleyes_widgets.Notebook
panel. TheAtlasPanel
itself provides a number of convenience methods that are used by these sub-panels:Displays information for the current
DisplayContext.location
from atlases selected by the user.Allows the user to search through all atlases for specific regions, and to toggle on/off overlays for those regions.
Allows the user to add/remove atlases.
Loading atlases
The
AtlasPanel
class provides theloadAtlas()
method, which is used by sub-panels to load atlas images.Toggling atlas overlays
Both of the sub-panels allow the user to add/remove overlays to/from the
OverlayList
. The following overlay types can be added:A complete summary
LabelAtlas
, which is a 3D image where each region has a discrete integer label. These images are added with aDisplay.overlayType
oflabel
.A mask image containing a single region, extracted from a
LabelAtlas
. These images are added with aDisplay.overlayType
ofmask
.A 3D image containing the statistic image for a single region, extracted from a
StatisticAtlas
. These images are added with aDisplay.overlayType
ofvolume
.
The following methods allow these overlays to be toggled on/off, and to query their state:
Adds or removes the specified overlay to/from the
OverlayList
.Returns a name to be used for the specified atlas (see the section on atlas names).
Returns
True
if the specified atlas overlay is in theOverlayList
,False
otherwise.Atlas overlay names
When an atlas overlay is added, its
Image.name
(and subsequently itsDisplay.name
) are set to a name which has the following structure:atlasID/overlayType/regionName
where:
atlasID
is the atlas identifier (see theatlases
module).overlayType
is eitherlabel
,prob
, orstat
, depending on whether the overlay is a discrete label image, a probaility image, or a statistic image..regionName
is the name of the region, orall
if the overlay is a completeLabelAtlas
.
This name is used by the
AtlasPanel
to identify the overlay in theOverlayList
.Warning
If the name of these overlays is changed, the
AtlasPanel
will not be able to find them in theOverlayList
, and thetoggleOverlay()
andgetOverlayState()
methods will stop working properly. So don’t change the atlas overlay names!Locating regions
Finally, the
locateRegion()
method allows theDisplayContext.location
to be moved to the location of a specific region in a specific atlas.- static supportedViews()[source]¶
The
MelodicClassificationPanel
is restricted for use withOrthoPanel
,LightBoxPanel
andScene3DPanel
viewws.
- static defaultLayout()[source]¶
Returns a dictionary of arguments to be passed to the
ViewPanel.togglePanel()
method.
- __init__(parent, overlayList, displayCtx, viewPanel)[source]¶
Create an
AtlasPanel
.- Parameters
parent – The
wx
parent object.overlayList – The
OverlayList
instance.displayCtx – The
DisplayContext
instance.viewPanel – The
ViewPanel
instance.
- destroy()[source]¶
Must be called on when this
AtlasPanel
is no longer needed.Calls the
destroy
methods of theAtlasInfoPanel
andAtlasOverlayPanel
, and then callsControlPanel.destroy()
.
- enableAtlasPanel(enable=True)[source]¶
Disables/enables the
AtlasPanel
which contains thisAtlasOverlayPanel
. This method is used byOverlayListWidget
instances.This method keeps a count of the number of times that it has been called - the count is increased every time a request is made to disable the
AtlasPanel
, and decreased on requests to enable it. TheAtlasPanel
is only enabled when the count reaches 0.This ugly method solves an awkward problem - the
AtlasOverlayPanel
disables theAtlasPanel
when an atlas overlay is toggled on/off (via anOverlayListWidget
), and when an atlas region list is being generated (via the__onAtlasSelect()
method). If both of these things occur at the same time, theAtlasPanel
could be prematurely re-enabled. This method overcomes this problem.
- loadAtlas(atlasID, summary, onLoad=None, onError=None, matchResolution=True)[source]¶
Loads the atlas image with the specified ID. The atlas is loaded asynchronously (via the
idle
module), as it can take some time. Use the onLoad argument if you need to do something when the atlas has been loaded.- Parameters
onLoad – Optional. A function which is called when the atlas has been loaded, and which is passed the loaded
Atlas
image.onError – Optional. A function which is called if the atlas loading job raises an error. Passed the
Exception
that was raised.matchResolution – If
True
(the default), the version of the atlas with the most suitable resolution, based on the current contents of theOverlayList
, is loaded.
See the
atlases.loadAtlas()
function for details on the other arguments.
- __getSuitableResolution(desc, matchResolution=True)¶
Used by the
loadAtlas()
method. Determines a suitable atlas resolution to load, based on the current contents of theOverlayList
.
- getOverlayName(atlasID, labelIdx, summary)[source]¶
Returns a name to be used for the specified atlas (see the section on atlas names).
- Parameters
atlasID – Atlas identifier
labelIdx – Label index, or
None
for a complete atlas.summary –
True
corresponds to a label atlas,False
to a probabilistic atlas.
- getOverlayState(atlasID, labelIdx, summary)[source]¶
Returns
True
if the specified atlas overlay is in theOverlayList
,False
otherwise. SeegetOverlayName()
for details on the arguments.
- toggleOverlay(atlasID, labelIdx, summary, onLoad=None, onError=None)[source]¶
Adds or removes the specified overlay to/from the
OverlayList
.- Parameters
onLoad – Optional function to be called when the overlay has been added/removed.
onError – Optional function to be called if an error occurs while loading an overlay.
See
getOverlayName()
for details on the other arguments.
- locateRegion(atlasID, labelIdx)[source]¶
Moves the
DisplayContext.location
to the specified region in the specified atlas. See theAtlasDescription
class for details on atlas identifiers/label indices.- Parameters
atlasID – Atlas identifier
labelIdx – Label index
- __overlayListChanged(*a)¶
Called when the
OverlayList
changes.Makes sure that the
AtlasOverlayPanel
state is up to date - see theAtlasOverlayPanel.setOverlayState()
method.
- __annotations__ = {}¶
- __module__ = 'fsleyes.plugins.controls.atlaspanel.atlaspanel'¶