Changeset 34800 for trunk/psModules/src/imcombine/pmStack.c
Legend:
- Unmodified
- Added
- Removed
-
trunk
-
trunk/psModules
- Property svn:mergeinfo changed
/branches/czw_branch/20120906/psModules (added) merged: 34442,34516,34623,34625-34626,34667,34772
- Property svn:mergeinfo changed
-
trunk/psModules/src/imcombine/pmStack.c
r34150 r34800 1358 1358 } 1359 1359 1360 bool pmStackSimpleMedianCombine( 1361 pmReadout *combined, 1362 psArray *input) { 1363 int num = input->n; 1364 // int numCols, numRows; 1365 int minInputCols, maxInputCols, minInputRows, maxInputRows; // Smallest and largest values to combine 1366 int xSize, ySize; // Size of the output image 1367 1368 psArray *stack = psArrayAlloc(num); // Stack of readouts 1369 for (int i = 0; i < num; i++) { 1370 // pmStackData *data = input->data[i]; // Stack data for this input 1371 pmReadout *ro = input->data[i]; // data->readout; // Readout of interest 1372 if (!ro) { 1373 continue; 1374 } 1375 stack->data[i] = psMemIncrRefCounter(ro); 1376 } 1377 1378 if (!pmReadoutStackValidate(&minInputCols, &maxInputCols, &minInputRows, &maxInputRows, &xSize, &ySize, 1379 stack)) { 1380 psError(psErrorCodeLast(), false, "Input stack is not valid."); 1381 psFree(stack); 1382 return false; 1383 } 1384 1385 psVector *pixelData = psVectorAlloc(input->n,PS_TYPE_F32); 1386 psStats *stats = psStatsAlloc(PS_STAT_ROBUST_MEDIAN); 1387 1388 for (int y = minInputRows; y < maxInputRows; y++) { 1389 for (int x = minInputCols; x < maxInputCols; x++) { 1390 for (int i = 0; i < input->n; i++) { 1391 pmReadout *ro = stack->data[i]; 1392 psImage *image = ro->image; 1393 pixelData->data.F32[i] = image->data.F32[y][x]; 1394 } 1395 if (!psVectorStats(stats,pixelData,NULL,NULL,0)) { 1396 psError(PS_ERR_UNKNOWN, false, "Unable to calculate median"); 1397 psFree(stats); 1398 psFree(pixelData); 1399 psFree(stack); 1400 return(false); 1401 } 1402 combined->image->data.F32[y][x] = stats->robustMedian; 1403 combined->mask->data.PS_TYPE_IMAGE_MASK_DATA[y][x] = 0; 1404 } 1405 } 1406 1407 psFree(stats); 1408 psFree(pixelData); 1409 psFree(stack); 1410 return (true); 1411 } 1412 1360 1413 /// Stack input images 1361 1414 bool pmStackCombine(
Note:
See TracChangeset
for help on using the changeset viewer.
