我正在尝试使球体变形,然后在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 | -> | filter2 | -> | filter3 | ->输出

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

关于c++ - ITK更新功能,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/35850679/

10-10 07:26