fsleyes.plugins.tools.sampleline
¶
This module provides the SampleLineAction
class, which allows
the user to open a SampleLinePanel
. The SampleLinePanel
is
a FSLeyes control which allows the user to draw a line on the canvases of
an OrthoPanel
, and plot the data along that line from the currently
selected Image
overlay.
- class fsleyes.plugins.tools.sampleline.SampleLineAction(overlayList, displayCtx, ortho)[source]¶
Bases:
fsleyes.actions.togglecontrolpanel.ToggleControlPanelAction
The
SampleLineAction
simply shows/hides aSampleLinePanel
.- static supportedViews()[source]¶
The
SampleLineAction
is restricted for use withOrthoPanel
views.
- destroy()[source]¶
Called when the
OrthoPanel
that owns this action is closed. Clears references, removes listeners, and calls the base classdestroy
method.
- __selectedOverlayChanged(*a)¶
Called when the selected overlay changes. Enables/disables this action (and hence the bound Tools menu item) depending on whether the overlay is an image.
- __run()¶
Open/close a
SampleLinePanel
.
- __annotations__ = {}¶
- __module__ = 'fsleyes.plugins.tools.sampleline'¶
- class fsleyes.plugins.tools.sampleline.SampleLineDataSeries(overlay, overlayList, displayCtx, plotCanvas, index, start, end)[source]¶
Bases:
fsleyes.plotting.dataseries.DataSeries
The
SampleLineDataSeries
represents data that is sampled along a straight line through a 3D volume from anImage
overlay.SampleLineDataSeries
objects are created by theSampleLinePanel
.- interp = <MagicMock name='mock.Choice()' id='140604702016944'>¶
How to interpolate the sampled data when it is plotted. The value is used directly as the
order
parameter to thescipy.ndimage.map_coordinates
function.
- resolution = <MagicMock name='mock.Int()' id='140604701787328'>¶
The number of points (uniformly spaced) to sample along the line.
- normalise = <MagicMock name='mock.Choice()' id='140604702016944'>¶
Whether to normalise all plotted data along the x, or y, or both, axes.
- __init__(overlay, overlayList, displayCtx, plotCanvas, index, start, end)[source]¶
Create a
SampleLineDataSeries
.- Parameters
overlay – The
Image
overlay to sample fromoverlayList – The
OverlayList
displayCtx – A
DisplayContext
instanceplotCanvas – The
PlotCanvas
that is plotting thisDataSeries
.index – Volume index, for images with more than 3 dimensions (see
NiftiOpts.index()
)start – Start of sampling line, in voxel coordinates
end – End of sampling line, in voxel coordinates
- property coords¶
Return a
(3, n)
array containing the voxel coordinates of each sampled point for the most recently generated data, orNone
if no data has been sampled yet.
- __refreshData(*a)¶
Called when
resolution
,interp
ornormalise
change. Re-samples the data from the image.
- __annotations__ = {}¶
- __module__ = 'fsleyes.plugins.tools.sampleline'¶
- class fsleyes.plugins.tools.sampleline.SampleLinePanel(parent, overlayList, displayCtx, ortho)[source]¶
Bases:
fsleyes.controls.controlpanel.ControlPanel
The
SampleLinePanel
is a FSLeyes control which can be used in conjunction with anOrthoPanel
view. It allows the user to draw a line on anOrthoPanel
canvas, and plot the voxel intensities, along that line, from the currently selectedImage
overlay.The
SampleLineProfile
class implements user interaction, and thePlotCanvas
class is used for plotting.- interp = <MagicMock name='mock.Choice()' id='140604695030192'>¶
- resolution = <MagicMock name='mock.Int()' id='140604695030096'>¶
- normalise = <MagicMock name='mock.Choice()' id='140604695030048'>¶
- lineStyle = <MagicMock name='mock.Choice()' id='140604695028368'>¶
- static supportedViews()[source]¶
Overrides
ControlMixin.supportedViews()
. TheSampleLinePanel
is only intended to be added toOrthoPanel
views.
- static ignoreControl()[source]¶
Tells FSLeyes not to add the
SampleLinePanel
as an option to the Settings menu. Instead, theSampleLineAction
is added as an option to the Tools menu.
- static profileCls()[source]¶
Returns the
SampleLineProfile
class, which needs to be activated in conjunction with theSampleLinePanel
.
- static defaultLayout()[source]¶
Returns a dictionary containing layout settings to be passed to
ViewPanel.togglePanel
.
- __init__(parent, overlayList, displayCtx, ortho)[source]¶
Create a
SampleLinePanel
.- Parameters
parent – The
wx
parent object.overlayList – The
OverlayList
instance.displayCtx – The
DisplayContext
instance.ortho – The
OrthoPanel
instance.
- colour = <MagicMock name='mock.Colour()' id='140604695028464'>¶
- lineWidth = <MagicMock name='mock.Choice()' id='140604695028416'>¶
- destroy()[source]¶
Called when this
SampleLinePanel
is no longer needed. Clears references, and callsControlPanel.destroy()
.
- property canvas¶
Return a reference to the
PlotCanvas
that is used to plot sampled data from lines that the user has drawn.
- screenshot()[source]¶
Creates and runs a
ScreenshotAction
, which propmts the user to save the plot to a file.
- __bindToDataSeries(ds, bind=True)¶
Binds/unbinds the GUI widgets (
colour
,resolution
), etc to/from the givenSampleLineDataSeries
instance.
- __updateInfo()¶
Called while the mouse is being dragged. Updates the information about the sampling line (e.g. start/end voxel coordinates) that is displayed at the top of the
SampleLinePanel
.
- __onMouseDown(*a)¶
Called on mouse down events on an
OrthoPanel
canvas. Calls__updateInfo()
.
- __onMouseDrag(*a)¶
Called on mouse drag events on an
OrthoPanel
canvas. Calls__updateInfo()
.
- __onMouseUp(*a)¶
Called on mouse up events on an
OrthoPanel
canvas. Samples and plots data from the currently selected overlay along the drawn sample line.
- __draw()¶
Passed as the
drawFunc
to thePlotCanvas
. CallsPlotCanvas.drawDataSeries()
.
- __annotations__ = {}¶
- __module__ = 'fsleyes.plugins.tools.sampleline'¶
- class fsleyes.plugins.tools.sampleline.ExportSampledDataDialog(parent, series)[source]¶
Bases:
__main__.docbuilder.run.<locals>.MockClass
The
ExportSampledDataDialog
is used by theSampleLinePanel.export()
method to ask the user which sample data they want to save, and whether they want to save the sample point coordinates to file as well as the samples themselves.- __init__(parent, series)[source]¶
Create an
ExportSampledDataDialog
.- Parameters
parent –
wx
parent objectseries – Sequence of
SampleLineDataSeries
instances. Must contain at least one series. If there is more than one series, the user is asked to choose one.
- __annotations__ = {}¶
- __module__ = 'fsleyes.plugins.tools.sampleline'¶
- __onOk(ev)¶
Called when the ok button is pushed. Closes the dialog.
- __onCancel(ev)¶
Called when the cancel button is pushed. Closes the dialog.
- GetCoordinates()[source]¶
Return one of
'none'
,'voxel'
, or'world'
, denoting the user’s preference for saving coordinates to the file.
- GetSeries()[source]¶
Return the
SampleLineDataSeries
that was selected.