[vtk-developers] Re: [vtkusers] Bug in vtkExtractVOI

bryan cole bryan.cole at teraview.co.uk
Wed Apr 23 11:43:22 EDT 2003


> Maybe I looked to quickly.  One could keep the origin where it is, and
> make sure the extent takes into account the extraction, or "move" the
> origin so that extracted points are still at their correct positions. 
> It then seems that the previous "working" version of vtkExtractVOI did
> the latter which is obviously also good.
> 
> Could you perhaps post your patch?

A patch is attached (the result of 'cvs diff -u4' against todays CVS).
It would be good to understand what 'lawcc' was aiming for when the
previous changes to this filter were made, before using the patch to
restore the old behaviour.

Bryan

-- 
Bryan Cole
Teraview Ltd., 302-304 Cambridge Science Park, Milton Road, Cambridge CB4 0WG, United Kingdom.
tel: +44 (1223) 435380 / 435386 (direct-dial) fax: +44 (1223) 435382
-------------- next part --------------
? BEC-ExtractVOI.patch
Index: Imaging/vtkExtractVOI.cxx
===================================================================
RCS file: /cvsroot/VTK/VTK/Imaging/vtkExtractVOI.cxx,v
retrieving revision 1.34
diff -u -4 -r1.34 vtkExtractVOI.cxx
--- Imaging/vtkExtractVOI.cxx	17 Jan 2003 14:31:08 -0000	1.34
+++ Imaging/vtkExtractVOI.cxx	23 Apr 2003 15:25:52 -0000
@@ -116,15 +116,15 @@
       outDims[i] = 1;
       }
     }
 
-  // This makes sense for sample rates of 1, 1, 1.
-  wholeExtent[0] = voi[0];
-  wholeExtent[1] = voi[0] + outDims[0] - 1;
-  wholeExtent[2] = voi[2];
-  wholeExtent[3] = voi[2] + outDims[1] - 1;
-  wholeExtent[4] = voi[4];
-  wholeExtent[5] = voi[4] + outDims[2] - 1;
+  // reverting to 'old' behaviour for output extents and origin
+  wholeExtent[0] = 0;
+  wholeExtent[1] = outDims[0] - 1;
+  wholeExtent[2] = 0;
+  wholeExtent[3] = outDims[1] - 1;
+  wholeExtent[4] = 0;
+  wholeExtent[5] = outDims[2] - 1;
   
   output->SetWholeExtent( wholeExtent );
 }
 
@@ -200,9 +200,9 @@
       outDims[i] = 1;
       }
 
     outAR[i] = ar[i] * this->SampleRate[i];
-    outOrigin[i] = origin[i] + voi[2*i]*ar[i] - outExt[2*i]*outAR[i];
+    outOrigin[i] = origin[i] + voi[2*i]*ar[i];
     outSize *= outDims[i];
     }
   
   output->SetSpacing(outAR);


More information about the vtk-developers mailing list