[vtkusers] Bug in vtkExtractVOI

bryan cole bryan.cole at teraview.co.uk
Wed Apr 23 10:57:47 EDT 2003


>     
> 203 outAR[i] = ar[i] * this->SampleRate[i];
> 204 outOrigin[i] = origin[i] + voi[2*i]*ar[i] - outExt[2*i]*outAR[i];
> 205 outSize *= outDims[i];

I've also had a look at the code in CVS. The relevent changes occured
between revision 1.30 and 1.30.4.1 of vtkExtractVOI.cxx. Changes to
Lines 120-126 also relate to this issue.

> Personally I would vote for the output origin to remain in exactly the
> same spot.  This would allow one to position VOIs correctly inside of
> their super-volumes, which is a highly desirable characteristic.  Think
> for example of extracting an iso-surface from a VOI and then wanting to
> use this extracted isosurface in the containing volume.  This will break
> if the vtkExtractVOI moves the origin.

Although (previously) vtkExtractVOI shifted the vtkImageData Origin
according to the 0,0,0th corner of the extracted sub-volume, the
sub-volume retained the correct position with respect to the parent
volume. I.e. the absolute positions of all data-points are/were
correctly maintained.

> 
> I would like to change line 204 to:
> outOrigin[i] = origin[i]
> along with a fat comment explaining the reasoning behind that.
> 
> Thoughts?

I think this breaks the VTK data-model (and my application!). In VTK
every data-point has a position in 3D space. For unstructured data,
these poisitions defined explicitly for each point. For structured
points / vtkImageData, the point positions are implicitly given by the
dataset Origin and Spacing. Thus the Origin of a vtkImageData dataset
is, by definition, the position of the 0,0,0th point. (N.B. the Origin
is not defined for unstructured dataset types)

I tried setting the origin to be unchanged by vtkExtractVOI (as you
suggested), but the vtkVolumeRenderers place the volume in the wrong
place, since they don't appear to take into account the offset of the
WholeExtent.

I have fixed my local copy to recover the "old" behaviour (shifting the
origin). I think we need some clarification from the VTK core-developers
as to what the "correct" behaviour should be.

cheers,
Bryan

> 
> Thanks,
> Charl
-- 
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




More information about the vtkusers mailing list