#include "vtkImageDataGeometryFilter.h"

#include "vtkWarpScalar.h"
#include "vtkDICOMImageReader.h"
#include "vtkImageData.h"
#include "vtkRenderWindow.h"
#include "vtkRenderer.h"
#include "vtkPolyDataMapper.h"
#include "vtkRenderWindowInteractor.h"
#include "vtkSmartPointer.h"
#include "vtkActor.h"


int main(int, char *[])
{
vtkSmartPointer dicomReader = vtkSmartPointer::New();
vtkSmartPointer p_w_picpathData = vtkSmartPointer::New();
dicomReader->SetFileName("D:\\Ducments\\VS2008\\FrameClickColor -1\\CT.1.2.840.113619.2.108.3994723703.8049.1137556649.531.dcm");
dicomReader->Update();
p_w_picpathData = dicomReader->GetOutput();

vtkSmartPointer filter = vtkSmartPointer::New();
filter->SetInput(p_w_picpathData);
vtkSmartPointer rape = vtkSmartPointer::New();
rape->SetInput(filter->GetOutput());
rape->SetScaleFactor(0.5);

vtkSmartPointer mapper = vtkSmartPointer::New();
vtkSmartPointer actor = vtkSmartPointer::New();

mapper->SetInput(rape->GetPolyDataOutput());
mapper->SetScalarRange(p_w_picpathData->GetScalarRange());

  actor->SetMapper(mapper);

vtkSmartPointer rewin = vtkSmartPointer::New();
vtkSmartPointer render = vtkSmartPointer::New();
vtkSmartPointer iren = vtkSmartPointer::New();

rewin->AddRenderer(render);
render->AddActor(actor);
iren->SetRenderWindow(rewin);

iren->Initialize();
iren->Start();

}
 
 

vtk二维图像三维显示,Z轴表示灰度_第1张图片