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
destroy()

Removes listeners from the DisplayContext and OverlayList, and calls Action.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'
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 the OverlayList.

Parameters
  • overlayList – The OverlayList.

  • displayCtx – The DisplayContext.

  • overlay – The Image to be copied.

  • createMask – If True, the copy will be an empty Image the same shape as the overlay.

  • copy4D – If True, and the overlay 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 the overlay. 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 and roi). If data is provided, the createMask argument is ignored.

Returns

The newly created Image object.