IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Dec 11, 2012, 2:04:31 PM (13 years ago)
Author:
watersc1
Message:

Merge from my branch including background restoration and stack stage projection cell binned images.

Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk

  • trunk/psModules

  • trunk/psModules/src/imcombine/pmStack.c

    r34150 r34800  
    13581358}
    13591359
     1360bool 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
    13601413/// Stack input images
    13611414bool pmStackCombine(
Note: See TracChangeset for help on using the changeset viewer.