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.
-
fsleyes.plugins.tools.sampleline.sampleAlongLine(data, start, end, resolution, order)[source]¶ Samples from
data, along a line betweenstartandend.- Parameters
data – 3D array
start – Start coordinate
end – End coordinate
resolution – Number of points to sample
order – Interpolation (see
scipy.ndimage.map_coordinates)
- Returns
Tuple containing: - 1D Numpy array containing the sampled values -
(3, N)numpy array containing the coordinates foreach sample
-
class
fsleyes.plugins.tools.sampleline.SampleLineAction(overlayList, displayCtx, ortho)[source]¶ Bases:
fsleyes.actions.togglecontrolpanel.ToggleControlPanelActionThe
SampleLineActionsimply shows/hides aSampleLinePanel.-
static
supportedViews()[source]¶ The
SampleLineActionis restricted for use withOrthoPanelviews.
-
destroy()[source]¶ Called when the
OrthoPanelthat owns this action is closed. Clears references, removes listeners, and calls the base classdestroymethod.
-
__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.
-
__module__= 'fsleyes.plugins.tools.sampleline'¶
-
static
-
class
fsleyes.plugins.tools.sampleline.SampleLineDataSeries(overlay, overlayList, displayCtx, plotCanvas, index, start, end)[source]¶ Bases:
fsleyes.plotting.dataseries.DataSeriesThe
SampleLineDataSeriesrepresents data that is sampled along a straight line through a 3D volume from anImageoverlay.SampleLineDataSeriesobjects are created by theSampleLinePanel.-
interp= <MagicMock name='mock.Choice()' id='4117029600'>¶ How to interpolate the sampled data when it is plotted. The value is used directly as the
orderparameter to thescipy.ndimage.map_coordinatesfunction.
-
resolution= <MagicMock name='mock.Int()' id='4116300320'>¶ The number of points (uniformly spaced) to sample along the line.
-
normalise= <MagicMock name='mock.Choice()' id='4117029600'>¶ 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
Imageoverlay to sample fromoverlayList – The
OverlayListdisplayCtx – A
DisplayContextinstanceplotCanvas – The
PlotCanvasthat 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, orNoneif no data has been sampled yet.
-
__refreshData(*a)¶ Called when
resolution,interpornormalisechange. Re-samples the data from the image.
-
__module__= 'fsleyes.plugins.tools.sampleline'¶
-
-
class
fsleyes.plugins.tools.sampleline.SampleLinePanel(parent, overlayList, displayCtx, ortho)[source]¶ Bases:
fsleyes.controls.controlpanel.ControlPanelThe
SampleLinePanelis a FSLeyes control which can be used in conjunction with anOrthoPanelview. It allows the user to draw a line on anOrthoPanelcanvas, and plot the voxel intensities, along that line, from the currently selectedImageoverlay.The
SampleLineProfileclass implements user interaction, and thePlotCanvasclass is used for plotting.-
interp= <MagicMock name='mock.Choice()' id='4009896688'>¶
-
resolution= <MagicMock name='mock.Int()' id='4009895512'>¶
-
normalise= <MagicMock name='mock.Choice()' id='4009896592'>¶
-
lineStyle= <MagicMock name='mock.Choice()' id='4009895632'>¶
-
static
supportedViews()[source]¶ Overrides
ControlMixin.supportedViews(). TheSampleLinePanelis only intended to be added toOrthoPanelviews.
-
static
ignoreControl()[source]¶ Tells FSLeyes not to add the
SampleLinePanelas an option to the Settings menu. Instead, theSampleLineActionis added as an option to the Tools menu.
-
static
profileCls()[source]¶ Returns the
SampleLineProfileclass, 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
wxparent object.overlayList – The
OverlayListinstance.displayCtx – The
DisplayContextinstance.ortho – The
OrthoPanelinstance.
-
colour= <MagicMock name='mock.Colour()' id='4009897648'>¶
-
lineWidth= <MagicMock name='mock.Choice()' id='4009895248'>¶
-
destroy()[source]¶ Called when this
SampleLinePanelis no longer needed. Clears references, and callsControlPanel.destroy().
-
property
canvas¶ Return a reference to the
PlotCanvasthat 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 givenSampleLineDataSeriesinstance.
-
__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
OrthoPanelcanvas. Calls__updateInfo().
-
__onMouseDrag(*a)¶ Called on mouse drag events on an
OrthoPanelcanvas. Calls__updateInfo().
-
__onMouseUp(*a)¶ Called on mouse up events on an
OrthoPanelcanvas. Samples and plots data from the currently selected overlay along the drawn sample line.
-
__draw()¶ Passed as the
drawFuncto thePlotCanvas. CallsPlotCanvas.drawDataSeries().
-
__module__= 'fsleyes.plugins.tools.sampleline'¶
-
-
class
fsleyes.plugins.tools.sampleline.ExportSampledDataDialog(parent, series)[source]¶ Bases:
__main__.docbuilder.run.<locals>.MockClassThe
ExportSampledDataDialogis 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 –
wxparent objectseries – Sequence of
SampleLineDataSeriesinstances. Must contain at least one series. If there is more than one series, the user is asked to choose one.
-
__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
SampleLineDataSeriesthat was selected.
-