fsleyes.displaycontext.group
This module provides the OverlayGroup class, which allows
the display properties of one or more overlays to be linked.
- class fsleyes.displaycontext.group.OverlayGroup(*args, **kwargs)[source]
Bases:
HasPropertiesAn
OverlayGroupis a group of overlays for which the correspondingDisplayandDisplayOptsproperties are synchronised.The point of the
OverlayGroupis to allow the user to define groups of overlays, so he/she can change display properties on the entire group, instead of having to change display properties on each overlay one by one.Overlays can be added to an
OverlayGroupwith theaddOverlay(), and removed with theremoveOverlay().When an
OverlayGroupis created, it dynamically adds all of the properties which could possibly be linked between overlays to itself, using theprops.HasProperties.addProperty()method. When the first overlay is added to the group, these group properties are set to the display properties of this overlay. Then, the display properties of overlays which are subsequently added to the group will be set to the group display properties.Note
Currently, only a subset of display properties are linked between the overlays in a group. The properties which are linked are hard-coded in the
_groupBindingsdictionary.A possible future FSLeyes enhancement will be to allow the user to specify which display properties within an
OverlayGroupshould be linked.- overlays
The list of overlays in this
OverlayGroup.Warning
Do not add/remove overlays directly to this list - use the
addOverlay()andremoveOverlay()methods instead.
- _groupBindings = {'Display': [], 'NiftiOpts': ['volume', 'volumeDim'], 'VolumeOpts': ['interpolation'], 'Volume3DOpts': ['numSteps', 'numInnerSteps', 'resolution', 'numClipPlanes', 'clipMode', 'clipPosition', 'clipAzimuth', 'clipInclination'], 'LabelOpts': [], 'MeshOpts': ['refImage', 'coordSpace', 'outline', 'outlineWidth', 'wireframe'], 'NiftiVectorOpts': ['orientFlip'], 'LineVectorOpts': ['lineWidth'], 'RGBVectorOpts': ['interpolation'], 'VectorOpts': ['suppressX', 'suppressY', 'suppressZ', 'suppressMode'], 'TensorOpts': ['lighting', 'tensorResolution'], 'TractogramOpts': ['lineWidth', 'resolution', 'subsample']}
This dictionary defines the properties which are bound across
DisplayinstancesDisplayOptssub-class instances, for overlays which are in the same group.
- __init__(displayCtx, overlayList)[source]
Create an
OverlayGroup.- Parameters:
displayCtx – The
DisplayContext.overlayList – The
OverlayList.
- __copy__()[source]
Create a copy of this
OverlayGroup.A custom copy operator is needed due to the way that the
props.HasPropertiesclass works.
- destroy()[source]
Must be called when this
OverlayGroupis no longer needed. Removes all overlays from the group, and removes property listeners.
- addOverlay(overlay)[source]
Add an overlay to this
OverlayGroup.If this is the first overlay to be added, the properties of this
OverlayGroupare set to the overlay display properties. Otherwise, the overlay display properties are set to those of thisOverlayGroup.
- __bindDisplayOpts(target, unbind=False)
Binds or unbinds the properties of the given
targetto the properties of thisOverlayGroup.- Parameters:
target – A
DisplayorDisplayOptsinstance.unbind – Set to
Trueto bind the properties,Falseto unbind them.
- __overlayListChanged(*a)
Called when overlays are added/removed to/from the
OverlayList. Makes sure that theoverlayslist for this group does not contain any overlays that have been removed.
- __annotations__ = {}
- __module__ = 'fsleyes.displaycontext.group'
- __overlayTypeChanged(value, valid, display, name)
This method is called when the
Display.overlayTypeproperty for an overlay in the group changes.It makes sure that the display properties of the new
DisplayOptsinstance are bound to the group properties.