NifTK
16.4.1 - 0798f20
CMIC's Translational Medical Imaging Platform
|
Class to contain all the ITK/MITK logic for the Affine Transformation Plugin, to separate from AffineTransformationView to make unit testing easier. More...
Public Member Functions | |
mitkClassMacroItkParent (AffineTransformer, itk::Object) static Pointer New() | |
virtual bool | GetRotateAroundCenter () |
Get / Set the "RotateAroundCenter" flag. More... | |
virtual void | SetRotateAroundCenter (bool _arg) |
void | SetDataStorage (mitk::DataStorage::Pointer dataStorage) |
Sets the mitk::DataStorage on this object. More... | |
mitk::DataStorage::Pointer | GetDataStorage () const |
Gets the DataStorage pointer from this object. More... | |
AffineTransformParametersDataNodeProperty::Pointer | GetCurrentTransformParameters () const |
Get the transform parameters from the current data node. More... | |
vtkSmartPointer< vtkMatrix4x4 > | GetTransformMatrixFromNode (std::string which) const |
Get a transform matrix from the current data node. More... | |
vtkSmartPointer< vtkMatrix4x4 > | GetCurrentTransformMatrix () const |
Computes and returns the transformation matrix based on the current set of parameters. More... | |
void | ResetTransform () |
Reset the transform to initial state. More... | |
void | OnNodeChanged (mitk::DataNode::Pointer node) |
Called when a node changed. More... | |
void | OnParametersChanged (AffineTransformParametersDataNodeProperty::Pointer paramsProperty) |
Slot for all changes to transformation parameters. More... | |
void | OnSaveTransform (std::string filename) |
Slot for saving transform to disk. More... | |
void | OnLoadTransform (std::string filename) |
Slot for loading transform from disk. More... | |
void | OnApplyTransform () |
Slot for updating the direction cosines with the current transformation. More... | |
void | OnResampleTransform () |
Slot for resampling the current image. More... | |
void | InitialiseTransformProperty (std::string name, mitk::DataNode::Pointer node) |
void | InitialiseNodeProperties (mitk::DataNode::Pointer node) |
void | UpdateNodeProperties (const vtkSmartPointer< vtkMatrix4x4 > displayedTransformFromParameters, const vtkSmartPointer< vtkMatrix4x4 > incrementalTransformToBeComposed, mitk::DataNode::Pointer) |
void | UpdateTransformProperty (std::string name, vtkSmartPointer< vtkMatrix4x4 > transform, mitk::DataNode::Pointer node) |
void | ApplyTransformToNode (const vtkSmartPointer< vtkMatrix4x4 > transformFromFile, mitk::DataNode::Pointer node) |
void | ApplyResampleToCurrentNode () |
Applies a re-sampling to the current node. More... | |
Static Public Attributes | |
static const std::string | VIEW_ID = "uk.ac.ucl.cmic.affinetransformview" |
Simply stores the view name = "uk.ac.ucl.cmic.affinetransformview". More... | |
static const std::string | INITIAL_TRANSFORM_KEY = "niftk.initaltransform" |
See class introduction. More... | |
static const std::string | INCREMENTAL_TRANSFORM_KEY = "niftk.incrementaltransform" |
See class introduction. More... | |
static const std::string | PRELOADED_TRANSFORM_KEY = "niftk.preloadedtransform" |
See class introduction. More... | |
static const std::string | DISPLAYED_TRANSFORM_KEY = "niftk.displayedtransform" |
See class introduction. More... | |
static const std::string | DISPLAYED_PARAMETERS_KEY = "niftk.displayedtransformparameters" |
See class introduction. More... | |
Protected Member Functions | |
AffineTransformer () | |
virtual | ~AffineTransformer () |
AffineTransformer (const AffineTransformer &) | |
AffineTransformer & | operator= (const AffineTransformer &) |
virtual vtkSmartPointer < vtkMatrix4x4 > | ComputeTransformFromParameters (void) const |
Computes a new linear transform (as 4x4 transform matrix) from the parameters set through the UI. More... | |
void | UpdateTransformationGeometry () |
Updates the transform on the current node, and it's children. More... | |
Class to contain all the ITK/MITK logic for the Affine Transformation Plugin, to separate from AffineTransformationView to make unit testing easier.
This class stores several AffineTransformDataNodeProperty on each data node:
1. The "Initial" transformation = The transformation that was on the object, before this view added anything. So, if you load an image from file, this transformation is a copy of the geometry implied by the image header.
2. The "Incremental" transformation = Firstly, the dataNode->GetData()->GetGeometry() can only be composed with. So, we always have to calculate, for any change, the delta to be composed onto the existing transformation.
3. The "Pre-Loaded" transformation = A transformation loaded from file. Loading a transformation from file also resets the GUI parameters. So, if you then add a rotation of 10 degrees about X axis, it is performed AFTER the transformation loaded from file.
4. The "Displayed" transformation = The transformation that matches the GUI display. So, if you then add a rotation of 10 degrees about X axis, this transformation is just that.
and additionally a single AffineTransformParametersDataNodeProperty:
1. The "Displayed" parameters to match the "Displayed" transformation above.
At no point are parameters derived or extracted from the affine transformation matrix, as this is ambiguous and prone to numerical instability.
|
protected |
|
protectedvirtual |
|
protected |
void niftk::AffineTransformer::ApplyResampleToCurrentNode | ( | ) |
Applies a re-sampling to the current node.
void niftk::AffineTransformer::ApplyTransformToNode | ( | const vtkSmartPointer< vtkMatrix4x4 > | transformFromFile, |
mitk::DataNode::Pointer | node | ||
) |
The transform loaded from file is applied to the current node, and all its children, and it resets the GUI parameters to Identity, and hence the DISPLAY_TRANSFORM and DISPLAY_PARAMETERS to Identity.
|
protectedvirtual |
Computes a new linear transform (as 4x4 transform matrix) from the parameters set through the UI.
vtkSmartPointer< vtkMatrix4x4 > niftk::AffineTransformer::GetCurrentTransformMatrix | ( | ) | const |
Computes and returns the transformation matrix based on the current set of parameters.
AffineTransformParametersDataNodeProperty::Pointer niftk::AffineTransformer::GetCurrentTransformParameters | ( | ) | const |
Get the transform parameters from the current data node.
mitk::DataStorage::Pointer niftk::AffineTransformer::GetDataStorage | ( | ) | const |
Gets the DataStorage pointer from this object.
|
virtual |
Get / Set the "RotateAroundCenter" flag.
vtkSmartPointer< vtkMatrix4x4 > niftk::AffineTransformer::GetTransformMatrixFromNode | ( | std::string | which | ) | const |
Get a transform matrix from the current data node.
void niftk::AffineTransformer::InitialiseNodeProperties | ( | mitk::DataNode::Pointer | node | ) |
Called by OnSelectionChanged to setup a node with default transformation properties, if it doesn't already have them.
void niftk::AffineTransformer::InitialiseTransformProperty | ( | std::string | name, |
mitk::DataNode::Pointer | node | ||
) |
Called by _InitialiseNodeProperties to initialise (to Identity) a specified transform property on a node.
niftk::AffineTransformer::mitkClassMacroItkParent | ( | AffineTransformer | , |
itk::Object | |||
) |
void niftk::AffineTransformer::OnApplyTransform | ( | ) |
Slot for updating the direction cosines with the current transformation.
void niftk::AffineTransformer::OnLoadTransform | ( | std::string | filename | ) |
Slot for loading transform from disk.
void niftk::AffineTransformer::OnNodeChanged | ( | mitk::DataNode::Pointer | node | ) |
Called when a node changed.
void niftk::AffineTransformer::OnParametersChanged | ( | AffineTransformParametersDataNodeProperty::Pointer | paramsProperty | ) |
Slot for all changes to transformation parameters.
void niftk::AffineTransformer::OnResampleTransform | ( | ) |
Slot for resampling the current image.
void niftk::AffineTransformer::OnSaveTransform | ( | std::string | filename | ) |
Slot for saving transform to disk.
|
protected |
void niftk::AffineTransformer::ResetTransform | ( | ) |
Reset the transform to initial state.
void niftk::AffineTransformer::SetDataStorage | ( | mitk::DataStorage::Pointer | dataStorage | ) |
Sets the mitk::DataStorage on this object.
|
virtual |
void niftk::AffineTransformer::UpdateNodeProperties | ( | const vtkSmartPointer< vtkMatrix4x4 > | displayedTransformFromParameters, |
const vtkSmartPointer< vtkMatrix4x4 > | incrementalTransformToBeComposed, | ||
mitk::DataNode::Pointer | node | ||
) |
Called by _UpdateTransformationGeometry to set new transformations in the right properties of the node.
|
protected |
Updates the transform on the current node, and it's children.
void niftk::AffineTransformer::UpdateTransformProperty | ( | std::string | name, |
vtkSmartPointer< vtkMatrix4x4 > | transform, | ||
mitk::DataNode::Pointer | node | ||
) |
Called by _UpdateNodeProperties to update a transform property on a given node.
|
static |
See class introduction.
|
static |
See class introduction.
|
static |
See class introduction.
|
static |
See class introduction.
|
static |
See class introduction.
|
static |
Simply stores the view name = "uk.ac.ucl.cmic.affinetransformview".