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)

Bases: fsleyes.controls.controlpanel.ControlPanel

The EditTransformPanel class is a FSLeyes control panel which allows the user to adjust the voxToWorldMat of an Image 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’s voxToWorldMat attribute.

This panel also has buttons which allow the user to load/save the transformation matrix - they use functions in the applyflirtxfm and saveflirtxfm modules to load, save, and calculate transformation matrices. When the user loads a matrix, it is used in place of the Image.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 the displaySpace is not set appropriately.

__init__(parent, overlayList, displayCtx, frame, ortho)

Create an EditTransformPanel.

Parameters
destroy()

Must be called when this EditTransformPanel is no longer needed. Removes listeners and cleans up references.

static supportedViews()

Overrides ControlMixin.supportedViews(). The EditTransformPanel is only intended to be added to OrthoPanel views.

_EditTransformPanel__deregisterOverlay()

Called by __selectedOverlayChanged(). Clears references to the most recently registered overlay.

_EditTransformPanel__formatXform(xform, ctrl)

Format the given xform on the given wx.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 the Image 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 calls OrthoPanel.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 given overlay.

_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 or OverlayList.overlays properties change. If the newly selected overlay is an Image, 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'