fsleyes.plugins.tools.resample
This module provides the ResampleAction
class, a FSLeyes action
which allows the user to resample an image to a different resolution.
- class fsleyes.plugins.tools.resample.ResampleAction(overlayList, displayCtx, frame)[source]
Bases:
fsleyes.actions.base.NeedOverlayAction
- __init__(overlayList, displayCtx, frame)[source]
Create a
ResampleAction
.- Parameters
overlayList – The
OverlayList
.displayCtx – The
DisplayContext
.frame – The
FSLeyesFrame
.
- __resample()
Called when this
ResampleAction
is invoked. Shows aResampleDialog
, and then resamples the currently selected overlay.
- __annotations__ = {}
- __module__ = 'fsleyes.plugins.tools.resample'
- class fsleyes.plugins.tools.resample.ResampleDialog(parent, title, shape, pixdim, refs)[source]
Bases:
__main__.docbuilder.run.<locals>.MockClass
The
ResampleDialog
is used by theResampleAction
to prompt the user for a new resampled image shape. It contains controls allowing the user to select new voxel and pixdim values, and to select resampling options for interpolation, data type, and smoothing.- __init__(parent, title, shape, pixdim, refs)[source]
Create a
ResampleDialog
.- Parameters
parent –
wx
parent objecttitle – Dialog title
shape – The original image shape (a tuple of integers)
pixdim – The original image pixdims (a tuple of floats)
refs – A sequence of
Image
objects which can be selected as references.
- property okButton
Returns a reference to the OK button.
- property resetButton
Returns a reference to the reset button.
- property cancelButton
Returns a reference to the cancel button.
- property refCtrl
Returns a reference to the reference image dropdown.
- property voxXCtrl
Returns a reference to the X voxel coordinate spin control.
- property voxYCtrl
Returns a reference to the Y voxel coordinate spin control.
- property voxZCtrl
Returns a reference to the Z voxel coordinate spin control.
- property pixXCtrl
Returns a reference to the X pixdim spin control.
- property pixYCtrl
Returns a reference to the Y pixdim spin control.
- property pixZCtrl
Returns a reference to the Z pixdim spin control.
- property originCtrl
Returns a reference to the origin dropdown box.
- property interpCtrl
Returns a reference to the interpolation dropdown box.
- property dtypeCtrl
Returns a reference to the data type dropdown box.
- property smoothCtrl
Returns a reference to the smoothing checkbox.
- property allVolumesCtrl
Returns a reference to the all volumes checkbox.
- __onRef(ev)
Called when the user changes the reference image. Enables/ disables the voxel/pixdim controls as needed.
- __onVoxel(ev)
Called when the user changes a voxel value. Updates the pixdim values accordingly.
- __onPixdim(ev)
Called when the user changes a pixdim value. Updates the voxel values accordingly.
- __onOk(ev)
Called when the ok button is pushed. Closes the dialog.
- __onReset(ev)
Called when the reset button is pushed. Resets the shape and pixdims to their original values.
- __onCancel(ev)
Called when the cancel button is pushed. Closes the dialog.
- GetInterpolation()[source]
Returns the currently selected interpolation setting, either
'nearest'
,'linear'
, or'cubic'
.
- GetDataType()[source]
Returns the currently selected data type setting as a
numpy.dtype
, one ofuint8
,int16
,int32
,float32
, orfloat64
.
- GetAllVolumes()[source]
Returns
True
, orFalse
, indicating whether all volumes of an image with more than three dimensions should be resampled.
- __derivePixdims()
Derives new pixdim values from the current voxel values.
- __deriveVoxels()
Derives new voxel values from the current pixdim values.
- __annotations__ = {}
- __module__ = 'fsleyes.plugins.tools.resample'