[vtkusers] vtkImageMapToWindowLevelColors
zx_sanjin at 163.com
zx_sanjin at 163.com
Mon Jan 22 22:40:24 EST 2007
hi all guys:
I'm using the vtkImageMapToWindowLevelColors class for "Match Colors". I used VS2005, vtk 4.1 under the winodwsXP.
I can get the "Match Colors" result, but the result is not good - It seems that something above the result.
Here is my code:
void TestMap2Color()
{
vtkDICOMImageReader* reader = vtkDICOMImageReader::New();
reader->SetFileName("c:\\IM2");
reader->Update();
vtkLookupTable *hueLut = vtkLookupTable::New();
hueLut->SetTableRange (0, 2000);
hueLut->SetHueRange (0, 1);
hueLut->SetSaturationRange (1, 1);
hueLut->SetValueRange (1, 1);
hueLut->Build(); //effective built
vtkImageMapToWindowLevelColors* pImageMapToColors = vtkImageMapToWindowLevelColors ::New();
pImageMapToColors->SetLookupTable(hueLut);
pImageMapToColors->SetInput(reader->GetOutput());
pImageMapToColors->Update();
vtkImageViewer* pViewer = vtkImageViewer::New();
pViewer->SetInput(pImageMapToColors->GetOutput());
pViewer->GetImageMapper()->SetColorLevel(10);
pViewer->GetImageMapper()->SetColorWindow(100);
pViewer->Render();
vtkRenderWindowInteractor *iren = vtkRenderWindowInteractor::New();
iren->SetRenderWindow(pViewer->GetRenderWindow());
iren->Initialize();
iren->Start();
}
I upload a bmp file for the screen-shot : http://www.chmbook.com/cpptk/upload/20071/cpb2_2007123113255.jpg
If I used vtkImageViewer2 instead of vtkImageViewer, It work fine! show for this: http://www.chmbook.com/cpptk/upload/20071/cpb2_2007123113632.jpg
I checked the vtk code, and I found the vtkImageViewer2 class used the vtkImageActor class, that based on vtkProp2D,
and, the vtkImageViewer class used the vtkActor2D. But in our project, we must be used the vtkActor2D class:(
I think that only remove something in the render result is ok, but how can I do?
Another question, I must use these code in above code:
pViewer->GetImageMapper()->SetColorLevel(10);
pViewer->GetImageMapper()->SetColorWindow(100);
otherwise I can't get any result, why?
Thanks for any advice!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20070123/c41ffed9/attachment.htm>
More information about the vtkusers
mailing list