[vtkusers] Defining the begining CT value when setting window level of a slice?

Dean Inglis dean.inglis at camris.ca
Mon May 23 19:54:50 EDT 2011


try this:

reader->Update();
double range[2];
reader->GetOutput()->GetScalarRange(range);
 sagittalViewer->SetColorWindow( range[1]-range[0]);
 sagittalViewer->SetColorLevel(0.5*(range[0]+range[1]));

HTH,
Dean


I want to be able to define begining HU value of a slice when setting its
color window. The SetColorWindow method sets its window width but from where
to where? 0 HU to 100 HU ? 400 HU to 500 HU ? How can I set the beginning HU
value ? Thanks

        sagittalViewer = vtkSmartPointer < vtkImageViewer2 > :: New();
 sagittalViewer->SetInputConnection(reader->GetOutputPort());
 sagittalViewer->SetSliceOrientation(0); // Saggital = 0, Coronal = 1, Axial
= 2

 vtkSmartPointer < vtkWin32RenderWindowInteractor> iren = vtkSmartPointer <
vtkWin32RenderWindowInteractor>::New();
 sagittalViewer->SetupInteractor(iren);
        sagittalViewer->SetColorLevel(50.0);
        sagittalViewer->SetColorWindow(100.0);
 sagittalViewer->GetRenderer()->GetActiveCamera()->SetViewUp(0, 0, -1);
 sagittalViewer->GetRenderer()->GetActiveCamera()->SetPosition(1, 0, 0);
 sagittalViewer->GetRenderer()->GetActiveCamera()->SetFocalPoint(0, 0, 0);
 sagittalViewer->GetRenderer()->GetActiveCamera()->ComputeViewPlaneNormal();
 sagittalViewer->GetRenderer()->ResetCamera();
 sagittalViewer->GetRenderWindow()->Render();
 iren->Initialize();





More information about the vtkusers mailing list