| 103 | // for strictly center (no boundary ) processing. |
| 104 | template <class T> |
| 105 | void vtkImageVariance3DExecute(vtkImageVariance3D* self, vtkImageData* mask, vtkImageData* inData, |
| 106 | T* inPtr, vtkImageData* outData, int* outExt, float* outPtr, int id, vtkInformation* inInfo) |
| 107 | { |
| 108 | int *kernelMiddle, *kernelSize; |
| 109 | // For looping though output (and input) pixels. |
| 110 | int outMin0, outMax0, outMin1, outMax1, outMin2, outMax2; |
| 111 | int outIdx0, outIdx1, outIdx2; |
| 112 | vtkIdType inInc0, inInc1, inInc2; |
| 113 | vtkIdType outInc0, outInc1, outInc2; |
| 114 | T *inPtr0, *inPtr1, *inPtr2; |
| 115 | float *outPtr0, *outPtr1, *outPtr2; |
| 116 | int numComps, outIdxC; |
| 117 | // For looping through hood pixels |
| 118 | int hoodMin0, hoodMax0, hoodMin1, hoodMax1, hoodMin2, hoodMax2; |
| 119 | int hoodIdx0, hoodIdx1, hoodIdx2; |
| 120 | T *hoodPtr0, *hoodPtr1, *hoodPtr2; |
| 121 | // For looping through the mask. |
| 122 | unsigned char *maskPtr, *maskPtr0, *maskPtr1, *maskPtr2; |
| 123 | vtkIdType maskInc0, maskInc1, maskInc2; |
| 124 | // The extent of the whole input image |
| 125 | int inImageMin0, inImageMin1, inImageMin2; |
| 126 | int inImageMax0, inImageMax1, inImageMax2; |
| 127 | int inImageExt[6]; |
| 128 | // To compute the variance |
| 129 | float diff, sum; |
| 130 | int icount; |
| 131 | unsigned long count = 0; |
| 132 | unsigned long target; |
| 133 | |
| 134 | // Get information to march through data |
| 135 | inData->GetIncrements(inInc0, inInc1, inInc2); |
| 136 | inInfo->Get(vtkStreamingDemandDrivenPipeline::WHOLE_EXTENT(), inImageExt); |
| 137 | inImageMin0 = inImageExt[0]; |
| 138 | inImageMax0 = inImageExt[1]; |
| 139 | inImageMin1 = inImageExt[2]; |
| 140 | inImageMax1 = inImageExt[3]; |
| 141 | inImageMin2 = inImageExt[4]; |
| 142 | inImageMax2 = inImageExt[5]; |
| 143 | outData->GetIncrements(outInc0, outInc1, outInc2); |
| 144 | outMin0 = outExt[0]; |
| 145 | outMax0 = outExt[1]; |
| 146 | outMin1 = outExt[2]; |
| 147 | outMax1 = outExt[3]; |
| 148 | outMin2 = outExt[4]; |
| 149 | outMax2 = outExt[5]; |
| 150 | numComps = outData->GetNumberOfScalarComponents(); |
| 151 | |
| 152 | // Get ivars of this object (easier than making friends) |
| 153 | kernelSize = self->GetKernelSize(); |
| 154 | kernelMiddle = self->GetKernelMiddle(); |
| 155 | hoodMin0 = -kernelMiddle[0]; |
| 156 | hoodMin1 = -kernelMiddle[1]; |
| 157 | hoodMin2 = -kernelMiddle[2]; |
| 158 | hoodMax0 = hoodMin0 + kernelSize[0] - 1; |
| 159 | hoodMax1 = hoodMin1 + kernelSize[1] - 1; |
| 160 | hoodMax2 = hoodMin2 + kernelSize[2] - 1; |
| 161 | |
| 162 | // Setup mask info |
no test coverage detected