Changeset 2277 for trunk/psModules/src/pmReadoutCombine.c
- Timestamp:
- Nov 4, 2004, 9:22:07 AM (22 years ago)
- File:
-
- 1 edited
-
trunk/psModules/src/pmReadoutCombine.c (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psModules/src/pmReadoutCombine.c
r2276 r2277 1 /** @file pmReadoutCombine.c1 p/** @file pmReadoutCombine.c 2 2 * 3 3 * This file will contain a module which will combine multiple readout images. … … 5 5 * @author GLG, MHPCC 6 6 * 7 * @version $Revision: 1. 3$ $Name: not supported by cvs2svn $8 * @date $Date: 2004-11-04 19: 18:50$7 * @version $Revision: 1.4 $ $Name: not supported by cvs2svn $ 8 * @date $Date: 2004-11-04 19:22:07 $ 9 9 * 10 10 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 55 55 PS_PTR_CHECK_NULL(inputs, NULL); 56 56 PS_PTR_CHECK_NULL(params, NULL); 57 //unsigned int maskVal = params->maskVal;57 unsigned int maskVal = params->maskVal; 58 58 psStats *stats = params->stats; 59 59 int i; … … 146 146 for (j = 0; j < output->numCols ; j++) { 147 147 148 // XXX: put code in here to figure out for each readout if it has 149 a pixel that corresponds to this output pixel. 150 148 151 for (int r = 0; r < numInputs ; r++) { 149 // if (i,j are valid for this readout) { 150 if (0) { 151 // tmpPixels->data.F32[r] = WHATEVER; 152 tmpPixelMask->data.U8[r] = 0; 153 } else { 154 tmpPixels->data.F32[r] = 0.0; 155 tmpPixelMask->data.U8[r] = 1; 156 } 157 } 158 159 // Determine how many pixels lie between fracLow and fracHigh. 160 int pixelCount = 0; 161 for (int r = 0; r < numInputs ; r++) { 162 if (tmpPixelMask->data.U8[r] == 0) { 163 if ((params->fracLow <= tmpPixels->data.F32[r]) && 164 (params->fracHigh >= tmpPixels->data.F32[r])) { 165 pixelCount++; 152 if (i,j are valid for this readout) { 153 if (0) { 154 tmpPixels->data.F32[r] = WHATEVER; 155 tmpPixelMask->data.U8[r] = 0; 156 } else { 157 tmpPixels->data.F32[r] = 0.0; 158 tmpPixelMask->data.U8[r] = 1; 159 } 166 160 } 167 } 168 } 169 170 // If more than params->nKeep pixels lie between the valid range, 171 // then loop through the pixels, and mask away any pixels outside 172 // that range. 173 if (pixelCount >= params->nKeep) { 161 162 // Determine how many pixels lie between fracLow and fracHigh. 163 int pixelCount = 0; 174 164 for (int r = 0; r < numInputs ; r++) { 175 165 if (tmpPixelMask->data.U8[r] == 0) { 176 166 if ((params->fracLow <= tmpPixels->data.F32[r]) && 177 167 (params->fracHigh >= tmpPixels->data.F32[r])) { 178 tmpPixelMaskNKeep->data.U8[r] = 0; 179 } else { 180 tmpPixelMaskNKeep->data.U8[r] = 1; 168 pixelCount++; 181 169 } 182 170 } 183 171 } 172 173 // If more than params->nKeep pixels lie between the valid range, 174 // then loop through the pixels, and mask away any pixels outside 175 // that range. 176 if (pixelCount >= params->nKeep) { 177 for (int r = 0; r < numInputs ; r++) { 178 if (tmpPixelMask->data.U8[r] == 0) { 179 if ((params->fracLow <= tmpPixels->data.F32[r]) && 180 (params->fracHigh >= tmpPixels->data.F32[r])) { 181 tmpPixelMaskNKeep->data.U8[r] = 0; 182 } else { 183 tmpPixelMaskNKeep->data.U8[r] = 1; 184 } 185 } 186 } 187 } 188 189 // Calculate the specified statistic on the stack of pixels. 190 stats = psVectorStats(stats, 191 tmpPixels, 192 tmpPixelMaskNKeep, 193 1); 194 195 // Set the pixel value in the output image to the stat value. 196 double statValue; 197 if (!p_psGetStatValue(stats, &statValue)) { 198 psError(PS_ERR_UNKNOWN,true, "Could not determine stats value.\n"); 199 return(NULL); 200 } else { 201 output->data.F32[i][j] = (float) statValue; 202 } 184 203 } 185 186 // Calculate the specified statistic on the stack of pixels. 187 stats = psVectorStats(stats, 188 tmpPixels, 189 tmpPixelMaskNKeep, 190 1); 191 192 // Set the pixel value in the output image to the stat value. 193 double statValue; 194 if (!p_psGetStatValue(stats, &statValue)) { 195 psError(PS_ERR_UNKNOWN,true, "Could not determine stats value.\n"); 196 return(NULL); 197 } else { 198 output->data.F32[i][j] = (float) statValue; 199 } 200 } 201 } 202 203 psFree(tmpPixels); 204 psFree(tmpPixels); 205 psFree(tmpPixelMask); 206 psFree(tmpPixelMaskNKeep); 207 psFree(tmpReadouts); 208 209 return(output); 210 } 204 } 205 206 psFree(tmpPixels); 207 psFree(tmpPixels); 208 psFree(tmpPixelMask); 209 psFree(tmpPixelMaskNKeep); 210 psFree(tmpReadouts); 211 212 return(output); 213 }
Note:
See TracChangeset
for help on using the changeset viewer.
