ITK: SphinxExamples/src/Filtering/ImageGrid/ShrinkImage/Code.cxx
3D image:
下面按维度缩小:
0:缩小为原来的1/4
1:缩小为原来的1/4
2:按原来的尺寸不变
using ShrinkImageFilterType = itk::ShrinkImageFilter<ImageType, ImageType>;
ShrinkImageFilterType::Pointer shrinkFilter = ShrinkImageFilterType::New();
shrinkFilter->SetInput(image);
shrinkFilter->SetShrinkFactor(0, 4); // shrink the first dimension by a factor of 2 (i.e. 100 gets changed to 50)
shrinkFilter->SetShrinkFactor(1, 4); // shrink the second dimension by a factor of 3 (i.e. 100 gets changed to 33)
shrinkFilter->SetShrinkFactor(2, 1);
shrinkFilter->Update();