| 20 | //------------------------------------------------------------------------------ |
| 21 | |
| 22 | int vtkImageInPlaceFilter::RequestData(vtkInformation* vtkNotUsed(request), |
| 23 | vtkInformationVector** inputVector, vtkInformationVector* outputVector) |
| 24 | { |
| 25 | // get the data object |
| 26 | vtkInformation* outInfo = outputVector->GetInformationObject(0); |
| 27 | vtkImageData* output = vtkImageData::SafeDownCast(outInfo->Get(vtkDataObject::DATA_OBJECT())); |
| 28 | |
| 29 | vtkInformation* inInfo = inputVector[0]->GetInformationObject(0); |
| 30 | vtkImageData* input = vtkImageData::SafeDownCast(inInfo->Get(vtkDataObject::DATA_OBJECT())); |
| 31 | |
| 32 | int *inExt, *outExt; |
| 33 | inExt = inInfo->Get(vtkStreamingDemandDrivenPipeline::UPDATE_EXTENT()); |
| 34 | outExt = outInfo->Get(vtkStreamingDemandDrivenPipeline::UPDATE_EXTENT()); |
| 35 | |
| 36 | // if the total size of the data is the same then can be in place |
| 37 | vtkLargeInteger inSize; |
| 38 | vtkLargeInteger outSize; |
| 39 | inSize = (inExt[1] - inExt[0] + 1); |
| 40 | inSize = inSize * (inExt[3] - inExt[2] + 1); |
| 41 | inSize = inSize * (inExt[5] - inExt[4] + 1); |
| 42 | outSize = (outExt[1] - outExt[0] + 1); |
| 43 | outSize = outSize * (outExt[3] - outExt[2] + 1); |
| 44 | outSize = outSize * (outExt[5] - outExt[4] + 1); |
| 45 | if (inSize == outSize && |
| 46 | (vtkDataObject::GetGlobalReleaseDataFlag() || |
| 47 | inInfo->Get(vtkDemandDrivenPipeline::RELEASE_DATA()))) |
| 48 | { |
| 49 | // pass the data |
| 50 | output->GetPointData()->PassData(input->GetPointData()); |
| 51 | output->SetExtent(outExt); |
| 52 | } |
| 53 | else |
| 54 | { |
| 55 | output->SetExtent(outExt); |
| 56 | output->AllocateScalars(outInfo); |
| 57 | this->CopyData(input, output, outExt); |
| 58 | } |
| 59 | |
| 60 | return 1; |
| 61 | } |
| 62 | |
| 63 | void vtkImageInPlaceFilter::CopyData(vtkImageData* inData, vtkImageData* outData, int* outExt) |
| 64 | { |
nothing calls this directly
no test coverage detected