fsleyes.controls.edittransformpanel
¶
This module provides the EditTransformPanel
class, a FSLeyes
control panel which allows the user to adjust the voxToWorldMat
of an
Image
overlay.
-
class
fsleyes.controls.edittransformpanel.
EditTransformPanel
(parent, overlayList, displayCtx, frame, ortho)[source]¶ Bases:
fsleyes.controls.controlpanel.ControlPanel
The
EditTransformPanel
class is a FSLeyes control panel which allows the user to adjust thevoxToWorldMat
of anImage
overlay.Controls are provided allowing the user to construct a transformation matrix from scales, offsets, and rotations. While the user is adjusting the transformation, the
NiftiOpts.displayXform
is used to update the overlay display in real time. When the user clicks the Apply button, the transformation is applied to the image’svoxToWorldMat
attribute.This panel also has buttons which allow the user to load/save the transformation matrix - they use functions in the
applyflirtxfm
andsaveflirtxfm
modules to load, save, and calculate transformation matrices. When the user loads a matrix, it is used in place of theImage.voxToWorldMat
transformation.Note
The effect of editing the transformation will only be visible if the
DisplayContext.displaySpace
is set to'world'
, or to some image which is not being edited. A warning is shown at the top of the panel if thedisplaySpace
is not set appropriately.-
__init__
(parent, overlayList, displayCtx, frame, ortho)[source]¶ Create an
EditTransformPanel
.- Parameters
parent – The
wx
parent object.overlayList – The
OverlayList
instance.displayCtx – The
DisplayContext
instance.frame – The
FSLeyesFrame
instance.ortho – The
OrthoPanel
instance.
-
destroy
()[source]¶ Must be called when this
EditTransformPanel
is no longer needed. Removes listeners and cleans up references.
-
static
supportedViews
()[source]¶ Overrides
ControlMixin.supportedViews()
. TheEditTransformPanel
is only intended to be added toOrthoPanel
views.
-
_EditTransformPanel__deregisterOverlay
()¶ Called by
__selectedOverlayChanged()
. Clears references to the most recently registered overlay.
-
_EditTransformPanel__formatXform
(xform, ctrl)¶ Format the given
xform
on the givenwx.StaticText
ctrl
.
-
_EditTransformPanel__getCurrentXform
()¶ Returns the current transformation matrix defined by the scale, offset, and rotation widgets.
-
_EditTransformPanel__getCurrentXformComponents
()¶ Returns the components of the transformation matrix defined by the scale, offset and rotation widgets.
-
_EditTransformPanel__onApply
(ev)¶ Called when the Apply button is pushed. Sets the
voxToWorldMat
attribute of theImage
instance being transformed.
-
_EditTransformPanel__onCancel
(ev=None)¶ Called when the Cancel button is pushed. Resets the
NiftiOpts.displayXform
attribute of the overlay being transformed, and then callsOrthoPanel.toggleEditTransformPanel()
to close this panel.
-
_EditTransformPanel__onLoadFlirt
(ev)¶ Called when the user clicks the Load FLIRT transform button. Prompts the user to choose a FLIRT transformation matrix and reference image, and then applies the transformation.
-
_EditTransformPanel__onReset
(ev=None)¶ Called when the Reset button is pushed. Resets the transformation.
-
_EditTransformPanel__onSaveFlirt
(ev)¶ Called when the user clicks the Save FLIRT button. Saves the current transformation to a FLIRT matrix file.
-
_EditTransformPanel__overlayNameChanged
(*a)¶ Called when the
Display.name
of the currently selected overlay changes. Updates the name label.
-
_EditTransformPanel__registerOverlay
(overlay)¶ Called by
__selectedOverlayChanged()
. Stores a reference to the givenoverlay
.
-
_EditTransformPanel__resetAllOverlays
()¶ Resets the
NiftiOpts.displayXform
matrix for all overlays that have been modified, and clears the internal transformation matrix cache.This method is called by
__onReset()
and__onCancel()
.
-
_EditTransformPanel__selectedOverlayChanged
(*a)¶ Called when the
DisplayContext.selectedOverlay
orOverlayList.overlays
properties change. If the newly selected overlay is anImage
, it is registered, and the transform widgets reset.
-
_EditTransformPanel__xformChanged
(ev=None)¶ Called when any of the scale, offset, or rotate widgets are modified. Updates the
NiftiOpts.displayXform
for the overlay currently being edited.
-
__module__
= 'fsleyes.controls.edittransformpanel'¶
-