| 61 | } |
| 62 | |
| 63 | void vtkImageInPlaceFilter::CopyData(vtkImageData* inData, vtkImageData* outData, int* outExt) |
| 64 | { |
| 65 | char* inPtr = static_cast<char*>(inData->GetScalarPointerForExtent(outExt)); |
| 66 | char* outPtr = static_cast<char*>(outData->GetScalarPointerForExtent(outExt)); |
| 67 | int rowLength, size; |
| 68 | vtkIdType inIncX, inIncY, inIncZ; |
| 69 | vtkIdType outIncX, outIncY, outIncZ; |
| 70 | int idxY, idxZ, maxY, maxZ; |
| 71 | |
| 72 | rowLength = (outExt[1] - outExt[0] + 1) * inData->GetNumberOfScalarComponents(); |
| 73 | size = inData->GetScalarSize(); |
| 74 | rowLength *= size; |
| 75 | maxY = outExt[3] - outExt[2]; |
| 76 | maxZ = outExt[5] - outExt[4]; |
| 77 | |
| 78 | // Get increments to march through data |
| 79 | inData->GetContinuousIncrements(outExt, inIncX, inIncY, inIncZ); |
| 80 | outData->GetContinuousIncrements(outExt, outIncX, outIncY, outIncZ); |
| 81 | |
| 82 | // adjust increments for this loop |
| 83 | inIncY = inIncY * size + rowLength; |
| 84 | outIncY = outIncY * size + rowLength; |
| 85 | inIncZ *= size; |
| 86 | outIncZ *= size; |
| 87 | |
| 88 | // Loop through output pixels |
| 89 | for (idxZ = 0; idxZ <= maxZ; idxZ++) |
| 90 | { |
| 91 | for (idxY = 0; idxY <= maxY; idxY++) |
| 92 | { |
| 93 | memcpy(outPtr, inPtr, rowLength); |
| 94 | outPtr += outIncY; |
| 95 | inPtr += inIncY; |
| 96 | } |
| 97 | outPtr += outIncZ; |
| 98 | inPtr += inIncZ; |
| 99 | } |
| 100 | } |
| 101 | |
| 102 | //------------------------------------------------------------------------------ |
| 103 | void vtkImageInPlaceFilter::PrintSelf(ostream& os, vtkIndent indent) |
no test coverage detected