[vtkusers] vtkDistanceWidget and Dicom Images

Leonardo M. Ramé l.rame at griensu.com
Tue Oct 19 14:06:02 EDT 2010


On 2010-10-19 13:53:19 -0400, David Doria wrote:
> >
> > I'm going crazy trying to find an example on the web, could you give me
> > one?
> 
> 
> This explains the filter:
> http://www.vtk.org/doc/nightly/html/classvtkImageChangeInformation.html
> 
> And this demonstrates it:
> http://www.vtk.org/Wiki/VTK/Examples/Cxx/Images/CenterAnImage
> 
> David

Thanks, after checking the examples I come up with this:

// get pixel spacing and apply to image
double lPixelSpacing;
m_qdicomImage->getDataSet()->findAndGetFloat64(DCM_PixelSpacing, lPixelSpacing, 0, false);
m_imageDataVTK->SetSpacing(lPixelSpacing, lPixelSpacing,lPixelSpacing);

// change image information
vtkImageChangeInformation * in = vtkImageChangeInformation::New();
in->SetInput(m_imageDataVTK);
in->SetOutputSpacing(1.0, 1.0, 1.0);
in->Update();
m_imageDataVTK = in->GetOutput();
...

Aparently in->SetOutputSpacing is reverting the changes that SetSpacing
did. The measurement is multiplied by 5 (1 / 0.20), and I'm getting the
same results like if I don't apply SetSpacing.

Any hint?

-- 
Leonardo M. Ramé
http://leonardorame.blogspot.com



More information about the vtkusers mailing list