[vtkusers] Displaying DICOM images in grayscale
Alexis Cheng
acheng_1221 at hotmail.com
Fri Apr 6 10:26:21 EDT 2012
Dear all,
I'm having some trouble displaying DICOM images read in with vtkDICOMImageReader in grayscale. I was able to display it in grayscale using imageViewer2 as per the example, but not with this texture, mapper, actor, renderer setup. My pipeline looks like this:
/////
for (int i = 0; i < inputFileVector.size(); i++)
{
// Read all the DICOM files in the specified directory.
vtkSmartPointer<vtkDICOMImageReader> reader = vtkSmartPointer<vtkDICOMImageReader>::New();
reader->SetFileName(inputFileVector.at(i).c_str());
reader->Update();
vtkSmartPointer<vtkImageData> dicomImage = vtkSmartPointer<vtkImageData>::New();
dicomImage = reader->GetOutput();
imageSet.push_back(dicomImage);
}
planeSource->SetCenter(center.x, center.y, 0.0);
planeSource->SetNormal(0.0, 0.0, 1.0);
planeSource->Update();
vtkSmartPointer<vtkImageData> image = imageSet.at((int)getSliceNum());
texture->SetInput(image);
texturePlane->SetInputConnection(planeSource->GetOutputPort());
mapper->SetInputConnection(texturePlane->GetOutputPort());
imageActor->SetMapper(mapper);
imageActor->SetTexture(texture);
renderer->AddActor(imageActor);
renderWindow->Render();
/////
The result is that the DICOM image is being displayed in RGB colours. From my searches online, it sounds like I need to apply a lookup table that will convert RGB into luminance, but is that the only way? If imageviewer2 can display it in grayscale without a lookup table, then I would imagine this could do so as well. Thank you in advance for your attention.
Regards,
Alexis Cheng
Computer Science
Johns Hopkins University
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20120406/406b029b/attachment.htm>
More information about the vtkusers
mailing list