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.NeedOverlayActionThe
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)[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
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. If
roispecifies 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.
copy4Dandroi). Ifdatais provided, thecreateMaskargument is ignored.
- Returns
The newly created
Imageobject.
Note that the
roiandcopy4Doptions 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
srcDisplayandDisplayOptsinstances to thedestinstances.- Parameters
displayCtx – The
DisplayContextdisplayExclude – Collection of
Displayproperties which should not be copiedoptExclude – Collection of
DisplayOptsproperties which should not be copieddisplayArgs – Values to be used instead of the
srcDisplayvalues.optArgs – Values to be used instead of the
srcDisplayOptsvalues.