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.ControlPanelThe
EditTransformPanelclass is a FSLeyes control panel which allows the user to adjust thevoxToWorldMatof anImageoverlay.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.displayXformis used to update the overlay display in real time. When the user clicks the Apply button, the transformation is applied to the image’svoxToWorldMatattribute.This panel also has buttons which allow the user to load/save the transformation matrix - they use functions in the
applyflirtxfmandsaveflirtxfmmodules to load, save, and calculate transformation matrices. When the user loads a matrix, it is used in place of theImage.voxToWorldMattransformation.Note
The effect of editing the transformation will only be visible if the
DisplayContext.displaySpaceis set to'world', or to some image which is not being edited. A warning is shown at the top of the panel if thedisplaySpaceis not set appropriately.-
__init__(parent, overlayList, displayCtx, frame, ortho)[source]¶ Create an
EditTransformPanel.- Parameters
parent – The
wxparent object.overlayList – The
OverlayListinstance.displayCtx – The
DisplayContextinstance.frame – The
FSLeyesFrameinstance.ortho – The
OrthoPanelinstance.
-
destroy()[source]¶ Must be called when this
EditTransformPanelis no longer needed. Removes listeners and cleans up references.
-
static
supportedViews()[source]¶ Overrides
ControlMixin.supportedViews(). TheEditTransformPanelis only intended to be added toOrthoPanelviews.
-
_EditTransformPanel__deregisterOverlay()¶ Called by
__selectedOverlayChanged(). Clears references to the most recently registered overlay.
-
_EditTransformPanel__formatXform(xform, ctrl)¶ Format the given
xformon the givenwx.StaticTextctrl.
-
_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
voxToWorldMatattribute of theImageinstance being transformed.
-
_EditTransformPanel__onCancel(ev=None)¶ Called when the Cancel button is pushed. Resets the
NiftiOpts.displayXformattribute 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.nameof 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.displayXformmatrix 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.selectedOverlayorOverlayList.overlaysproperties 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.displayXformfor the overlay currently being edited.
-
__module__= 'fsleyes.controls.edittransformpanel'¶
-