[vtkusers] vtkDistanceWidget and Dicom Images

Leonardo M. Ramé l.rame at griensu.com
Tue Oct 19 13:24:28 EDT 2010


On 2010-10-19 18:20:24 +0100, Jothy wrote:
> Try ResetCameraClippingRange() on renderer.
> 
> Jothy
> 

I tried that, but it does not work. Could you take a look at my code
below?, maybe the ResetCameraClippingRange is not on the correct line:

mImage = m_qdicomImage->getDicomImage();
mImage->flipImage(0,-1);
m_imageDataVTK->SetOrigin( 0, 0, 0 );

m_imageDataVTK->SetDimensions( mImage->getWidth(),
mImage->getHeight(), 1 );
m_imageDataVTK->SetScalarTypeToUnsignedShort(); // the data will be 16 bit
m_imageDataVTK->AllocateScalars();


// apply PixelSpacing
double lPixelSpacing;
m_qdicomImage->getDataSet()->findAndGetFloat64(DCM_PixelSpacing, lPixelSpacing, 0, false);
m_imageDataVTK->SetSpacing(lPixelSpacing, lPixelSpacing, lPixelSpacing);

// aplicamos Window Level
m_qdicomImage->getDicomImage()->setWindow(0);
mImage->getOutputData(
  m_imageDataVTK->GetScalarPointer(0,0,0),
  mImage->getOutputDataSize()
);

m_ImageViewer->SetInput(m_imageDataVTK);
m_ImageViewer->SetRenderWindow(this->GetRenderWindow());
m_ImageViewer->SetupInteractor(this->GetInteractor());

// ResetCameraClippingRange 
m_ImageViewer->GetRenderer()->ResetCameraClippingRange();
-- 
Leonardo M. Ramé
http://leonardorame.blogspot.com



More information about the vtkusers mailing list