我想在ITK中预先存在的扩展模板类中读取图像像素渐变的x和y分量。具体来说,我使用GradientImageFilter:
typedef GradientImageFilter< FixedImageType, float> FixedGradient;
然后我使用以下类型:
typedef CovariantVector< float, 2 > VectorPixelType;
typedef Image< VectorPixelType, 2 > VectorImageType;
为了定义以下图像适配器:
typedef ImageAdaptor< VectorImageType, VectorPixelAccessor> ImageAdaptorTypeFX;
VectorPixelAccessor accessorFX, accessorFY, accessorMX, accessorMY;
/ FixedImage X渐变 / ImageAdaptorTypeFX :: Pointer adaptorFX = ImageAdaptorTypeFX :: New();
accessorFX.SetIndex(0);
adaptorFX->SetPixelAccessor(accessorFX);
FixedGradient::Pointer f = FixedGradient::New();
f->SetInput(this->GetFixedImage());
f->Update();
adaptorFX->SetImage(f->GetOutput());
typedef Image< float, 2 > OutputImageType;
typedef RescaleIntensityImageFilter< ImageAdaptorTypeFX, FixedImageType> RescalerType;
RescalerType::Pointer rescaler = RescalerType::New();
rescaler->SetOutputMinimum(0);
rescaler->SetOutputMaximum(1);
rescaler->SetInput(adaptorFX);
rescaler->Update();
但是当我尝试访问重定标器的组件时,所有像素的get都为零。为什么会这样?顺便说一句,图像滤镜可以用于3D图像文件吗?