[vtkusers] Origin Resetting Itself

Samuel Barnes ironictoo at yahoo.com
Tue May 30 13:16:44 EDT 2006


I am using vtkExtractVOI to crop a dataset and then translate the extent so it starts at 0.  This cropping and translation moves the origin to a non (0,0,0) value.  To correct this I manually set it back to (0,0,0).  This works fine, but on some datasets when I apply a smoothing filter (vtkSmoothPolyDataFilter, vtkImageGaussianSmooth) or a widget (vtkImagePlaneWidget) these functions will change the origin back to its previous non (0,0,0) value.

Where is the origin being stored so that it can be restored, and how do I change that also?  Code shown below:

Crop funtion, image is type vtkImgeData:
    vtkExtractVOI* cropVOI = vtkExtractVOI::New();
    cropVOI->SetInput(image);
    cropVOI->SetVOI(crop);

    //Translate extent so that extent is from 0->max-x,y,z
    
    vtkImageTranslateExtent* cropTrans = vtkImageTranslateExtent::New()
    cropTrans->SetInput(cropVOI->GetOutput());
    cropTrans->SetTranslation(-crop[0], -crop[2], -crop[4]);

Pipeline I call the following classes:
vtkImageData
vtkImageGaussianSmooth (if smoothing is turned on)
vtkMarchingCubes
vtkPolyDataMapper
vtkActor

As soon as I call the SetInput() function on vtkImageGaussianSmooth it restores the old origin on the vtkImageData data set.  What is even more confusing is that this doesn't happen on all datasets.  For example the example dataset ironProt.vtk has this problem, but some my own custom datasets don't.  Any help would be appreciated.

Sam
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20060530/12c9ac66/attachment.htm>


More information about the vtkusers mailing list