[vtkusers] SetDataSpacing does not work

Mathieu Malaterre mathieu.malaterre at kitware.com
Fri Oct 6 09:38:42 EDT 2006


samo wrote:
> 
> Hello there
> 
> I try to manipulate the data spacing from the data I get with
> vtkMetaImageReader. The problem is, that after a pipeline update, the
> spacing is set back to its original values. I don't understand why this
> happens. Why is vtk just ignoring the SetDataSpacing?
> 
> This is my code:
> 
> vtkMetaImageReader *in_Reader = vtkMetaImageReader::New();
> in_Reader->SetFileName( "MyFile.mhd" );	
> in_Reader->Update();
> in_Reader->SetDataSpacing(1.0,1.0,5.0);  //at this point, the spacing is
> correct


Try changing that to:

in_Reader->GetOutput()->SetSpacing(1.,1.,5.);

HTH
Mathieu
Ps: why would you want to change the spacing when it is read from a file 
with a header ?



More information about the vtkusers mailing list