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)¶ Bases:
fsleyes.actions.base.Action
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)¶ Create a
CopyOverlayAction
.Parameters: - overlayList – The
OverlayList
. - displayCtx – The
DisplayContext
. - frame – The
FSLeyesFrame
.
- overlayList – The
-
destroy
()¶ Removes listeners from the
DisplayContext
andOverlayList
, and callsAction.destroy()
.
-
_CopyOverlayAction__copyOverlay
()¶ Creates a copy of the currently selected overlay, and inserts it into the
OverlayList
.
-
_CopyOverlayAction__selectedOverlayChanged
(*a)¶ Called when the selected overlay, or overlay list, changes.
Enables/disables this action depending on the nature of the selected overlay.
-
__module__
= 'fsleyes.actions.copyoverlay'¶
- If the overlay is a 4D
-
fsleyes.actions.copyoverlay.
copyImage
(overlayList, displayCtx, overlay, createMask=False, copy4D=True, copyDisplay=True, name=None, roi=None, data=None)¶ 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.
- 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.- overlayList – The