ITK更新函数

ITK update function

我正在尝试使球体变形,然后在 vtk 上显示它。

我在使用 Update() 函数时遇到问题,因为我不确定是否必须在创建每个过滤器后都使用它。

typedef itk::TriangleMeshToSimplexMeshFilter< TMesh, TSimplex > TConvert;
typedef itk::SimplexMeshToTriangleMeshFilter< TSimplex, TMesh > TReverseConvert;
typedef itk::DeformableSimplexMesh3DBalloonForceFilter< TSimplex, TSimplex > TDeform;

TConvert::Pointer convertSimplex = TConvert::New();
convertSimplex->SetInput(sphere->GetOutput());
//If I use Update the next line then I'm having errors at execution
convertSimplex->Update();

TDeform::Pointer balloon = TDeform::New();
balloon->SetInput(convertSimplex->GetOutput());
//....Some deform values i.e. alpha and beta
balloon->SetRigidity(0);
balloon->Update(); //Again the same problem

TReverseConvert::Pointer reverse = TReverseConvert::New();
reverse->SetInput(ballon->GetOutputPort());
reverse->Update();

我是否必须在所有过滤器的末尾执行此操作?如果我添加越来越多的过滤器但我不知道它们的顺序怎么办? (假设顺序取决于用户操作)

您只需在管道中的最后一个过滤器上调用 Update()。这个答案的其余部分是解释。

ITK 为过滤器使用管道执行框架。假设我们有三个按顺序连接的过滤器,如下所示:

输入 --> |filter1| --> |过滤器2| --> |过滤器3| --> 输出

如果您在 filter3 上调用 Update(),ITK 从 filter3 开始并检查每个过滤器的输入是否已更改。如果有,ITK 依次调用它们的更新。请参阅此 link.

的幻灯片 5