View Issue Details

IDProjectCategoryView StatusLast Update
0003993Slicer4Core: MRMLpublic2017-06-10 08:51
Reporterktdiedrich Assigned Tolassoan  
PrioritynormalSeverityminorReproducibilityalways
Status closedResolutionfixed 
Product VersionSlicer 4.4.0 
Target VersionFixed in VersionSlicer 4.5.0-1 
Summary0003993: Registration Transform only applies transform 1
Description

Nightly release 05-12-2015: From the Data module when dragging an image under a Transform (linear or BSpline) only Transform 1 and not Transform 2 is applied to the image.
The transforms can be applied to the image serially as separate transforms.

I tested the same transforms on stable Slicer 4.4.0 and both Transform 1 and Transform 2 are applied to an image.

TagsNo tags attached.

Activities

2015-05-20 10:22

 

SlicerTransformBugData.zip (1,183,101 bytes)
ktdiedrich

ktdiedrich

2015-05-20 11:05

reporter   ~0013077

Sample dta uploaded in ZIP file

In the current Slicer 05-19-2015
Load images:
preoperative.nrrd
intraoperative.nrrd

Load transforms:
AfBS2.h5 BSPline transform followed by linear transform
LT2.h5 The linear transform separate

Set intraoperative as background image and preoperative as foreground image in a viewer
Switch to Data module
Put preoperative under AfBS2.h5 , this should transform preoperative onto the intraoperative image by BSpline followed by a Linear Transform but only the BSpline transfroms the preoperative image.
Drag preoperative under LT2 and then drag preoperative to the AfBS2 and the preoperative is transformed onto the intraoperative image

pieper

pieper

2015-05-20 11:21

administrator   ~0013078

I'm trying the steps but I'm not understanding the issue.

To start, the volumes do not overlap.

Dragging preoperative under LT2 makes them overlap.

Dragging the preoperative under AfBS2 makes them overlap and applies the BSpline.

If you look at the AfBS2 Information in the transforms it includes both steps (linear and nonlinear).

If you drag preoperative under LT2 and then drag LT2 under AfBS2 then the volumes do not overlap.

I believe this behavior is correct and Slicer 4.4.0 was incorrect.

I'm going to run this by Andras for his analysis.

ktdiedrich

ktdiedrich

2015-05-20 12:25

reporter   ~0013079

The volume don't overlap to start. AfBS2 was made with BRAINSfit affine and BSpline registration modes checked to transform preoperative onto intraoperative with 1 transform object (containing 2 transforms).

We shouldn't need LT2.

Slicer 4.4.0 does 2 transforms transforming preoperative on intraoperative.

I made LT2 with only affine checked in BRAINSfit to test the linear transform separately from the BSpline transform.

lassoan

lassoan

2015-05-20 14:04

developer   ~0013080

The transforms look good, they seem to be applied correctly. However, there seems to be an issue with the red slice viewer update: if the foreground volume is set before the transform is applied to the foreground volume then the red slice viewer does not show the foreground volume (the yellow and green slice viewers are OK). After I switch the foreground/background volume in the red slice viewer it starts to behave correctly.

Diedrich, can you confirm that if you switch the foreground and background volume (intraop foreground, preop background) then it starts to work correctly?

pieper

pieper

2015-05-20 14:19

administrator   ~0013081

I wonder if this is related to the layout manager issue that came up recently.

https://github.com/Slicer/Slicer/commit/2118883d08f404d5ec035c5271dbec1b7e83532b

lassoan

lassoan

2015-05-21 06:32

developer   ~0013083

After several hours of debugging I've finally found the root cause of the issue:

in int vtkImageReslice::RequestUpdateExtent() if this->ResliceTransform is not a vtkHomogeneousTransform then the hole input extent is updated and then the method returns. However, it does not touch the this->HitInputExtent flag. If the this->HitInputExtent was 0 before then the output of the filter remains always 0.

Probably the simplest fix is to set the HitInputExtentFlag to 1 if the reslice transform is not homogeneous:

VTKv6/Imaging/Core/vtkImageReslice.cxx:

@@ -592,6 +592,7 @@ int vtkImageReslice::RequestUpdateExtent(
{ // update the whole input extent if the transform is nonlinear
inInfo->Get(vtkStreamingDemandDrivenPipeline::WHOLE_EXTENT(), inExt);
inInfo->Set(vtkStreamingDemandDrivenPipeline::UPDATE_EXTENT(), inExt, 6);

  • this->HitInputExtent = 1;
    return 1;
    }
    }
lassoan

lassoan

2015-05-21 06:43

developer   ~0013084

I've sent an email to David Gobbi to confirm that this is an issue in vtkImageReslice.

pieper

pieper

2015-05-21 06:43

administrator   ~0013085

Wow, amazing detective work Andras! Shall we put that in github.com:Slicer/VTK and propose it to kitware:VTK/VTK?

lassoan

lassoan

2015-05-21 08:15

developer   ~0013087

I've sent a pull request to fix it in Slicer's VTK fork:
https://github.com/Slicer/VTK/pull/6

I've checked the process for sending patches to VTK and it seems to be very long/difficult and I don't have any more time to spend with this issue.

pieper

pieper

2015-05-21 08:39

administrator   ~0013088

Understood - I merged the pull request and am testing on mac. If all is good I will update the version of VTK in slicer.

pieper

pieper

2015-05-21 08:57

administrator   ~0013089

Updated slicer/vtk superbuild hash in r24272

Thanks Andras!

Karl, please test on your own build or tomorrow's nightly and close the issue if all is good.

lassoan

lassoan

2015-05-21 10:16

developer   ~0013090

David has integrated the patch into VTK:
https://gitlab.kitware.com/vtk/vtk/merge_requests/227

pieper

pieper

2015-05-21 11:15

administrator   ~0013091

Nice. Looks like it all worked as intended.

ktdiedrich

ktdiedrich

2015-05-26 05:07

reporter   ~0013100

Yes, it works with the fixed and moving images in both the foreground and background.

Related Changesets

Import 2017-06-07 23:51:09: master c560f575

2015-05-21 12:30:05

pieper

Details Diff
BUG: 0003993 fix update of render window when transform changes

Full credit to Andras Lasso for debugging this at the VTK level!

Issue is described on the bug report:

http://na-mic.org/Mantis/view.php?id=3993

git-svn-id: http://svn.slicer.org/Slicer4/trunk@24272 3bd1e089-480b-0410-8dfb-8563597acbee
mod - SuperBuild/External_VTKv6.cmake Diff File

Issue History

Date Modified Username Field Change
2015-05-13 12:52 ktdiedrich New Issue
2015-05-13 12:52 ktdiedrich Status new => assigned
2015-05-13 12:52 ktdiedrich Assigned To => alexy
2015-05-20 10:22 ktdiedrich File Added: SlicerTransformBugData.zip
2015-05-20 11:05 ktdiedrich Note Added: 0013077
2015-05-20 11:21 pieper Note Added: 0013078
2015-05-20 12:25 ktdiedrich Note Added: 0013079
2015-05-20 14:04 lassoan Note Added: 0013080
2015-05-20 14:19 pieper Note Added: 0013081
2015-05-21 06:32 lassoan Note Added: 0013083
2015-05-21 06:43 lassoan Note Added: 0013084
2015-05-21 06:43 pieper Note Added: 0013085
2015-05-21 08:15 lassoan Note Added: 0013087
2015-05-21 08:39 pieper Note Added: 0013088
2015-05-21 08:40 pieper Assigned To alexy => lassoan
2015-05-21 08:57 pieper Note Added: 0013089
2015-05-21 08:57 pieper Status assigned => resolved
2015-05-21 08:57 pieper Fixed in Version => Slicer 4.4.1
2015-05-21 08:57 pieper Resolution open => fixed
2015-05-21 10:16 lassoan Note Added: 0013090
2015-05-21 11:15 pieper Note Added: 0013091
2015-05-26 05:07 ktdiedrich Note Added: 0013100
2015-05-26 05:42 pieper Status resolved => closed
2015-09-09 08:29 jcfr Fixed in Version Slicer 4.4.1 => Slicer 4.5.0-1
2017-06-10 08:51 pieper Changeset attached => Slicer master c560f575