fsleyes.plotting.dataseries

This module provides the DataSeries class, the base class for classes used by the PlotCanvas for plotting data.

class fsleyes.plotting.dataseries.DataSeries(overlay, overlayList, displayCtx, plotCanvas)[source]

Bases: __main__.docbuilder.run.<locals>.MockClass

A DataSeries instance encapsulates some data to be plotted by a PlotCanvas, possibly with the data extracted from an overlay in the OverlayList.

Sub-class implementations must:

The overlay is accessible as an instance attribute called overlay.

Note

Some DataSeries instances may not be associated with an overlay (e.g. series imported loaded a text file). In this case, the overlay attribute will be None.

Each``DataSeries`` instance is plotted as a line, with the line style defined by properties on the DataSeries instance, such as colour, lineWidth etc.

colour = <MagicMock name='mock.Colour()' id='140604700997856'>

Line colour.

enabled = <MagicMock name='mock.Boolean()' id='140604701766320'>

Draw or not draw?

alpha = <MagicMock name='mock.Real()' id='140604700759312'>

Line transparency.

label = <MagicMock name='mock.String()' id='140604702404432'>

Line label (used in the plot legend).

lineWidth = <MagicMock name='mock.Choice()' id='140604702016944'>

Line width.

lineStyle = <MagicMock name='mock.Choice()' id='140604702016944'>

Line style. See https://matplotlib.org/gallery/lines_bars_and_markers/linestyles.html

__init__(overlay, overlayList, displayCtx, plotCanvas)[source]

Create a DataSeries.

Parameters
  • overlay – The overlay from which the data to be plotted is retrieved. May be None.

  • overlayList – The OverlayList instance.

  • displayCtx – The DisplayContext instance.

  • plotCanvas – The PlotCanvas that owns this DataSeries.

__del__()[source]

Prints a log message.

__hash__()[source]

Returns a hash for this DataSeries instance.

property name

Returns a unique name for this DataSeries instance.

property overlay

Returns the overlay associated with this DataSeries instance.

property overlayList

Returns the OverlayList.

property displayCtx

Returns the DisplayContext.

property plotCanvas

Returns the PlotCanvas that owns this DataSeries instance.

destroy()[source]

This method must be called when this DataSeries instance is no longer needed. This implementation may be overridden by sub-classes which need to perform any clean-up operations. Sub-class implementations should call this implementation.

redrawProperties()[source]

Returns a list of all properties which, when their values change, should result in this DataSeries being re-plotted. This method may be overridden by sub-classes.

extraSeries()[source]

Some DataSeries types have additional DataSeries associated with them (see e.g. the FEATTimeSeries class). This method can be overridden to return a list of these extra DataSeries instances. The default implementation returns an empty list.

setData(xdata, ydata)[source]

Set the data to be plotted. This method is irrelevant if a DataSeries sub-class has overridden getData().

getData()[source]

This method should be overridden by sub-classes. It must return the data to be plotted, as a tuple of the form:

(xdata, ydata)

where xdata and ydata are sequences containing the x/y data to be plotted.

The default implementation returns the data that has been set via the setData() method.

__annotations__ = {}
__module__ = 'fsleyes.plotting.dataseries'
class fsleyes.plotting.dataseries.VoxelDataSeries(*args, **kwargs)[source]

Bases: fsleyes.plotting.dataseries.DataSeries

The VoxelDataSeries class is a DataSeries class which provides some functionality useful to data series that represent data from a voxel in an Image overlay.

It contains a built-in cache which is used to prevent repeated access to data from the same voxel.

Sub-classes may need to override:

  • the currentVoxelLocation() method, which generates the location index for the current location, and which is used as the unique cache key when the corresponding data is cached

  • The currentVoxelData() method, which retrieves and/or calculates the data at the current location. This is the data which is cached, and which is returned by the dataAtCurrentVoxel() method.

__init__(*args, **kwargs)[source]

Create a VoxelDataSeries. All arguments are passed through to the DataSeries constructor.

__annotations__ = {}
__module__ = 'fsleyes.plotting.dataseries'
makeLabel()[source]

Returns a string representation of this VoxelDataSeries instance.

getData()[source]

Returns the (xdata, ydata) at the current voxel location.

This method may be overridden by sub-classes.

dataAtCurrentVoxel = <MagicMock name='mock.utils.idle.mutex()' id='140604698305792'>
currentVoxelLocation()[source]

Used by dataAtCurrentVoxel(). Returns the current voxel location. This is used as a key for the voxel data cache implemented within the dataAtCurrentVoxel() method, and subsequently passed to the currentVoxelData() method.

This method may be overridden by sub-classes.

currentVoxelData(location)[source]

Used by dataAtCurrentVoxel(). Returns the data at the specified location.

This method may be overridden by sub-classes.