fsleyes.actions.newimage¶
This module provides the NewImageAction class, an Action
which allows the user to create a new empty Image overlay.
-
class
fsleyes.actions.newimage.NewImageAction(overlayList, displayCtx, frame)[source]¶ Bases:
fsleyes.actions.base.ActionThe
NewImageActionclass allows the user to create a newImage. When invoked, it displays aNewImageDialogprompting the user to select the properties of the new image, and then creates a new image accordingly.-
__init__(overlayList, displayCtx, frame)[source]¶ Create a
CopyOverlayAction.- Parameters
overlayList – The
OverlayList.displayCtx – The
DisplayContext.frame – The
FSLeyesFrame.
-
_NewImageAction__newImage()¶ Displays a
NewImageDialog, then creates a newImage, and adds it to theOverlayList.If the currently selected overlay is a
Nifti, theNewImageDialogis initialised to the properties of the selected overlay.
-
__module__= 'fsleyes.actions.newimage'¶
-
-
fsleyes.actions.newimage.newImage(shape, pixdim, dtype, affine, xyzUnits=<MagicMock name='mock.data.constants.NIFTI_UNITS_MM' id='281473484116032'>, timeUnits=<MagicMock name='mock.data.constants.NIFTI_UNITS_SEC' id='281473484123968'>, name='new')[source]¶ Create a new
Imagewith the specified properties.- Parameters
shape – Tuple containing the image shape
pixdim – Tuple containing the image pixdims
dtype –
numpydtypeaffine –
(4, 4)numpyarray specifying the voxel-to-world affinexyzUnits – Spatial units
timeUnits – Temporal units
-
class
fsleyes.actions.newimage.NewImageDialog(parent, shape, pixdim, affine, dtype)[source]¶ Bases:
__main__.MockClassThe
NewImageDialogdisplays a collection of widgets allowing the user to select the data type, shape, dimensions (pixdims), and voxel-to- world affine.-
__init__(parent, shape, pixdim, affine, dtype)[source]¶ Create a
NewImageDialog.- Parameters
parent –
wxparent objectshape – Tuple of three initial shape values
pixdim – Tuple of three initial pixdim values
affine – Initial affine, assumed to be a
(4, 4)numpyarraydtype – Initial
numpydtype. Must be one offloat32,float64,uint8,int16, orint32.
-
property
linkWidget¶ Return a reference to the link widget.
-
property
shapeWidgets¶ Return a reference to the three shape widgets.
-
property
pixdimWidgets¶ Return a reference to the three pixdim widgets.
-
property
dtypeWidget¶ Return a reference to the dtype widget.
-
property
affineWidget¶ Return a reference to the affine widget.
-
property
ok¶ Return a reference to the ok button.
-
property
cancel¶ Return a reference to the cancel button.
-
property
link¶ Return a tuple containing the current affine-dimension link checkbox value.
-
property
shape¶ Return a tuple containing the current shape values.
-
property
pixdim¶ Return a tuple containing the current pixdim values.
-
property
dtype¶ Return the currently selected data type, as a
numpy.dtype.
-
_NewImageDialog__onAffine(ev)¶ Called when the affine changes. If linking is enabled, updates the pixdim values from the new affine.
-
_NewImageDialog__onLink(ev)¶ Called when the link checkbox changes. If linking is enabled, calls
__onAffine().
-
_NewImageDialog__onPixdim(ev)¶ Called when any pixdim widget changes. If linking is enabled, reconstructs the affine with the new pixdim values.
-
__module__= 'fsleyes.actions.newimage'¶
-
property
affine¶ Return the current content of the affine grid, as a
numpyarray of shape(4, 4).
-