1.vtkExtractVOI
https://lorensen.github.io/VTKExamples/site/Cxx/ImageData/ExtractVOI/
/**
* @brief 提取体中感兴趣的某一区域块*/
vtkSmartPointer<vtkExtractVOI> extractVOI =
vtkSmartPointer<vtkExtractVOI>::New();
extractVOI->SetInputConnection(dicomReader->GetOutputPort());
extractVOI->SetVOI(dim[0]/4.,3.*dim[0]/4.,dim[1]/4.,3.*dim[1]/4.,dim[2]/4.,3.*dim[2]/4.);
extractVOI->Update();
2.vtkVolumeMapper->SetCroppingRegionPlanes
vtkSmartPointer<vtkGPUVolumeRayCastMapper> volumeMapper =
vtkSmartPointer<vtkGPUVolumeRayCastMapper>::New();
volumeMapper->SetInputData(dicomReader->GetOutput());//dicomReader->GetOutput()
/**
*提取体中的某一块*/
volumeMapper->SetCropping(1);//开启Cropping功能
volumeMapper->SetCroppingRegionPlanes(150, 300, 150, 300, 150, 300);
volumeMapper->SetCroppingRegionFlags(0x0002000);
3.vtkImageClip
https://lorensen.github.io/VTKExamples/site/Cxx/Interaction/ImageClip/
vtkSmartPointer<vtkImageClip> imageClip =
vtkSmartPointer<vtkImageClip>::New();
imageClip->SetInputConnection(jPEGReader->GetOutputPort());
jPEGReader->UpdateInformation();
imageClip->SetOutputWholeExtent(
jPEGReader->GetOutputInformation(0)->Get(
vtkStreamingDemandDrivenPipeline::WHOLE_EXTENT()));
imageClip->ClipDataOn();