49 vtkInformationVector **inputVector,
50 vtkInformationVector *outputVector) {
54 auto inputMBD = vtkMultiBlockDataSet::GetData(inputVector[0]);
55 auto outputMBD = vtkMultiBlockDataSet::GetData(outputVector);
58 size_t const nBlocks = inputMBD->GetNumberOfBlocks();
59 for(
size_t i = 0; i < nBlocks; i++) {
61 auto inputImage = vtkImageData::SafeDownCast(inputMBD->GetBlock(i));
63 if(inputImage ==
nullptr) {
68 auto depthArray = this->GetInputArrayToProcess(0, inputImage);
71 auto inputFD = inputImage->GetFieldData();
74 = vtkDoubleArray::SafeDownCast(inputFD->GetAbstractArray(
"CamHeight"));
76 = vtkDoubleArray::SafeDownCast(inputFD->GetAbstractArray(
"CamPosition"));
78 = vtkDoubleArray::SafeDownCast(inputFD->GetAbstractArray(
"CamDirection"));
80 = vtkDoubleArray::SafeDownCast(inputFD->GetAbstractArray(
"CamUp"));
82 = vtkDoubleArray::SafeDownCast(inputFD->GetAbstractArray(
"CamNearFar"));
84 = vtkDoubleArray::SafeDownCast(inputFD->GetAbstractArray(
"Resolution"));
87 if(depthArray ==
nullptr || camHeight ==
nullptr || camPosition ==
nullptr
88 || camDirection ==
nullptr || camUp ==
nullptr || camNearFar ==
nullptr
89 || resolution ==
nullptr) {
90 this->
printErr(
"Input depth image does not have all of the required "
91 "field data arrays (see Cinema Spec D - Data Product "
96 const size_t resX = resolution->GetValue(0);
97 const size_t resY = resolution->GetValue(1);
102 points->SetNumberOfPoints(resX * resY);
107 const size_t nTriangles = 2 * (resX - 1) * (resY - 1);
110 triangleDistortions->SetName(
"TriangleDistortion");
111 triangleDistortions->SetNumberOfComponents(1);
112 triangleDistortions->SetNumberOfTuples(nTriangles);
115 connectivityArray->SetNumberOfTuples(3 * nTriangles);
118 offsetArray->SetNumberOfTuples(nTriangles + 1);
122 switch(depthArray->GetDataType()) {
124 (status = this->execute<VTK_TT, int>(
147 cellArray->SetData(offsetArray, connectivityArray);
149 mesh->SetPoints(points);
150 mesh->SetCells(VTK_TRIANGLE, cellArray);
151 mesh->GetCellData()->AddArray(triangleDistortions);
156 auto meshPD = mesh->GetPointData();
157 auto inputPD = inputImage->GetPointData();
158 for(
int p = 0; p < inputPD->GetNumberOfArrays(); p++)
159 meshPD->AddArray(inputPD->GetAbstractArray(p));
161 outputMBD->SetBlock(i, mesh);
167 this->
printMsg(
"Complete (#images: " + std::to_string(nBlocks) +
")", 1,
printMsg(debug::output::BOLD+" | | | | | . \\ | | (__| | / __/| |_| / __/|__ _|"+debug::output::ENDCOLOR, debug::Priority::PERFORMANCE, debug::LineMode::NEW, stream)