VTK :图像处理_窗口分割和图像融合 报错 Input for connection on index 0 input port index 1 for algorithm vtkImageBlen

报错vtkCompositeDataPipeline (004A4880): Input for connection on index 0 input port index 1 for algorithm vtkImageBlend(004A1958) is of type vtkImageData, but a vtkImageStencilData is required.

只需将原程序中

imageBlend->SetInput(0,reader->GetOutput());
imageBlend->SetInput(1,imageSource->GetOutput());

改为

imageBlend->AddInputData(reader->GetOutput());
imageBlend->AddInputData(imageSource->GetOutput());

即可。

----------------------上面办法测试了,好像不行,虽然不报错了,但是图片没有融合进去--------

 

/*blend->SetInputData(reader->GetOutput());
    blend->SetInputData(source->GetOutput());*/
    /**
    
vtkCompositeDataPipeline (004A4880): Input for connection on index 0 input port index 1 for algorithm vtkImageBlend(004A1958) is of type vtkImageData, but a vtkImageStencilData is required.
    当vtkImageBlend的inputData大于2个对象时,需要通过AddInputData来设置InputData,demo如下:
 
    **/


    blend->AddInputData(reader->GetOutput());
    blend->AddInputData(source->GetOutput());
    blend->SetOpacity(0, 0.4);
    blend->SetOpacity(1, 0.6);

改成 AddInputData 后执行成功;

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

小道士写程序

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值