| 185 | // templated to handle different data types. |
| 186 | template <class IT, class OT> |
| 187 | void vtkImageReaderUpdate2(vtkImageReader* self, vtkImageData* data, IT* inPtr, OT* outPtr) |
| 188 | { |
| 189 | vtkIdType inIncr[3], outIncr[3]; |
| 190 | OT *outPtr0, *outPtr1, *outPtr2; |
| 191 | long streamSkip0, streamSkip1; |
| 192 | unsigned long streamRead; |
| 193 | int idx0, idx1, idx2, pixelRead; |
| 194 | int inExtent[6]; |
| 195 | int dataExtent[6]; |
| 196 | int comp, pixelSkip; |
| 197 | long filePos, correction = 0; |
| 198 | unsigned long count = 0; |
| 199 | vtkTypeUInt64 DataMask; |
| 200 | unsigned long target; |
| 201 | |
| 202 | // Get the requested extents. |
| 203 | data->GetExtent(inExtent); |
| 204 | |
| 205 | // Convert them into to the extent needed from the file. |
| 206 | self->ComputeInverseTransformedExtent(inExtent, dataExtent); |
| 207 | |
| 208 | // get and transform the increments |
| 209 | data->GetIncrements(inIncr); |
| 210 | self->ComputeInverseTransformedIncrements(inIncr, outIncr); |
| 211 | |
| 212 | DataMask = self->GetDataMask(); |
| 213 | |
| 214 | // compute outPtr2 |
| 215 | outPtr2 = outPtr; |
| 216 | if (outIncr[0] < 0) |
| 217 | { |
| 218 | outPtr2 = outPtr2 - outIncr[0] * (dataExtent[1] - dataExtent[0]); |
| 219 | } |
| 220 | if (outIncr[1] < 0) |
| 221 | { |
| 222 | outPtr2 = outPtr2 - outIncr[1] * (dataExtent[3] - dataExtent[2]); |
| 223 | } |
| 224 | if (outIncr[2] < 0) |
| 225 | { |
| 226 | outPtr2 = outPtr2 - outIncr[2] * (dataExtent[5] - dataExtent[4]); |
| 227 | } |
| 228 | |
| 229 | // length of a row, num pixels read at a time |
| 230 | pixelRead = dataExtent[1] - dataExtent[0] + 1; |
| 231 | streamRead = static_cast<unsigned long>(pixelRead * self->GetDataIncrements()[0]); |
| 232 | streamSkip0 = (long)(self->GetDataIncrements()[1] - streamRead); |
| 233 | streamSkip1 = (long)(self->GetDataIncrements()[2] - |
| 234 | (dataExtent[3] - dataExtent[2] + 1) * self->GetDataIncrements()[1]); |
| 235 | pixelSkip = data->GetNumberOfScalarComponents(); |
| 236 | |
| 237 | // read from the bottom up |
| 238 | if (!self->GetFileLowerLeft()) |
| 239 | { |
| 240 | streamSkip0 = (long)(-static_cast<long>(streamRead) - self->GetDataIncrements()[1]); |
| 241 | streamSkip1 = (long)(self->GetDataIncrements()[2] + |
| 242 | (dataExtent[3] - dataExtent[2] + 1) * self->GetDataIncrements()[1]); |
| 243 | } |
| 244 |
no test coverage detected