fsleyes.plotting.timeseries

This module provides a number of DataSeries sub-classes which are use by the TimeSeriesPanel. The following classes are provided:

VoxelTimeSeries

A VoxelTimeSeries is a VoxelDataSeries which represents time series data.

ComplexTimeSeries

A VoxelTimeSeries to display time series from 4D complex images.

ImaginaryTimeSeries

An ImaginaryTimeSeries represents the imaginary component of a complex-valued image.

MagnitudeTimeSeries

An MagnitudeTimeSeries represents the magnitude of a complex-valued image.

PhaseTimeSeries

An PhaseTimeSeries represents the phase of a complex-valued image.

FEATTimeSeries

A VoxelTimeSeries class for use with FEATImage instances, containing some extra FEAT specific options.

FEATPartialFitTimeSeries

A VoxelTimeSeries class which represents the partial model fit of an EV or contrast from a FEAT analysis at a specific voxel.

FEATEVTimeSeries

A TimeSeries class which represents the time course of an EV from a FEAT analysis.

FEATResidualTimeSeries

A VoxelTimeSeries class which represents the time course of the residuals from a FEAT analysis at a specific voxel.

FEATModelFitTimeSeries

A TimeSeries class which represents the time course for a model fit from a FEAT analysis at a specific voxel.

MelodicTimeSeries

A DataSeries class which encapsulates the time course for one component of a MelodicImage.

MeshTimeSeries

A MeshTimeSeries object encapsulates the time course for a Mesh overlay which has some time series vertex data associated with it.

class fsleyes.plotting.timeseries.VoxelTimeSeries(*args, **kwargs)[source]

Bases: fsleyes.plotting.dataseries.VoxelDataSeries

A VoxelTimeSeries is a VoxelDataSeries which represents time series data.

__annotations__ = {}
__module__ = 'fsleyes.plotting.timeseries'
class fsleyes.plotting.timeseries.ComplexTimeSeries(overlay, overlayList, displayCtx, plotCanvas)[source]

Bases: fsleyes.plotting.timeseries.VoxelTimeSeries

A VoxelTimeSeries to display time series from 4D complex images. The getData() method returns the real component of the data..

The extraSeries() method returns additional series based on the values of the plotImaginary, plotMagnitude and plotPhase properties. The extraSeries() method will return instances of the following classes:

ImaginaryTimeSeries

An ImaginaryTimeSeries represents the imaginary component of a complex-valued image.

MagnitudeTimeSeries

An MagnitudeTimeSeries represents the magnitude of a complex-valued image.

PhaseTimeSeries

An PhaseTimeSeries represents the phase of a complex-valued image.

plotReal = <MagicMock name='mock.Boolean()' id='139907488986064'>

If True, the getData() method will return the real component time series data.

plotImaginary = <MagicMock name='mock.Boolean()' id='139907488986064'>

If True, the extraSeries() method will return an ImaginaryTimeSeries instance, containing the imaginary component data.

plotMagnitude = <MagicMock name='mock.Boolean()' id='139907488986064'>

If True, the extraSeries() method will return a MagnitudeTimeSeries instance, containing the complex magnitude.

plotPhase = <MagicMock name='mock.Boolean()' id='139907488986064'>

If True, the extraSeries() method will return a PhaseTimeSeries instance, containing the complex phase.

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

Create a ComplexTimeSeries. All arguments are passed through to the VoxelTimeSeries constructor.

makeLabel()[source]

Returns a string representation of this ComplexTimeSeries instance.

getData()[source]

If plotReal is true, returns the real component of the complex data. Otherwise returns (None, None).

extraSeries()[source]

Returns a list of additional series to be plotted, based on the values of the plotImaginary, plotMagnitude and plotPhase properties.

dataAtCurrentVoxel()[source]

Returns the real component of the data at the current voxel.

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

Bases: fsleyes.plotting.timeseries.VoxelTimeSeries

An ImaginaryTimeSeries represents the imaginary component of a complex-valued image. ImaginaryTimeSeries instances are created by ComplexTimeSeries instances.

makeLabel()[source]

Returns a string representation of this ImaginaryTimeSeries instance.

dataAtCurrentVoxel()[source]

Returns the imaginary component of the data at the current voxel.

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

Bases: fsleyes.plotting.timeseries.VoxelTimeSeries

An MagnitudeTimeSeries represents the magnitude of a complex-valued image. MagnitudeTimeSeries instances are created by ComplexTimeSeries instances.

makeLabel()[source]

Returns a string representation of this MagnitudeTimeSeries instance.

dataAtCurrentVoxel()[source]

Returns the magnitude of the data at the current voxel.

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

Bases: fsleyes.plotting.timeseries.VoxelTimeSeries

An PhaseTimeSeries represents the phase of a complex-valued image. PhaseTimeSeries instances are created by ComplexTimeSeries instances.

makeLabel()[source]

Returns a string representation of this PhaseTimeSeries instance.

dataAtCurrentVoxel()[source]

Returns the phase of the data at the current voxel.

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

Bases: fsleyes.plotting.timeseries.VoxelTimeSeries

A VoxelTimeSeries class for use with FEATImage instances, containing some extra FEAT specific options.

The FEATTimeSeries class acts as a container for several TimeSeries instances, each of which represent some part of a FEAT analysis. The data returned by a call to getData() on a FEATTimeSeries instance returns the fMRI time series data (filtered_func_data in the .feat directory).

The extraSeries() method may be used to retrieve a list of all the other TimeSeries instances which are associated with the FEATTimeSeries instance - all of these DataSeries instances, in addition to this FEATTimeSeries instasnce, should be plotted.

For example, if the plotData and plotFullModelFit settings are True, the extraSeries() method will return a list containing one TimeSeries instance, containing the full model fit, for the voxel in question.

The following classes are used to represent the various parts of a FEAT analysis:

FEATEVTimeSeries

A TimeSeries class which represents the time course of an EV from a FEAT analysis.

FEATResidualTimeSeries

A VoxelTimeSeries class which represents the time course of the residuals from a FEAT analysis at a specific voxel.

FEATPartialFitTimeSeries

A VoxelTimeSeries class which represents the partial model fit of an EV or contrast from a FEAT analysis at a specific voxel.

FEATModelFitTimeSeries

A TimeSeries class which represents the time course for a model fit from a FEAT analysis at a specific voxel.

plotData = <MagicMock name='mock.Boolean()' id='139907488986064'>

If True, the FEAT input data is plotted.

plotResiduals = <MagicMock name='mock.Boolean()' id='139907488986064'>

If True, the FEAT model residuals are plotted.

plotEVs = <MagicMock name='mock.List()' id='139907489405760'>

A list of Boolean properties, one for each EV in the FEAT analysis. For elements that are True, the corresponding FEAT EV time course is plotted.

plotPEFits = <MagicMock name='mock.List()' id='139907489405760'>

A list of Boolean properties, one for each EV in the FEAT analysis. For elements that are True, the model fit for the corresponding FEAT EV is plotted.

plotCOPEFits = <MagicMock name='mock.List()' id='139907489405760'>

A list of Boolean properties, one for each EV in the FEAT analysis. For elements that are True, the model fit for the corresponding FEAT contrast is plotted.

plotPartial = <MagicMock name='mock.Choice()' id='139907488217072'>

Plot the raw data, after regression against a chosen EV or contrast. The options are populated in the __init__() method.

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

Create a FEATTimeSeries.

All arguments are passed through to the VoxelTimeSeries constructor.

plotFullModelFit = <MagicMock name='mock.Boolean()' id='139907488986064'>

If True, the FEAT full model fit is plotted.

getData()[source]

Returns the fMRI time series data at the current voxel. Or, if plotData is False, returns (None, None).

extraSeries()[source]

Returns a list containing all of the TimeSeries instances which should be plotted in place of this FEATTimeSeries.

__getContrast(fitType, idx)

Returns a contrast vector for the given model fit type, and index.

Parameters
  • fitType – either 'full', 'pe', or 'cope'. If 'full', the idx argument is ignored.

  • idx – The EV or contrast index for 'pe' or 'cope' model fits.

__createModelTs(tsType, *args, **kwargs)

Creates a TimeSeries instance of the given tsType, and sets its display settings according to those of this FEATTimeSeries.

Parameters
__plotPartialChanged(*a)

Called when the plotPartial setting changes.

If necessary, creates and caches a FEATPartialFitTimeSeries instance.

__plotResidualsChanged(*a)

Called when the plotResiduals setting changes.

If necessary, creates and caches a FEATResidualTimeSeries instance.

__plotEVChanged(*a)

Called when the plotEVs setting changes.

If necessary, creates and caches one or more FEATEVTimeSeries instances.

__plotCOPEFitChanged(*a)

Called when the plotCOPEFits setting changes.

If necessary, creates and caches one or more FEATModelFitTimeSeries instances.

__plotPEFitChanged(*a)

Called when the plotPEFits setting changes.

If necessary, creates and caches one or more FEATModelFitTimeSeries instances.

__plotFullModelFitChanged(*a)

Called when the plotFullModelFit setting changes.

If necessary, creates and caches a FEATModelFitTimeSeries instance.

__annotations__ = {}
__module__ = 'fsleyes.plotting.timeseries'
class fsleyes.plotting.timeseries.FEATPartialFitTimeSeries(overlay, overlayList, displayCtx, plotCanvas, parentTs, contrast, fitType, idx)[source]

Bases: fsleyes.plotting.timeseries.VoxelTimeSeries

A VoxelTimeSeries class which represents the partial model fit of an EV or contrast from a FEAT analysis at a specific voxel. Instances of this class are created by the FEATTimeSeries class.

__init__(overlay, overlayList, displayCtx, plotCanvas, parentTs, contrast, fitType, idx)[source]

Create a FEATPartialFitTimeSeries.

Parameters
  • overlay – The FEATImage instance to extract the data from.

  • overlayList – The OverlayList instance.

  • displayCtx – The DisplayContext instance.

  • plotCanvas – The TimeSeriesPanel which owns this FEATPartialFitTimeSeries.

  • parentTs – The FEATTimeSeries instance that has created this FEATPartialFitTimeSeries.

  • contrast – The contrast vector to calculate the partial model fit for.

  • fitType – The model fit type, either 'full', 'pe' or 'cope'.

  • idx – If the model fit type is 'pe' or 'cope', the EV/contrast index.

dataAtCurrentVoxel()[source]

Returns the partial model fit for the voxel and model fit type specified in the constructop.

See the FEATImage.partialFit() method.

__annotations__ = {}
__module__ = 'fsleyes.plotting.timeseries'
class fsleyes.plotting.timeseries.FEATEVTimeSeries(overlay, overlayList, displayCtx, plotCanvas, parentTs, idx)[source]

Bases: fsleyes.plotting.dataseries.DataSeries

A TimeSeries class which represents the time course of an EV from a FEAT analysis. Instances of this class are created by the FEATTimeSeries class.

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

Create a FEATEVTimeSeries.

Parameters
  • overlay – The FEATImage instance to extract the data from.

  • overlayList – The OverlayList instance.

  • displayCtx – The DisplayContext instance.

  • plotCanvas – The TimeSeriesPanel which owns this FEATEVTimeSeries.

  • parentTs – The FEATTimeSeries instance that has created this FEATEVTimeSeries.

  • idx – The EV index.

makeLabel()[source]

Returns a string representation of this FEATEVTimeSeries instance.

getData()[source]

Returns the time course of the EV specified in the constructor.

__annotations__ = {}
__module__ = 'fsleyes.plotting.timeseries'
class fsleyes.plotting.timeseries.FEATResidualTimeSeries(overlay, overlayList, displayCtx, plotCanvas, parentTs)[source]

Bases: fsleyes.plotting.timeseries.VoxelTimeSeries

A VoxelTimeSeries class which represents the time course of the residuals from a FEAT analysis at a specific voxel. Instances of this class are created by the FEATTimeSeries class.

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

Create a FEATResidualTimeSeries.

Parameters
  • overlay – The FEATImage instance to extract the data from.

  • overlayList – The OverlayList instance.

  • displayCtx – The DisplayContext instance.

  • plotCanvas – The TimeSeriesPanel which owns this FEATResidualTimeSeries.

  • parentTs – The FEATTimeSeries instance that has created this FEATResidualTimeSeries.

makeLabel()[source]

Returns a string representation of this FEATResidualTimeSeries instance.

dataAtCurrentVoxel()[source]

Returns the residuals for the current voxel.

__annotations__ = {}
__module__ = 'fsleyes.plotting.timeseries'
class fsleyes.plotting.timeseries.FEATModelFitTimeSeries(overlay, overlayList, displayCtx, plotCanvas, parentTs, contrast, fitType, idx)[source]

Bases: fsleyes.plotting.timeseries.VoxelTimeSeries

A TimeSeries class which represents the time course for a model fit from a FEAT analysis at a specific voxel. Instances of this class are created by the FEATTimeSeries class.

__init__(overlay, overlayList, displayCtx, plotCanvas, parentTs, contrast, fitType, idx)[source]

Create a FEATModelFitTimeSeries.

Parameters
  • overlay – The FEATImage instance to extract the data from.

  • overlayList – The OverlayList instance.

  • displayCtx – The DisplayContext instance.

  • plotCanvas – The TimeSeriesPanel which owns this FEATModelFitTimeSeries.

  • parentTs – The FEATTimeSeries instance that has created this FEATModelFitTimeSeries.

  • contrast – The contrast vector to calculate the partial model fit for.

  • fitType – The model fit type, either 'full', 'pe' or 'cope'.

  • idx – If the model fit type is 'pe' or 'cope',

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

Returns a string representation of this FEATModelFitTimeSeries instance.

dataAtCurrentVoxel()[source]

Returns the FEAT model fit at the current voxel.

class fsleyes.plotting.timeseries.MelodicTimeSeries(overlay, overlayList, displayCtx, plotCanvas)[source]

Bases: fsleyes.plotting.dataseries.DataSeries

A DataSeries class which encapsulates the time course for one component of a MelodicImage. The getData() method returns the time course of the component specified by the current NiftiOpts.volume.

__annotations__ = {}
__module__ = 'fsleyes.plotting.timeseries'
__init__(overlay, overlayList, displayCtx, plotCanvas)[source]

Create a MelodicTimeSeries.

Parameters
  • overlay – A MelodicImage overlay.

  • overlayList – The OverlayList instance.

  • displayCtx – The DisplayContext instance.

  • plotCanvas – The TimeSeriesPanel which owns this MelodicTimeSeries.

getComponent()[source]

Returns the index (starting from 0) of the current Melodic component, as dictated by the NiftiOpts.volume property.

makeLabel()[source]

Returns a string representation of this MelodicTimeSeries.

getData()[source]

Returns the time course of the current Melodic component.

class fsleyes.plotting.timeseries.MeshTimeSeries(overlay, overlayList, displayCtx, plotCanvas)[source]

Bases: fsleyes.plotting.dataseries.DataSeries

A MeshTimeSeries object encapsulates the time course for a Mesh overlay which has some time series vertex data associated with it. See the MeshOpts.vertexData property.

__annotations__ = {}
__module__ = 'fsleyes.plotting.timeseries'
__init__(overlay, overlayList, displayCtx, plotCanvas)[source]

Create a MeshTimeSeries instance.

Parameters
  • overlay – The Mesh instance to extract the data from.

  • overlayList – The OverlayList instance.

  • displayCtx – The DisplayContext instance.

  • plotCanvas – The TimeSeriesPanel which owns this TimeSeries.

makeLabel()[source]

Returns a label to use for this MeshTimeSeries on the legend.

__haveData()

Returns True if there is currently time series data to show for this MeshTimeSeries, False otherwise.

getData()[source]

Returns the data at the current location for the Mesh, or (None, None) if there is no data.