IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 34625


Ignore:
Timestamp:
Oct 29, 2012, 6:24:33 PM (14 years ago)
Author:
watersc1
Message:

Fixed mask binning in pmReadoutRebin to be more sensible.

Location:
branches/czw_branch/20120906
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/czw_branch/20120906/ppSkycell/src/ppSkycellLoop.c

    r34624 r34625  
    249249            psFree(view);
    250250
    251             //      data->maskVal = 1;
     251            //      data->maskVal = 0xffff;
    252252            pmReadout *bin1RO = pmReadoutAlloc(NULL), *bin2RO = pmReadoutAlloc(NULL); // Binned readouts
    253253            if (!pmReadoutRebin(bin1RO, inRO, data->maskVal, data->bin1, data->bin1)) {
  • branches/czw_branch/20120906/psModules/src/camera/pmFPABin.c

    r24906 r34625  
    4343    }
    4444
     45    int Nbits = (int) (ceil(log(maskVal)/log(2)) + 1);
     46    int *bitcounter = malloc(sizeof(int) * Nbits);
     47    int pxlcount;
     48    fprintf(stderr,">> %d %d %x\n",Nbits,maskVal,maskVal);
     49
    4550    int xLast = numColsIn - 1, yLast = numRowsIn - 1; // Last index
    4651    int yStart = psImageBinningGetFineY(binning, 0); // Starting input y for binning
     
    5560            float sum = 0.0;            // Sum of pixels
    5661            int numPix = 0;             // Number of pixels
     62
     63            for (int j = 0; j < Nbits; j++) { // Reset bit counter
     64              bitcounter[j] = 0;
     65            }
     66            pxlcount = 0;
     67           
    5768            for (int y = yStart; y < yStop; y++) {
    5869                for (int x = xStart; x < xStop; x++) {
     70                  if (inMask && (inMask->data.PS_TYPE_IMAGE_MASK_DATA[y][x] != 0)) {
     71                      for (int j = 0; j < Nbits; j++) {
     72                        psImageMaskType M = (psImageMaskType) pow(2,j);
     73/*                      fprintf(stderr,"%x %d %x %x\n",inMask->data.PS_TYPE_IMAGE_MASK_DATA[y][x], */
     74/*                              j,M,(inMask->data.PS_TYPE_IMAGE_MASK_DATA[y][x] & M)); */
     75                               
     76                        if (inMask->data.PS_TYPE_IMAGE_MASK_DATA[y][x] & M) {
     77                          bitcounter[j]++;
     78                        }
     79                      }
     80                    }
     81                 
    5982                    if (inMask && (inMask->data.PS_TYPE_IMAGE_MASK_DATA[y][x] & maskVal)) {
    6083                        continue;
     
    6588                    sum += inImage->data.F32[y][x];
    6689                    numPix++;
     90
     91
     92/*                  if ((yStart < 4561)&&(yStop > 4561)&& */
     93/*                      (xStart < 3491)&&(xStop > 3491)) { */
     94/*                    //                      fprintf(stderr,"%d %d %g %x %x \n",x,y,inImage->data.F32[y][x],inMask->data.PS_TYPE_IMAGE_MASK_DATA[y][x],maskVal); */
     95/*                    for (int j = 0; j < Nbits; j++) { */
     96/*                      fprintf(stderr,"%d %x %d\t",j,(int) pow(2,j), bitcounter[j]); */
     97/*                    } */
     98/*                    fprintf(stderr,"\n"); */
     99/*                  } */
    67100                }
    68101            }
    69 
     102/*          fprintf(stderr,"%d %d\t",xOut,yOut); */
     103/*          for (int j = 0; j < Nbits; j++) { */
     104/*            fprintf(stderr,"%d %x %d\t",j,(int) pow(2,j), bitcounter[j]); */
     105/*          } */
     106/*          fprintf(stderr,"\n"); */
     107           
     108           
    70109            // Values to set
    71110            float imageValue;
     
    79118            }
    80119            outImage->data.F32[yOut][xOut] = imageValue;
    81             outMask->data.PS_TYPE_IMAGE_MASK_DATA[yOut][xOut] = maskValue;
     120            //            outMask->data.PS_TYPE_IMAGE_MASK_DATA[yOut][xOut] = maskValue;
     121            outMask->data.PS_TYPE_IMAGE_MASK_DATA[yOut][xOut] = 0;
     122            for (int j = 0; j < Nbits; j++) {
     123              if (bitcounter[j] > 0.5 * pxlcount) {
     124                outMask->data.PS_TYPE_IMAGE_MASK_DATA[yOut][xOut] |= (int) pow(2,j);
     125              }
     126            }
    82127            xStart = xStop;
    83128        }
Note: See TracChangeset for help on using the changeset viewer.