IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Oct 29, 2021, 8:29:50 AM (5 years ago)
Author:
eugene
Message:

working on adding exptime and expnum outputs

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/psModules.20211028/src/imcombine/pmStack.c

    r41872 r41873  
    15331533
    15341534bool pmStackCombineByPercentile(
    1535     pmReadout *combined,
    1536     psArray *stackData,
    1537     psF64 rejectFraction,
     1535    pmReadout *combined,                // output stacked readout
     1536    pmReadout *expmaps,                 // output exposure map information
     1537    psArray *stackData,                 // input exposures
     1538    psF64 rejectFraction,               // outlier fraction of pixels to reject
    15381539    psF64 maxRange,
    15391540    psImageMaskType badMaskBits,        // treat these bits as 'bad'
     
    15621563    pmReadoutUpdateSize(combined, minInputCols, minInputRows, xSize, ySize, true, true, blankMaskBits);
    15631564
     1565    psImage *exp = NULL, *expnum = NULL, *expweight = NULL; // Exposure map and exposure number
     1566    if (expmaps) {
     1567        if (!expmaps->image) { exp = expmaps->image = psImageAlloc(numCols, numRows, PS_TYPE_F32); }
     1568        if (!expmaps->mask) { expnum = expmaps->mask = psImageAlloc(numCols, numRows, PS_TYPE_IMAGE_MASK); }
     1569        if (!expmaps->variance) { expweight = expmaps->variance = psImageAlloc(numCols, numRows, PS_TYPE_F32); }
     1570    }
     1571   
    15641572    psVector *pixelData      = psVectorAlloc(stackData->n, PS_TYPE_F32);
    15651573    psVector *pixelVariances = psVectorAlloc(stackData->n, PS_TYPE_F32);
    15661574    psVector *pixelMask      = psVectorAlloc(stackData->n, PS_TYPE_VECTOR_MASK);
     1575
     1576    psVector *expTime        = expmask ? psVectorAlloc(stackData->n, PS_TYPE_F32) : NULL;
     1577    psVector *expNum         = expmask ? psVectorAlloc(stackData->n, PS_TYPE_VECTOR_MASK): NULL;
    15671578
    15681579    int nGoodBits[16]; // accumulate the good pixel bits here for fuzzy logic
     
    16071618
    16081619                pixelData->data.F32[nGood] = image->data.F32[yIn][xIn];
    1609                 if (variance) {
    1610                   // pixelVariances->data.F32[numGood] = variance->data.F32[yIn][xIn] * addVariance->data.F32[i];
    1611                   pixelVariances->data.F32[nGood] = variance->data.F32[yIn][xIn];
    1612                 }
     1620                if (variance) { pixelVariances->data.F32[nGood] = variance->data.F32[yIn][xIn]; }
     1621                if (expmask) { pixelVariances->data.F32[nGood] = variance->data.F32[yIn][xIn]; }
    16131622
    16141623                nGood ++;
    16151624            }
    16161625            pixelData->n = nGood;
    1617 
    16181626
    16191627            // rather than define a min and max value,
     
    16381646                combined->variance->data.F32[y][x] = NAN;
    16391647                combined->mask->data.PS_TYPE_IMAGE_MASK_DATA[y][x] = blankMaskBits; // probably not needed since it was set above.
     1648                if (expmaps) {
     1649                    expmaps->image->F32[y][x] = NAN;
     1650                    expmaps->variance->F32[y][x] = NAN;
     1651                    expmaps->mask->PS_TYPE_IMAGE_MASK_DATA[y][x] = 0;
     1652                }
    16401653                continue;
    16411654            }
Note: See TracChangeset for help on using the changeset viewer.