fsleyes.profiles.histogramprofile¶
This module provides the HistogramProfile class, an interaction
profile for the HistogramPanel.
-
class
fsleyes.profiles.histogramprofile.HistogramProfile(viewPanel, overlayList, displayCtx)[source]¶ Bases:
fsleyes.profiles.plotprofile.PlotProfileThe
HistogramProfileclass is an interaction profile for use withHistogramPanelviews. In addition to the behaviour provided byPlotProfile, theHistogramProfileimplements theoverlayRangemode, which allows the user to select theHistogramSeries.showOverlayRange, for the currently selected overlay, by clicking and dragging on the plot. This behaviour is only enabled when theHistogramSeries.showOverlaypropertyTrue.For each plotted
HistogramSeries, theHistogramProfileclass creates and manages aHistogramOverlay(which shows a 3D overlay of the voxels included in the histogram), and aRangePolygon(which shows the 3D overlay range on the plot). The user can click and drag on the plot to adjust the extent of theRangePolygon, which is linked to the maskImagemanaged by theHistogramOverlay.-
static
supportedView()[source]¶ Returns the
HistogramPanelclass.
-
static
tempModes()[source]¶ Returns the temporary mode map for the
HistogramProfile, which controls the use of modifier keys to temporarily enter other interaction modes.
-
__init__(viewPanel, overlayList, displayCtx)[source]¶ Create a
HistogramProfile.- Parameters
viewPanel – A
HistogramPanelinstance.overlayList – The
OverlayListinstance.displayCtx – The
DisplayContextinstance.
-
destroy()[source]¶ Must be called when this
HistogramProfileis no longer needed. Removes property listeners, and cleans some things up.
-
__overlayListChanged(*a)¶ Called when the
OverlayListchanges. Cleans up some things related to overlays that are no longer in the list.
-
__registerHistogramSeries(hs)¶ Called when a new
HistogramSeriesis plotted. Creates aHistogramOverlayand aRangePolygonfor the series.
-
__deregisterHistogramSeries(hs)¶ Called when a
HistogramSeriesis no longer to be plotted. Destroys theHistogramOverlayandRangePolygonassociated with the series.
-
__selectedOverlayChanged(*a)¶ Called when the
DisplayContext.selectedOverlaychanges. Makes sure that aHistogramOverlayandRangePolygonexist for the newly selected overlay.
-
__updateShowOverlayRange(datax, which=False)¶ Called by the
overlayRangemouse event handlers. Updates theHistogramSeries.showOverlayRange.- Parameters
datax – X data coordinate corresponding to the mouse position.
which – Used to keep track of which value in the
showOverlayRangeproperty the user is currently modifying. On mouse down events, this method figures out which range should be modified, and returns either'lo'or'hi'. On subsequent calls to this method (on mouse drag and mouse up events), that return value should be passed back into this method so that the same value continues to get modified.
-
_overlayRangeModeLeftMouseDown(ev, canvas, mousePos, canvasPos)[source]¶ Called on mouse down events in
overlayRangemode. Calls the__updateShowOverlayRange()method.
-
_overlayRangeModeLeftMouseDrag(ev, canvas, mousePos, canvasPos)[source]¶ Called on mouse down events in
overlayRangemode. Calls the__updateShowOverlayRange()method.
-
_overlayRangeModeLeftMouseUp(ev, canvas, mousePos, canvasPos)[source]¶ Called on mouse up events in
overlayRangemode. Clears some internal state.
-
__module__= 'fsleyes.profiles.histogramprofile'¶
-
static
-
class
fsleyes.profiles.histogramprofile.RangePolygon(hs, hsPanel, *args, **kwargs)[source]¶ Bases:
__main__.docbuilder.run.<locals>.MockClassThe
RangePolygonclass is amatplotlib.patches.Polygonwhich is used to display a data range over aHistogramSeriesplot.Whenever any property on the
HistogramSerieschanges (and on calls toupdatePolygon()), the vertices of a polygon spanning theHistogramSeries.showOverlayRangeproperty are generated.The
RangePolygonautomatically adds and removes itself to thePlotPanel.artistslist of the owningHistogramPanelaccording to the values of theHistogramSeries.showOverlayandDataSeries.enabledproperties.-
__init__(hs, hsPanel, *args, **kwargs)[source]¶ Create a
RangePolygon.- Parameters
hs – The
HistogramSerieshsPanel – The
HistogramPanel
All other arguments are passed through to the
Polygon.__init__method.
-
destroy()[source]¶ Must be called when this
RangePolygonis no longer needed.Removes property listeners and cleans up references.
-
asyncUpdatePolygon(*a, **kwa)[source]¶ Asynchronously schedule
updatePolygon()viaidle.idle().
-
updatePolygon(*a, **kwa)[source]¶ Called whenever any property changes on the
HistogramSeries, and called manually by theHistogramProfile.Adds/removes this
RangePolygonto thePlotPanel.artistslist and regenerates the polygon vertices as needed.
-
__module__= 'fsleyes.profiles.histogramprofile'¶
-
-
class
fsleyes.profiles.histogramprofile.HistogramOverlay(histSeries, overlay, displayCtx, overlayList)[source]¶ Bases:
objectThe
HistogramOverlayclass manages the creation, destruction, and display of aProxyImageoverlay which displays the voxels that are included in a histogram plot. The user can toggle the display of this overlay via theHistogramSeries.showOverlayproperty.-
__init__(histSeries, overlay, displayCtx, overlayList)[source]¶ Create a
HistogramOverlay.- Parameters
histSeries – The
HistogramSeriesinstance which owns thisHistobgramOverlay.overlay – The
Imageoverlay associated with thisHistogramOverlay.displayCtx – The
DisplayContextinstance.overlayList – The
OverlayListinstance.
-
destroy()[source]¶ Must be called when this
HistogramOverlayis no longer needed. Removes property listeners and clears references.
-
__overlayTypeChanged(*a)¶ Called when the
Display.overlayTypechanges. De/re-registers a listener on theNiftiOpts.volumeproperty (asOptsinstances are destroyed/re-created when theoverlayTypechanges).
-
__volumeChanged(*a)¶ Called when the
NiftiOpts.volumeproperty changes. Makes sure that the 3d mask overlay is up to date (if it is being shown).
-
__overlayListChanged(*a)¶ Called when the
OverlayListchanges.If a 3D mask overlay was being shown, and it has been removed from the
OverlayList, theHistogramSeries.showOverlayproperty is updated accordingly.
-
__showOverlayChanged(*args, **kwargs)¶ Called when the
HistogramSeries.showOverlayproperty changes.Adds/removes a 3D mask
Imageto theOverlayList, which highlights the voxels that have been included in the histogram. TheMaskOpts.thresholdproperty is bound to theHistogramSeries.showOverlayRangeproperty, so the masked voxels are updated whenever the histogram overlay range changes, and vice versa.- Parameters
force – If
True, andHistogramSeries.showOverlay is True, the mask overlay is recreated even if one already exists.
-
__dict__= mappingproxy({'__module__': 'fsleyes.profiles.histogramprofile', '__doc__': 'The ``HistogramOverlay`` class manages the creation, destruction, and\n display of a :class:`.ProxyImage` overlay which displays the voxels that\n are included in a histogram plot. The user can toggle the display of this\n overlay via the :attr:`.HistogramSeries.showOverlay` property.\n ', '__init__': <function HistogramOverlay.__init__>, 'destroy': <function HistogramOverlay.destroy>, '_HistogramOverlay__overlayTypeChanged': <function HistogramOverlay.__overlayTypeChanged>, '_HistogramOverlay__volumeChanged': <function HistogramOverlay.__volumeChanged>, '_HistogramOverlay__overlayListChanged': <function HistogramOverlay.__overlayListChanged>, '_HistogramOverlay__showOverlayChanged': <function HistogramOverlay.__showOverlayChanged>, '__dict__': <attribute '__dict__' of 'HistogramOverlay' objects>, '__weakref__': <attribute '__weakref__' of 'HistogramOverlay' objects>, '__annotations__': {}})¶
-
__module__= 'fsleyes.profiles.histogramprofile'¶
-
__weakref__¶ list of weak references to the object (if defined)
-