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.ActionThe
CopyOverlayActiondoes as its name suggests - it creates a copy of the currently selected overlay.Note
Currently this action is only capable of copying
.Imageoverlays.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
Imagedata, or create a blank (i.e. filled with zeros)Imageof the same dimensions? - Should we copy the
Imagedisplay 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
DisplayContextandOverlayList, 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
Imageoverlay, and inserts it into theOverlayList.Parameters: - overlayList – The
OverlayList. - displayCtx – The
DisplayContext. - overlay – The
Imageto be copied. - createMask – If
True, the copy will be an emptyImagethe same shape as theoverlay. - copy4D – If
True, and theoverlayis 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.nameof 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.
copy4Dandroi). Ifdatais provided, thecreateMaskargument is ignored.
Returns: The newly created
Imageobject.- overlayList – The