------------------------------------------------------------------------------
| 58 | |
| 59 | //------------------------------------------------------------------------------ |
| 60 | int vtkImageToStructuredPoints::RequestData( |
| 61 | vtkInformation*, vtkInformationVector** inputVector, vtkInformationVector* outputVector) |
| 62 | { |
| 63 | vtkInformation* inInfo = inputVector[0]->GetInformationObject(0); |
| 64 | vtkInformation* vectorInfo = inputVector[1]->GetInformationObject(0); |
| 65 | vtkInformation* outInfo = outputVector->GetInformationObject(0); |
| 66 | |
| 67 | int uExtent[6]; |
| 68 | int* wExtent; |
| 69 | |
| 70 | int idxX, idxY, idxZ; |
| 71 | int maxX = 0; |
| 72 | int maxY = 0; |
| 73 | int maxZ = 0; |
| 74 | vtkIdType inIncX, inIncY, inIncZ; |
| 75 | int rowLength; |
| 76 | unsigned char *inPtr1, *inPtr, *outPtr; |
| 77 | vtkStructuredPoints* output = |
| 78 | vtkStructuredPoints::SafeDownCast(outInfo->Get(vtkDataObject::DATA_OBJECT())); |
| 79 | vtkImageData* data = vtkImageData::SafeDownCast(inInfo->Get(vtkDataObject::DATA_OBJECT())); |
| 80 | vtkImageData* vData = nullptr; |
| 81 | if (vectorInfo) |
| 82 | { |
| 83 | vData = vtkImageData::SafeDownCast(vectorInfo->Get(vtkDataObject::DATA_OBJECT())); |
| 84 | } |
| 85 | |
| 86 | outInfo->Get(vtkStreamingDemandDrivenPipeline::UPDATE_EXTENT(), uExtent); |
| 87 | output->SetExtent(uExtent); |
| 88 | |
| 89 | uExtent[0] += this->Translate[0]; |
| 90 | uExtent[1] += this->Translate[0]; |
| 91 | uExtent[2] += this->Translate[1]; |
| 92 | uExtent[3] += this->Translate[1]; |
| 93 | uExtent[4] += this->Translate[2]; |
| 94 | uExtent[5] += this->Translate[2]; |
| 95 | |
| 96 | // if the data extent matches the update extent then just pass the data |
| 97 | // otherwise we must reformat and copy the data |
| 98 | if (data) |
| 99 | { |
| 100 | wExtent = data->GetExtent(); |
| 101 | if (wExtent[0] == uExtent[0] && wExtent[1] == uExtent[1] && wExtent[2] == uExtent[2] && |
| 102 | wExtent[3] == uExtent[3] && wExtent[4] == uExtent[4] && wExtent[5] == uExtent[5]) |
| 103 | { |
| 104 | if (data->GetPointData()) |
| 105 | { |
| 106 | output->GetPointData()->PassData(data->GetPointData()); |
| 107 | } |
| 108 | if (data->GetCellData()) |
| 109 | { |
| 110 | output->GetCellData()->PassData(data->GetCellData()); |
| 111 | } |
| 112 | if (data->GetFieldData()) |
| 113 | { |
| 114 | output->GetFieldData()->ShallowCopy(data->GetFieldData()); |
| 115 | } |
| 116 | } |
| 117 | else |
nothing calls this directly
no test coverage detected