fsleyes.actions.copyoverlay
¶
This module provides the CopyOverlayAction
, a global action
which creates a copy of the currently selected overlay.
-
class
fsleyes.actions.copyoverlay.
CopyOverlayAction
(overlayList, displayCtx, frame)[source]¶ Bases:
fsleyes.actions.base.NeedOverlayAction
The
CopyOverlayAction
does as its name suggests - it creates a copy of the currently selected overlay.Note
Currently this action is only capable of copying
.Image
overlays.The user is asked to choose between the following options:
If the overlay is a 4D
Image
, should we copy the entire 4D image, or extract the current 3D volume?Should we copy all of the
Image
data, or create a blank (i.e. filled with zeros)Image
of the same dimensions?Should we copy the
Image
display properties (e.g.Display.overlayType
), or set the display properties of the copy to defaults?
-
__init__
(overlayList, displayCtx, frame)[source]¶ Create a
CopyOverlayAction
.- Parameters
overlayList – The
OverlayList
.displayCtx – The
DisplayContext
.frame – The
FSLeyesFrame
.
-
_CopyOverlayAction__copyOverlay
()¶ Creates a copy of the currently selected overlay, and inserts it into the
OverlayList
.
-
__module__
= 'fsleyes.actions.copyoverlay'¶
-
fsleyes.actions.copyoverlay.
copyImage
(overlayList, displayCtx, overlay, createMask=False, copy4D=True, copyDisplay=True, name=None, roi=None, channel=None, data=None)[source]¶ Creates a copy of the given
Image
overlay, and inserts it into theOverlayList
.- Parameters
overlayList – The
OverlayList
.displayCtx – The
DisplayContext
.overlay – The
Image
to be copied.createMask – If
True
, the copy will be an emptyImage
the same shape as theoverlay
.copy4D – If
True
, and theoverlay
is 4D, the copy will also be 4D. Otherwise, the current 3D voluem is copied.copyDisplay – If
True
, the copy will inherit the display settings of theoverlay
. Otherwise, the copy will be initialised with default display settings.name – If provided, will be used as the
Display.name
of the copy. Otherwise the copy will be given a name.roi – If provided, the copy will be cropped to the low/high voxel bounds specified in the image. Must be a sequence of tuples, containing the low/high bounds for each voxel dimension. For 4D images, the bounds for the fourth dimension are optional. If
roi
specifies more than three dimensions, butcopy4D is False
, the additional dimensions are ignored.channel – If provided, and if the image is complex or multi-valued (RGB(A)), only this channel is copied. Otherwise the image and data type are copied as-is. For complex images, valid values are
'real'
or'imag'
; for multi- valued images, valid values are'R'
,'G'
,'B'
or'A'
.data – If provided, is used as the image data for the new copy. Must match the shape dictated by the other arguments (i.e.
copy4D
androi
). Ifdata
is provided, thecreateMask
argument is ignored.
- Returns
The newly created
Image
object.
Note that the
roi
andcopy4D
options do not support images with more than four dimensions.
-
fsleyes.actions.copyoverlay.
copyDisplayProperties
(displayCtx, src, dest, displayExclude=None, optExclude=None, displayArgs=None, optArgs=None)[source]¶ Copies all properties from the
src
Display
andDisplayOpts
instances to thedest
instances.- Parameters
displayCtx – The
DisplayContext
displayExclude – Collection of
Display
properties which should not be copiedoptExclude – Collection of
DisplayOpts
properties which should not be copieddisplayArgs – Values to be used instead of the
src
Display
values.optArgs – Values to be used instead of the
src
DisplayOpts
values.