View Issue Details

IDProjectCategoryView StatusLast Update
0003611Slicer4Module Transformspublic2017-06-10 08:51
Reporterlassoan Assigned Tolassoan  
PrioritynormalSeveritymajorReproducibilityalways
Status closedResolutionfixed 
Product Version 
Target VersionSlicer 4.4.0Fixed in VersionSlicer 4.4.0 
Summary0003611: Inverse transforms are not updated in the transform nodes
Description

Start Slicer and enter the following commands:

tn=slicer.vtkMRMLLinearTransformNode()
slicer.mrmlScene.AddNode(tn)
tn.GetMatrixTransformToParent().SetElement(0,3,20)
print tn.GetMatrixTransformFromParent()
tn.GetMatrixTransformToParent().SetElement(0,3,30)
print tn.GetMatrixTransformFromParent()

The result of the first print is correct (the inverse transform has -20 translation), but the result of the second print is incorrect (the inverse transform should be -30 but it remains -20 instead), because the inverse transform is not updated.

When the Transforms module GUI is active then as a side effect the inverse transform of linear transforms get updated.

A solution could be to check the modified time of the inverse transform in the get function of a transform. If the inverse transform is more recent then the transform has to be recomputed.

TagsNo tags attached.

Activities

lassoan

lassoan

2014-03-05 02:44

developer   ~0010681

I'm working on this, probably a patch will be ready today or tomorrow.

lassoan

lassoan

2014-03-05 14:45

developer   ~0010685

Pull request with the fix submitted:
https://github.com/Slicer/Slicer/pull/111

lassoan

lassoan

2014-03-19 09:56

developer   ~0011452

Fix merged into the trunk:
http://viewvc.na-mic.org/viewvc.cgi/Slicer4?view=revision&revision=23008

jcfr

jcfr

2014-09-17 23:01

administrator   ~0012566

Closing resolved issues that have not been updated in more than 3 months.

Related Changesets

Import 2017-06-07 23:51:09: master 29dc6a68

2014-03-19 13:41:09

lassoan

Details Diff
ENH: Several fixes and improvements in transform handling

Major fixes:
* Added mechanism to prevent immediate invocation of TransformModified events (similarly to Modified events) to allow atomic changes of transforms and prevent multiple event invocations (fixes 0003610, 0003611).
* Fixed vtkITKBSplineTransform inverse computation (the bulk component was ignored in the inverse computation due to a shadow variable)
* Fixed DeepCopy of vtkITKBSplineTransform.cxx (InternalDeepCopy method had to be implemented)
* Use vtkTransform's ability to compute inverse transforms instead of keeping separate transforms for forward and inverse transforms (still kept the two member variables in the transform node base class to allow storing of forward and inverse transform if they are both computed, e.g., some Demons registration provides both the forward and inverse transforms as outputs).
* Fixed ReadWriteAsTransformToParent logic in the storage node class (as inverse warp transforms usually cannot be written, the flag should point to the forward transform class). For convenience, the flag is updated automatically when a To/FromParentTransform is set in the transform node.
* Fixed transform node copy: now a true deep copy is performed (earlier only the pointer of the transforms were copied, therefore changing a transform in a node changed the copied node, too)
* Removed vtkMRMLNonlinearTransformNode, as non-linear transforms are not special cases anymore: the base transform class can manage them the same way as linear transforms.
* Changed Get/SetMatrixTransformToParent and Get/SetMatrixTransformFromParent method to make it clear that it makes a copy of the input and output, so changing a matrix is only possible by using the Set... method (and not Get...()->DeepCopy(...)). Kept the old functions to prevent build errors, but they are deprecated and a warning is logged if they are used (as the behavior of the Get... function is changed from a shallow copy to a deep copy). This API change required changing of a lot of file in the Slicer core and extensions.

Minor fixes:
* Made vtkMRMLTransformNode non-abstract: this is the class that can handle arbitrarily complex composite transforms (e.g., grid transform hardened on a bspline transform).
* Fixed invalid NonLinearTransformScene.mrml scene: wrong storage node ref ID caused warnings in the tests
* Changed the Bspline-f-m.tfm test data to include larger bulk component to make errors more detectable
* Added tests for composite transforms (e.g., hardened combination of grid and bspline transform)
* Split the transform node's huge read/write methods to separate smaller methods (one for each transform type)
* Added the option of loading a .mha file as a grid transform

Extensions updated according to the API change: OpenIGTLinkIF, SlicerIGT, SlicerRT, and TransformVisualizer. See details at:
https://github.com/openigtlink/OpenIGTLinkIF/pull/25
https://github.com/SlicerIGT/FiducialRegistrationWizard/pull/14
https://github.com/SlicerIGT/BreachWarning/pull/1
https://github.com/SlicerIGT/PivotCalibration/pull/13
https://github.com/SlicerIGT/TransformFusion/pull/2
https://www.assembla.com/spaces/slicerrt/tickets/563

Tests performed:

* All automatic tests passed (except those that are known to fail in the nightly builds)

* Load MRBrainTumor1 & MRBrainTumor2 sample
* Create model of MRBrainTumor2, threshold=50
* Linear registration with BRAINS (fixed: MRBrainTumor1 & moving: MRBrainTumor2)
* VERIFY: the resampled output image should look the same as the dynamically transformed moving volume, checked on several slices
* Save the transform as tfm from file, load the transform from file, apply the transform to the moving image
* VERIFY: the resampled output image should look the same as the dynamically transformed moving volume
* Apply transform to the model
* VERIFY: model is deformed in the 3D view, aligned with the volume slices
* Harden transform to the model
* VERIFY: model in the 3D view doesn’t change, model slice intersections are aligned with the volume
* Harden the transform on the volume
* VERIFY: the image doesn’t change too much

* BSpline registration with BRAINS (fixed: MRBrainTumor1 & moving: MRBrainTumor2)
* VERIFY: the resampled output image should look the same as the dynamically transformed moving volume
* Save the transform as tfm from file, load the transform from file, apply the transform to the moving image
* VERIFY: the resampled output image should look the same as the dynamically transformed moving volume
* Apply transform to the model
* VERIFY: model is deformed in the 3D view, aligned with the volume slices
* Harden transform to the model
* VERIFY: model in the 3D view doesn’t change, model slice intersections are aligned with the volume
* Insert linear transform between bspline and volume, move sliders
* VERIFY: volume deforms as it travels through the BSpline region
* Harden the transform on the volume
* VERIFY: the image doesn’t change too much

* Create a two markup list (each having 15 points), all but 3 in the same position
* Landwarp registration with Plastimatch with the markup lists, save the displacement field to file
* Load the displacement field
* VERIFY: the resampled output image should look the same as the dynamically transformed moving volume
* Apply the displacement field to the moving fiducials
* VERIFY: all the fiducials are now in the same position
* Harden the transform on the fiducials
* VERIFY: the fiducials don’t move
* Apply transform to the model
* VERIFY: model is deformed in the 3D view, aligned with the volume slices
* Harden transform to the model
* VERIFY: model in the 3D view doesn’t change, model slice intersections are aligned with the volume
* Harden the transform on the volume
* VERIFY: the image doesn’t change too much

* Load MRI head, create new linear transform, apply to the volume, move the sliders
* VERIFY: the volume moves in the slice viewer, the numbers change in the matrix
* Click Invert, Identity
* VERIFY: volume jumps to other side, to the center
* Connect to an OpenIGTLink server, apply a transform to a volume
* VERIFY: transform matrix values updated in transforms module, volume moves


git-svn-id: http://svn.slicer.org/Slicer4/trunk@23008 3bd1e089-480b-0410-8dfb-8563597acbee
mod - Base/Logic/vtkSlicerApplicationLogic.cxx Diff File
mod - Base/QTCore/qSlicerSlicer2SceneReader.cxx Diff File
mod - Base/QTCore/qSlicerXcedeCatalogReader.cxx Diff File
mod - Libs/MRML/Core/CMakeLists.txt Diff File
mod - Libs/MRML/Core/Testing/NonLinearTransformScene.mrml Diff File
mod - Libs/MRML/Core/Testing/TestData/Bspline-f-m.tfm Diff File
mod - Libs/MRML/Core/Testing/vtkMRMLLinearTransformNodeEventsTest.cxx Diff File
mod - Libs/MRML/Core/Testing/vtkMRMLNonlinearTransformNodeTest1.cxx Diff File
mod - Libs/MRML/Core/Testing/vtkMRMLTransformNodeTest1.cxx Diff File
mod - Libs/MRML/Core/Testing/vtkMRMLTransformableNodeOnNodeReferenceAddTest.cxx Diff File
mod - Libs/MRML/Core/Testing/vtkMRMLTransformableNodeTest1.cxx Diff File
mod - Libs/MRML/Core/vtkMRMLBSplineTransformNode.cxx Diff File
mod - Libs/MRML/Core/vtkMRMLBSplineTransformNode.h Diff File
mod - Libs/MRML/Core/vtkMRMLCoreTestingMacros.h Diff File
mod - Libs/MRML/Core/vtkMRMLGridTransformNode.cxx Diff File
mod - Libs/MRML/Core/vtkMRMLGridTransformNode.h Diff File
mod - Libs/MRML/Core/vtkMRMLLinearTransformNode.cxx Diff File
mod - Libs/MRML/Core/vtkMRMLLinearTransformNode.h Diff File
mod - Libs/MRML/Core/vtkMRMLScene.cxx Diff File
mod - Libs/MRML/Core/vtkMRMLTransformNode.cxx Diff File
mod - Libs/MRML/Core/vtkMRMLTransformNode.h Diff File
mod - Libs/MRML/Core/vtkMRMLTransformStorageNode.cxx Diff File
mod - Libs/MRML/Core/vtkMRMLTransformStorageNode.h Diff File
mod - Libs/MRML/Logic/vtkMRMLSliceLogic.cxx Diff File
mod - Libs/MRML/Widgets/Testing/qMRMLNodeComboBoxTest1.cxx Diff File
mod - Libs/MRML/Widgets/Testing/qMRMLNodeComboBoxTest2.cxx Diff File
mod - Libs/MRML/Widgets/Testing/qMRMLNodeSelectorTest1.cxx Diff File
mod - Libs/MRML/Widgets/qMRMLLinearTransformSlider.cxx Diff File
mod - Libs/MRML/Widgets/qMRMLMatrixWidget.cxx Diff File
mod - Libs/MRML/Widgets/qMRMLUtils.cxx Diff File
mod - Libs/vtkITK/vtkITKBSplineTransform.cxx Diff File
mod - Libs/vtkITK/vtkITKBSplineTransform.h Diff File
mod - Modules/CLI/ACPCTransform/ACPCTransform.cxx Diff File
mod - Modules/Loadable/ModelMirror/Logic/vtkModelMirrorLogic.cxx Diff File
mod - Modules/Loadable/Models/Logic/vtkSlicerModelsLogic.cxx Diff File
mod - Modules/Loadable/Transforms/Testing/Cxx/qSlicerTransformsModuleWidgetTest.cxx Diff File
mod - Modules/Loadable/Transforms/qSlicerTransformsModuleWidget.cxx Diff File
mod - Modules/Loadable/Transforms/qSlicerTransformsReader.cxx Diff File
mod - Modules/Scripted/Endoscopy/Endoscopy.py Diff File
mod - SuperBuild.cmake Diff File
mod - Testing/TextureModel.py Diff File

Issue History

Date Modified Username Field Change
2014-03-03 13:11 lassoan New Issue
2014-03-05 02:44 lassoan Status new => assigned
2014-03-05 02:44 lassoan Assigned To => lassoan
2014-03-05 02:44 lassoan Note Added: 0010681
2014-03-05 14:45 lassoan Note Added: 0010685
2014-03-19 09:56 lassoan Note Added: 0011452
2014-03-19 09:57 lassoan Status assigned => resolved
2014-03-19 09:57 lassoan Resolution open => fixed
2014-03-26 08:50 jcfr Fixed in Version => Slicer 4.4.0
2014-03-26 08:50 jcfr Target Version => Slicer 4.4.0
2014-09-17 22:59 jcfr Status resolved => closed
2014-09-17 23:01 jcfr Note Added: 0012566
2017-06-10 08:51 lassoan Changeset attached => Slicer master 29dc6a68