[vtkusers] vtkImageViewer2 with big images

Leonardo M. Ramé l.rame at griensu.com
Mon Sep 20 08:37:45 EDT 2010


Hi, I'm working with vtkImageViewer2 + dcmtk to create a dicom viewer. With CR
images (~2mb) it works great, but with mammo images (~32mb) it slow to
apply Zoom and Window Level, does anyone recommends me a better way to
handle big images?.

This is the code to load the image into my vtkImageViewer2:

/* m_qdicomImage and mImage are wrappers around dcmtk's DicomImage class */
unsigned long imgWidth = m_qdicomImage->getDicomImage()->getWidth();
imgWidth = imgWidth * (double)m_zoomfactor / 100.0;

mImage = m_qdicomImage->getDicomImage()->createScaledImage(imgWidth);
mImage->flipImage(0,-1);

m_imageDataVTK->SetOrigin( 0, 0, 0 );
m_imageDataVTK->SetDimensions( mImage->getWidth(), mImage->getHeight(), 1 );
m_imageDataVTK->SetScalarTypeToUnsignedShort(); 
m_imageDataVTK->SetNumberOfScalarComponents(1);
m_imageDataVTK->AllocateScalars();

memcpy((unsigned short *)m_imageDataVTK->GetScalarPointer(0,0,0),
       (unsigned short *)mImage->getOutputData(16),
       mImage->getOutputDataSize() );

m_imageDataVTK->Modified();
m_ImageViewer->SetInput(m_imageDataVTK);

/* "this" is a QVTKWidget where I show the contents of m_ImageViewer */
m_ImageViewer->SetRenderWindow(this->GetRenderWindow());
m_ImageViewer->SetupInteractor(this->GetInteractor());

thanks in advance.

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



More information about the vtkusers mailing list