View Issue Details

IDProjectCategoryView StatusLast Update
0003751Slicer4Module Transformspublic2014-06-27 13:43
ReporteralexyAssigned Toalexy 
PrioritynormalSeveritymajorReproducibilityhave not tried
Status resolvedResolutionfixed 
Product VersionSlicer 4.3.1-2 
Target VersionFixed in Version 
Summary0003751: Hardening model transforms is broken after switch to VTK6
Description

Hi Jc and all,

I have been fixing the subject hierarchy logic test that was failing, and managed to get through one error, but then I discovered, that there might be a bug in the transform hardening.

I tried doing that through the Slicer UI, and had the same thing:

  • Load model
  • Create transform, set some translation
  • Set transform as parent to model -> model moves
  • Go to Data (or SH) module, do hardening -> model moves back to original place!

There are two questions I’d like to ask:

  1. Can anyone reproduce this?
  2. Does any other automatic test tests hardening other than vtkSlicerSubjectHierarchyModuleLogicTest? (if yes, does it fail too?)

For now I’ll commit the fix I made in the core, and see how this hardening issue unfolds.

What is strange is that hardening doesn’t work for me on a model loaded from file and doing the steps I wrote in the previous email, but works with this python script:

sphere = vtk.vtkSphereSource()
sphere.SetCenter( 0,0,0 )
sphere.SetRadius( 50 )
sphere.Update()
displayNode = slicer.vtkMRMLModelDisplayNode()
displayNode = slicer.mrmlScene.AddNode(displayNode)
displayNode.SliceIntersectionVisibilityOn()
displayNode.VisibilityOn()
displayNode.SetBackfaceCulling(0)
modelNode = slicer.vtkMRMLModelNode()
modelNode=slicer.mrmlScene.AddNode(modelNode)
modelNode.SetName("model")
modelNode.SetAndObservePolyData(sphere.GetOutput())
modelNode.SetAndObserveDisplayNodeID(displayNode.GetID())
modelNode.SetHideFromEditors(0)
modelNode.SetSelectable(1)
transformMatrix = vtk.vtkMatrix4x4()
transformMatrix.SetElement(0,3,100)
transformNode = slicer.vtkMRMLLinearTransformNode()
displayNode = slicer.mrmlScene.AddNode(transformNode)
transformNode.SetAndObserveMatrixTransformToParent(transformMatrix)
modelNode.SetAndObserveTransformNodeID(transformNode.GetID())
transformLogic = slicer.logic.vtkSlicerTransformLogic()
transformLogic.hardenTransform(modelNode)

However, if you call this again:
modelNode.SetAndObserveTransformNodeID(transformNode.GetID())
transformLogic.hardenTransform(modelNode)

then it doesn’t harden, but jumps back to its original place.

Thanks,
csaba

TagsNo tags attached.

Activities

alexy

alexy

2014-06-27 12:24

developer   ~0012106

Seems like the following one line change fixes the issue just by analogy. But since I don't understand the purpose of this code can Jc or Julien review the change:

Index: vtkMRMLModelNode.cxx

--- vtkMRMLModelNode.cxx (revision 23387)
+++ vtkMRMLModelNode.cxx (working copy)
@@ -287,7 +287,6 @@
}
}

-
//---------------------------------------------------------------------------
const char * vtkMRMLModelNode::GetActivePointScalarName(int type)
{
@@ -394,7 +393,6 @@
int showOverlayPositive, int showOverlayNegative,
int reverseOverlay)
{

 if (backgroundName == NULL || overlayName == NULL)
   {
   vtkErrorMacro("CompositeScalars: one of the input array names is null");

@@ -596,7 +594,7 @@
bool isInPipeline = !vtkTrivialProducer::SafeDownCast(
this->GetPolyData() ? this->GetPolyData()->GetProducerPort()->GetProducer() : 0);
#else

  • bool isInPipeline = vtkTrivialProducer::SafeDownCast(
  • bool isInPipeline = !vtkTrivialProducer::SafeDownCast(
    this->PolyDataConnection ? this->PolyDataConnection->GetProducer() : 0);
    #endif
    vtkSmartPointer<vtkPolyData> polyData;
    @@ -636,7 +634,6 @@
    this->GetPolyData()->GetBounds(boundsLocal);

    this->TransformBoundsToRAS(boundsLocal, bounds);

  • }

    //---------------------------------------------------------------------------

finetjul

finetjul

2014-06-27 13:36

administrator   ~0012107

Yes, that looks good. There was a typo in the code. Thanks for fixing it.

alexy

alexy

2014-06-27 13:43

developer   ~0012108

Per Julian's note above, committed the fix.

At revision: 23391

Issue History

Date Modified Username Field Change
2014-06-27 11:55 alexy New Issue
2014-06-27 11:56 alexy Assigned To => finetjul
2014-06-27 11:56 alexy Status new => assigned
2014-06-27 12:24 alexy Note Added: 0012106
2014-06-27 13:36 finetjul Note Added: 0012107
2014-06-27 13:42 alexy Assigned To finetjul => alexy
2014-06-27 13:43 alexy Note Added: 0012108
2014-06-27 13:43 alexy Status assigned => resolved
2014-06-27 13:43 alexy Resolution open => fixed