[vtkusers] Dicom Window/Level

Leonardo M. Ramé l.rame at griensu.com
Thu Oct 14 15:31:54 EDT 2010


Hi, I'm using DCMTK to open a Dicom image and transfer it to VTK to be
shown using vtkImageReader2, the image looks ok, and I can apply
window/level by dragging the mouse over it, but when I ask for the current
Window and Level using GetWindowLevel()->GetWindow() and
GetWindowLevel()->GetLevel() I get very different values compared to
other programs, like Aeskulap for example.

This is the code I use to get the image from DCMTK:

// note myDicomImage is of type DicomImage (from dcmtk)

unsigned long imgWidth = myDicomImage->getWidth();
imgWidth = imgWidth * (double)m_zoomfactor / 100.0;

double lPixelSpacing;
getDataSet()->findAndGetFloat64(DCM_PixelSpacing,
  lPixelSpacing, 0, false);

// mImage is of type DicomImage also

mImage = myDicomImage->createScaledImage(imgWidth);
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->SetNumberOfScalarComponents(1);
m_imageDataVTK->AllocateScalars();

myDicomImage->setWindow(0);
int rep = myDicomImage->getInterData()->getRepresentation();

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

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

In this example, when I get the values from m_Imageviewer
(vtkImageViewer2) I get this:

m_ImageViewer->GetWindowLevel()->GetWindow(): 27752
m_ImageViewer->GetWindowLevel()->GetLevel():  13899

on Aeskulap:

WindowWidth:  7522
WindowCenter: 5000

The image is a grayscale CR image.

What can be causing such different values?.
-- 
Leonardo M. Ramé
http://leonardorame.blogspot.com



More information about the vtkusers mailing list