100 vtkInformationVector **inputVector,
101 vtkInformationVector *outputVector) {
105 printMsg(
"Get input object from input vector", debug::Priority::VERBOSE);
106 auto blocks = vtkMultiBlockDataSet::GetData(inputVector[0], 0);
107 auto table = vtkTable::GetData(inputVector[1], 0);
112 printMsg(
"Load Blocks", debug::Priority::VERBOSE);
113 std::vector<vtkSmartPointer<vtkMultiBlockDataSet>> inputTrees;
115 printMsg(
"Load Blocks done.", debug::Priority::VERBOSE);
116 auto assignmentSolverArray
117 = blocks->GetFieldData()->GetArray(
"AssignmentSolver");
118 if(assignmentSolverArray)
122 if(treesNodes.size() != 0 and inputTrees[0]->GetBlock(0) != treesNodes[0])
123 resetDataVisualization();
125 std::vector<std::tuple<double, int, int, int, int>> coefs;
126 int const totalInputs = inputTrees.size() + table->GetNumberOfRows();
127 std::vector<bool> interpolatedTrees(totalInputs,
false);
128 for(
int i = 0; i < table->GetNumberOfRows(); ++i) {
130 = vtkDataArray::SafeDownCast(table->GetColumnByName(
"Alpha"))
133 = vtkDataArray::SafeDownCast(table->GetColumnByName(
"Index1_R"))
136 = vtkDataArray::SafeDownCast(table->GetColumnByName(
"Index2_R"))
139 = vtkDataArray::SafeDownCast(table->GetColumnByName(
"Index1"))
142 = vtkDataArray::SafeDownCast(table->GetColumnByName(
"Index2"))
145 coefs.emplace_back(alpha, index1R, index2R, index1, index2);
146 for(
int j = index1 + 1; j < index2; ++j)
147 interpolatedTrees[j] =
true;
150 return run<float>(outputVector, inputTrees, coefs, interpolatedTrees);
168 std::vector<std::tuple<double, int, int, int, int>> &coefs) {
172 printMsg(
"Construct trees", debug::Priority::VERBOSE);
174 const int numInputs = inputTrees.size();
176 setDataVisualization(numInputs);
178 std::vector<MergeTree<dataType>> intermediateMTrees(numInputs);
179 constructTrees<dataType>(
180 inputTrees, intermediateMTrees, treesNodes, treesArcs, treesSegmentation);
185 printMsg(
"Call base", debug::Priority::VERBOSE);
187 std::vector<MergeTree<dataType>> allMT_T;
189 execute<dataType>(intermediateMTrees, coefs, allMT_T, allMatching);
192 for(
size_t i = 0; i < allMT_T.size(); ++i) {
194 mergeTreeTemplateToDouble<dataType>(allMT_T[i], tree);
195 intermediateSTrees.emplace_back(tree);
203 vtkInformationVector *outputVector,
205 std::vector<std::tuple<double, int, int, int, int>> &coefs,
206 std::vector<bool> &interpolatedTrees) {
207 bool const OutputSegmentation =
false;
211 auto output_sequence = vtkMultiBlockDataSet::GetData(outputVector, 0);
212 auto output_matchings = vtkMultiBlockDataSet::GetData(outputVector, 1);
217 std::vector<vtkUnstructuredGrid *> treesNodesT;
218 std::vector<vtkUnstructuredGrid *> treesArcsT;
219 std::vector<vtkDataSet *> treesSegmentationT;
220 std::vector<std::vector<int>> treesNodeCorrMeshT;
221 std::vector<vtkSmartPointer<vtkMultiBlockDataSet>> inputTreesT;
224 while(cpt < coefs.size()) {
225 while(cpt < coefs.size() and std::get<2>(coefs[cpt]) <= index) {
226 treesNodesT.emplace_back(
nullptr);
227 treesArcsT.emplace_back(
nullptr);
228 treesSegmentationT.emplace_back(
nullptr);
229 treesNodeCorrMeshT.emplace_back();
230 inputTreesT.emplace_back(
nullptr);
233 treesNodesT.emplace_back(treesNodes[index]);
234 treesArcsT.emplace_back(treesArcs[index]);
235 treesSegmentationT.emplace_back(treesSegmentation[index]);
236 treesNodeCorrMeshT.emplace_back(treesNodeCorrMesh[index]);
237 inputTreesT.emplace_back(inputTrees[index]);
240 treesNodes.swap(treesNodesT);
241 treesArcs.swap(treesArcsT);
242 treesSegmentation.swap(treesSegmentationT);
243 treesNodeCorrMesh.swap(treesNodeCorrMeshT);
244 inputTrees.swap(inputTreesT);
246 std::vector<MergeTree<dataType>> intermediateMTrees;
247 mergeTreesDoubleToTemplate<dataType>(intermediateSTrees, intermediateMTrees);
248 std::vector<FTMTree_MT *> trees;
249 mergeTreeToFTMTree<dataType>(intermediateMTrees, trees);
251 output_sequence->SetNumberOfBlocks((OutputSegmentation ? 3 : 2));
254 vtkBlockNodes->SetNumberOfBlocks(intermediateMTrees.size());
255 output_sequence->SetBlock(0, vtkBlockNodes);
258 vtkBlockArcs->SetNumberOfBlocks(intermediateMTrees.size());
259 output_sequence->SetBlock(1, vtkBlockArcs);
260 if(OutputSegmentation) {
263 vtkBlockSegs->SetNumberOfBlocks(intermediateMTrees.size());
264 output_sequence->SetBlock(2, vtkBlockSegs);
268 std::vector<std::vector<SimplexId>> nodeCorr(intermediateMTrees.size());
269 int cptInterpolatedTree = 0;
270 for(
size_t i = 0; i < intermediateMTrees.size(); ++i) {
281 BranchDecompositionPlanarLayout);
300 visuMaker.
copyPointData(treesNodes[i], treesNodeCorrMesh[i]);
314 vtkOutputNode1->GetFieldData()->ShallowCopy(
315 treesNodes[i]->GetFieldData());
317 vtkOutputArc1->GetFieldData()->ShallowCopy(treesArcs[i]->GetFieldData());
318 if(treesSegmentation[i] and OutputSegmentation)
319 vtkOutputSegmentation1->GetFieldData()->ShallowCopy(
320 treesSegmentation[i]->GetFieldData());
323 if(interpolatedTrees[i]) {
325 vtkNew<vtkDoubleArray> vtkDistancePreviousKey{};
326 vtkDistancePreviousKey->SetName(
"DistancePreviousKeyFrame");
327 vtkDistancePreviousKey->SetNumberOfTuples(1);
328 vtkDistancePreviousKey->SetTuple1(
330 vtkOutputNode1->GetFieldData()->AddArray(vtkDistancePreviousKey);
332 vtkNew<vtkDoubleArray> vtkDistanceNextKey{};
333 vtkDistanceNextKey->SetName(
"DistanceNextKeyFrame");
334 vtkDistanceNextKey->SetNumberOfTuples(1);
335 vtkDistanceNextKey->SetTuple1(
337 vtkOutputNode1->GetFieldData()->AddArray(vtkDistanceNextKey);
339 vtkNew<vtkIntArray> vtkIndexPreviousKey{};
340 vtkIndexPreviousKey->SetName(
"IndexPreviousKeyFrame");
341 vtkIndexPreviousKey->SetNumberOfTuples(1);
342 vtkIndexPreviousKey->SetTuple1(
343 0, std::get<3>(coefs[cptInterpolatedTree]));
344 vtkOutputNode1->GetFieldData()->AddArray(vtkIndexPreviousKey);
346 vtkNew<vtkIntArray> vtkIndexNextKey{};
347 vtkIndexNextKey->SetName(
"IndexNextKeyFrame");
348 vtkIndexNextKey->SetNumberOfTuples(1);
349 vtkIndexNextKey->SetTuple1(0, std::get<4>(coefs[cptInterpolatedTree]));
350 vtkOutputNode1->GetFieldData()->AddArray(vtkIndexNextKey);
352 ++cptInterpolatedTree;
356 vtkMultiBlockDataSet::SafeDownCast(output_sequence->GetBlock(0))
357 ->SetBlock(i, vtkOutputNode1);
358 vtkMultiBlockDataSet::SafeDownCast(output_sequence->GetBlock(1))
359 ->SetBlock(i, vtkOutputArc1);
360 if(OutputSegmentation)
361 vtkMultiBlockDataSet::SafeDownCast(output_sequence->GetBlock(2))
362 ->SetBlock(i, vtkOutputSegmentation1);
368 output_matchings->SetNumberOfBlocks(intermediateMTrees.size() - 1);
369 for(
size_t i = 0; i < intermediateMTrees.size() - 1; ++i) {
374 = vtkUnstructuredGrid::SafeDownCast(
375 vtkMultiBlockDataSet::SafeDownCast(output_sequence->GetBlock(0))
378 = vtkUnstructuredGrid::SafeDownCast(
379 vtkMultiBlockDataSet::SafeDownCast(output_sequence->GetBlock(0))
381 std::vector<std::vector<SimplexId>> nodeCorrTemp;
382 nodeCorrTemp.emplace_back(nodeCorr[i]);
383 nodeCorrTemp.emplace_back(nodeCorr[i + 1]);
397 vtkNew<vtkDoubleArray> vtkDistance{};
398 vtkDistance->SetName(
"Distance");
399 vtkDistance->SetNumberOfTuples(1);
401 vtkOutputMatching->GetFieldData()->AddArray(vtkDistance);
404 output_matchings->SetBlock(i, vtkOutputMatching);
408 treesNodes.swap(treesNodesT);
409 treesArcs.swap(treesArcsT);
410 treesSegmentation.swap(treesSegmentationT);
411 treesNodeCorrMesh.swap(treesNodeCorrMeshT);
412 inputTrees.swap(inputTreesT);