------------------------------------------------------------------------------
| 55 | |
| 56 | //------------------------------------------------------------------------------ |
| 57 | vtkTypeBool vtkImageDataStreamer::ProcessRequest( |
| 58 | vtkInformation* request, vtkInformationVector** inputVector, vtkInformationVector* outputVector) |
| 59 | { |
| 60 | if (request->Has(vtkStreamingDemandDrivenPipeline::REQUEST_UPDATE_EXTENT())) |
| 61 | { |
| 62 | // we must set the extent on the input |
| 63 | vtkInformation* outInfo = outputVector->GetInformationObject(0); |
| 64 | |
| 65 | // get the requested update extent |
| 66 | int outExt[6]; |
| 67 | outInfo->Get(vtkStreamingDemandDrivenPipeline::UPDATE_EXTENT(), outExt); |
| 68 | |
| 69 | // setup the inputs update extent |
| 70 | int inExt[6] = { 0, -1, 0, -1, 0, -1 }; |
| 71 | vtkExtentTranslator* translator = this->GetExtentTranslator(); |
| 72 | |
| 73 | translator->SetWholeExtent(outExt); |
| 74 | translator->SetNumberOfPieces(this->NumberOfStreamDivisions); |
| 75 | translator->SetPiece(this->CurrentDivision); |
| 76 | if (translator->PieceToExtentByPoints()) |
| 77 | { |
| 78 | translator->GetExtent(inExt); |
| 79 | } |
| 80 | |
| 81 | inputVector[0]->GetInformationObject(0)->Set( |
| 82 | vtkStreamingDemandDrivenPipeline::UPDATE_EXTENT(), inExt, 6); |
| 83 | |
| 84 | return 1; |
| 85 | } |
| 86 | |
| 87 | // generate the data |
| 88 | else if (request->Has(vtkDemandDrivenPipeline::REQUEST_DATA())) |
| 89 | { |
| 90 | // get the output data object |
| 91 | vtkInformation* outInfo = outputVector->GetInformationObject(0); |
| 92 | vtkImageData* output = vtkImageData::SafeDownCast(outInfo->Get(vtkDataObject::DATA_OBJECT())); |
| 93 | |
| 94 | // is this the first request |
| 95 | if (!this->CurrentDivision) |
| 96 | { |
| 97 | // Tell the pipeline to start looping. |
| 98 | request->Set(vtkStreamingDemandDrivenPipeline::CONTINUE_EXECUTING(), 1); |
| 99 | this->AllocateOutputData(output, outInfo); |
| 100 | } |
| 101 | |
| 102 | // actually copy the data |
| 103 | vtkInformation* inInfo = inputVector[0]->GetInformationObject(0); |
| 104 | vtkImageData* input = vtkImageData::SafeDownCast(inInfo->Get(vtkDataObject::DATA_OBJECT())); |
| 105 | |
| 106 | int inExt[6]; |
| 107 | inInfo->Get(vtkStreamingDemandDrivenPipeline::UPDATE_EXTENT(), inExt); |
| 108 | |
| 109 | output->CopyAndCastFrom(input, inExt); |
| 110 | |
| 111 | // update the progress |
| 112 | this->UpdateProgress(static_cast<float>(this->CurrentDivision + 1.0) / |
| 113 | static_cast<float>(this->NumberOfStreamDivisions)); |
| 114 |
nothing calls this directly
no test coverage detected