c#调用vtk显示dicom序列

        public static void test2()
        {
            // 创建 DICOM 阅读器
            vtkDICOMImageReader reader = vtkDICOMImageReader.New();
            //小端字节
            reader.SetDataByteOrderToLittleEndian();
            reader.SetDirectoryName("D:/dicom");
            reader.Update();

            // 获取 DICOM 序列的第一张图像数据
            vtkImageData imageData = reader.GetOutput();

            // 创建图像视窗
            vtkImageViewer2 viewer = vtkImageViewer2.New();
            viewer.SetInput(imageData);

            // 创建渲染窗口
            vtkRenderWindow renderWindow = vtkRenderWindow.New();
            viewer.GetRenderer().ResetCamera();
            renderWindow.AddRenderer(viewer.GetRenderer());

            // 创建交互器
            vtkRenderWindowInteractor interactor = vtkRenderWindowInteractor.New();
            interactor.SetRenderWindow(renderWindow);
            //renderWindow.SetSize(800, 600); // 设置渲染窗口大小为800x600
            // 启动渲染窗口交互器
            renderWindow.Render();
            interactor.Initialize();
            interactor.Start();
        }

你可能感兴趣的:(c#,开发语言,vtk,dicom)