IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Mar 26, 2007, 5:36:18 PM (19 years ago)
Author:
eugene
Message:

using common psImageBinning tools

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/dvoTools/src/dvoMakeCorrUnbin.c

    r11805 r12592  
    2626    assert (trimsec);
    2727
    28     // dimensions of input image:
    29     int nx = inData->image->numCols;
    30     int ny = inData->image->numRows;
     28    // I have the fine and ruff image sizes, determine the binning factor
     29    psImageBinning *binning = psImageBinningAlloc();
     30    binning->nXruff = inData->numCols;
     31    binning->nYruff = inData->numRows;
     32    binning->nXfine = trimsec->x1 - trimsec->x0;
     33    binning->nYfine = trimsec->y1 - trimsec->y0;
     34    psImageBinningSetBinning (binning, PS_IMAGE_BINNING_CENTER);
     35    psImageBinningSetSkip(binning, inData);
    3136
    32     // dimensions of output image:
    33     int Nx = trimsec->x1 - trimsec->x0;
    34     int Ny = trimsec->y1 - trimsec->y0;
    35 
    36     // choose the binning factor which would yield nx,ny pixels from Nx,Ny
    37     int DX = Nx / nx;                   // 36 / 3 = 12, 35 / 3 = 11, 34 / 3 = 11
    38     if (Nx % nx) DX ++;                 // 36, 35, 34 -> DX = 12
    39     int xOffset = (Nx % nx) / 2;        // for nx = 3, xOffset = 0 or 1
    40    
    41     int DY = Ny / ny;
    42     if (Ny % ny) DY ++;
    43     int yOffset = (Ny % ny) / 2;
    44 
     37    // construct the supporing pmFPA/pmChip/pmCell structures
    4538    pmReadout *outData = pmFPAviewThisReadout (view, outFile->fpa);
    4639    if (outData == NULL) {
     
    4841        pmChip *outChip = pmFPAviewThisChip (view, outFile->fpa);
    4942
    50         pmChipCopyStructure (outChip, inChip, DX, DY);
     43        pmChipCopyStructure (outChip, inChip, binning->nXbin, binning->nYbin);
    5144        outData = pmFPAviewThisReadout (view, outFile->fpa);
    5245        assert (outData != NULL);
    5346    }
    5447
    55     psImageRecycle (outData->image, Nx, Ny, PS_TYPE_F32);
     48    // generate the output (fine-scale) image array
     49    psImageRecycle (outData->image, binning->nXfine, binning->nYfine, PS_TYPE_F32);
    5650
    57     // linear interpolation to full-scale
    58     if (!psImageUnbin (outData->image, inData->image, DX, DY, xOffset, yOffset)) {
     51    // linear interpolation to full fine scale
     52    if (!psImageUnbin (outData->image, inData->image, binning)) {
    5953        psError (PS_ERR_UNKNOWN, true, "failed to unbin image");
     54        psFree (binning);
    6055        return false;
    6156    }
     
    7469    // exit (0);
    7570
     71    psFree (binning);
    7672    return true;
    7773}
Note: See TracChangeset for help on using the changeset viewer.