| 387 | //------------------------------------------------------------------------------ |
| 388 | template <class T> |
| 389 | void vtkImageMathematicsInitOutput( |
| 390 | vtkImageData* inData, T* inPtr, vtkImageData* vtkNotUsed(outData), T* outPtr, int ext[6]) |
| 391 | { |
| 392 | int idxY, idxZ; |
| 393 | int maxY, maxZ; |
| 394 | vtkIdType outIncY, outIncZ; |
| 395 | int rowLength; |
| 396 | int typeSize; |
| 397 | T *outPtrZ, *outPtrY; |
| 398 | T *inPtrZ, *inPtrY; |
| 399 | |
| 400 | // This method needs to copy scalars from input to output for the update-extent. |
| 401 | vtkDataArray* inArray = inData->GetPointData()->GetScalars(); |
| 402 | typeSize = vtkDataArray::GetDataTypeSize(inArray->GetDataType()); |
| 403 | outPtrZ = outPtr; |
| 404 | inPtrZ = inPtr; |
| 405 | // Get increments to march through data |
| 406 | vtkIdType increments[3]; |
| 407 | increments[0] = inArray->GetNumberOfComponents(); |
| 408 | increments[1] = increments[0] * (ext[1] - ext[0] + 1); |
| 409 | increments[2] = increments[1] * (ext[3] - ext[2] + 1); |
| 410 | outIncY = increments[1]; |
| 411 | outIncZ = increments[2]; |
| 412 | |
| 413 | // Find the region to loop over |
| 414 | rowLength = (ext[1] - ext[0] + 1) * inArray->GetNumberOfComponents(); |
| 415 | rowLength *= typeSize; |
| 416 | maxY = ext[3] - ext[2]; |
| 417 | maxZ = ext[5] - ext[4]; |
| 418 | |
| 419 | // Loop through input pixels |
| 420 | for (idxZ = 0; idxZ <= maxZ; idxZ++) |
| 421 | { |
| 422 | outPtrY = outPtrZ; |
| 423 | inPtrY = inPtrZ; |
| 424 | for (idxY = 0; idxY <= maxY; idxY++) |
| 425 | { |
| 426 | memcpy(outPtrY, inPtrY, rowLength); |
| 427 | outPtrY += outIncY; |
| 428 | inPtrY += outIncY; |
| 429 | } |
| 430 | outPtrZ += outIncZ; |
| 431 | inPtrZ += outIncZ; |
| 432 | } |
| 433 | } |
| 434 | } |
| 435 | |
| 436 | //------------------------------------------------------------------------------ |
no test coverage detected