Changeset 41843 for branches/eam_branches/ipp-dev-20210817
- Timestamp:
- Oct 16, 2021, 3:54:37 PM (5 years ago)
- Location:
- branches/eam_branches/ipp-dev-20210817/psModules/src
- Files:
-
- 4 edited
-
camera/pmFPAfileIO.c (modified) (2 diffs)
-
camera/pmFPAfileIO.h (modified) (1 diff)
-
imcombine/pmStack.c (modified) (4 diffs)
-
imcombine/pmStack.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/ipp-dev-20210817/psModules/src/camera/pmFPAfileIO.c
r41535 r41843 145 145 } 146 146 147 // list all defined pmFPAfiles 148 bool pmFPAfileIOList (pmConfig *config) 149 { 150 PS_ASSERT_PTR_NON_NULL(config, false); 151 PS_ASSERT_PTR_NON_NULL(config->files, false); 152 153 psMetadata *files = config->files; 154 155 // attempt to perform all create, read, write, close operations 156 psMetadataItem *item = NULL; 157 psMetadataIterator *iter = psMetadataIteratorAlloc (files, PS_LIST_HEAD, NULL); 158 while ((item = psMetadataGetAndIncrement (iter)) != NULL) { 159 pmFPAfile *file = item->data.V; 160 161 fprintf (stderr, "%s : %d %d %d : %d %d %d %d\n", file->name, file->type, file->mode, file->state, 162 file->fileLevel, file->dataLevel, file->freeLevel, file->mosaicLevel); 163 } 164 psFree (iter); 165 return true; 166 } 167 147 168 // read the file, if necessary and possible 148 169 bool pmFPAfileRead(pmFPAfile *file, const pmFPAview *view, pmConfig *config) … … 359 380 360 381 if (file->state & PM_FPA_STATE_INACTIVE) { 361 psTrace("psModules.camera", 6, "skip write for %s, file sis inactive", file->name);382 psTrace("psModules.camera", 6, "skip write for %s, file is inactive", file->name); 362 383 return true; 363 384 } -
branches/eam_branches/ipp-dev-20210817/psModules/src/camera/pmFPAfileIO.h
r23576 r41843 55 55 bool pmFPAfileReadPHU (pmFPAfile *file, const pmFPAview *view, pmConfig *config); 56 56 57 bool pmFPAfileIOList (pmConfig *config); 58 57 59 /// @} 58 60 # endif -
branches/eam_branches/ipp-dev-20210817/psModules/src/imcombine/pmStack.c
r36710 r41843 961 961 962 962 // KMM values; 963 float Punimodal = 1.0, KMMmean = NAN,KMMsigma = NAN,KMMpi = NAN;963 float Punimodal = 1.0, KMMmean = NAN, KMMsigma = NAN, KMMpi = NAN; 964 964 int KMM_MINIMUM_INPUTS = 6; 965 965 bool useKMM = false; … … 1510 1510 } 1511 1511 1512 # define MIN_GOOD_PERCENTILE 2 1513 bool pmStackCombineByPercentile( 1514 pmReadout *combined, 1515 psArray *stackData, 1516 psF64 minRange, 1517 psF64 maxRange, 1518 psImageMaskType badMaskBits, // treat these bits as 'bad' 1519 psImageMaskType suspectMaskBits, // treat these bits as 'suspect' 1520 psImageMaskType blankMaskBits // use this mask value for pixels missing input data (distinguish between Ninput = 0 and Ngood = 0?) 1521 ) { 1522 int minInputCols, maxInputCols, minInputRows, maxInputRows; // Smallest and largest values to combine 1523 int xSize, ySize; // Size of the output image 1524 1525 // we need to copy the readouts to their own array for validation 1526 psArray *stackReadouts = psArrayAlloc(stackData->n); 1527 for (int i = 0; i < stackData->n; i++) { 1528 pmStackData *data = stackData->data[i]; // Stack data for this input 1529 pmReadout *ro = data->readout; // Readout of interest 1530 stackReadouts->data[i] = psMemIncrRefCounter(ro); 1531 } 1532 1533 if (!pmReadoutStackValidate(&minInputCols, &maxInputCols, &minInputRows, &maxInputRows, &xSize, &ySize, stackReadouts)) { 1534 psError(psErrorCodeLast(), false, "Input stack is not valid."); 1535 psFree(stackReadouts); 1536 return false; 1537 } 1538 psFree(stackReadouts); 1539 1540 psVector *pixelData = psVectorAlloc(stackData->n, PS_TYPE_F32); 1541 psVector *pixelMask = psVectorAlloc(stackData->n, PS_TYPE_VECTOR_MASK); 1542 1543 for (int y = minInputRows; y < maxInputRows; y++) { 1544 for (int x = minInputCols; x < maxInputCols; x++) { 1545 1546 int nGood = 0; 1547 for (int i = 0; i < stackData->n; i++) { 1548 1549 pmStackData *data = stackData->data[i]; // Stack data for this input 1550 pmReadout *ro = data->readout; // Readout of interest 1551 psImage *image = ro->image; 1552 1553 int xIn = x - data->readout->col0; 1554 int yIn = y - data->readout->row0; // Coordinates on input readout 1555 1556 if (!isfinite(image->data.F32[yIn][xIn])) continue; 1557 if (fabs(image->data.F32[yIn][xIn]) > 1e5) continue; 1558 // XXX need to test the input mask as well here 1559 1560 pixelData->data.F32[nGood] = image->data.F32[yIn][xIn]; 1561 nGood ++; 1562 } 1563 pixelData->n = nGood; 1564 psVectorSortInPlace (pixelData); 1565 1566 if (nGood < MIN_GOOD_PERCENTILE) { 1567 combined->image->data.F32[y][x] = NAN; 1568 combined->variance->data.F32[y][x] = NAN; 1569 combined->mask->data.PS_TYPE_IMAGE_MASK_DATA[y][x] = 1; 1570 continue; 1571 } 1572 1573 int Ns = MIN(MAX(0, minRange * nGood),nGood); // e.g., 0.1 * 50 = 5 1574 int Ne = MIN(MAX(0, maxRange * nGood),nGood); // e.g., 0.9 * 50 = 45 1575 int Npt = Ne - Ns; 1576 1577 float sum = 0.0; 1578 for (int n = Ns; n < Ne; n++) { 1579 sum += pixelData->data.F32[n]; 1580 } 1581 float mean = sum / (float) Npt; 1582 1583 float varSum = 0.0; 1584 for (int n = Ns; n < Ne; n++) { 1585 varSum += SQ(pixelData->data.F32[n] - mean); 1586 } 1587 // variance on the mean (stdev / sqrt(N))^2 1588 float varValue = varSum / (Npt - 1) / Npt; 1589 1590 combined->image->data.F32[y][x] = mean; 1591 combined->variance->data.F32[y][x] = varValue; 1592 combined->mask->data.PS_TYPE_IMAGE_MASK_DATA[y][x] = 0; 1593 } 1594 } 1595 1596 psFree(pixelData); 1597 psFree(pixelMask); 1598 1599 return (true); 1600 } 1601 1512 1602 /// Stack input images 1513 1603 bool pmStackCombine( … … 1644 1734 expweight = expmaps->variance; 1645 1735 } 1646 1647 /* // Pre-reject inputs using KMM bimodality test. */1648 /* if (1) { */1649 /* /\* KMMRejectUnpopular(input,x,y); *\/ */1650 /* rejection = true; */1651 /* } */1652 1736 1653 1737 // Set up rejection list … … 1660 1744 for (int y = minInputRows; y < maxInputRows; y++) { 1661 1745 for (int x = minInputCols; x < maxInputCols; x++) { 1746 // this is only for TESTING: 1662 1747 CHECKPIX(x, y, "Combining pixel %d,%d: %x %x %f %f %f %f %d %d %d\n", x, y, badMaskBits, blankMaskBits, iter, rej, sys, olympic, useVariance, safe, rejection); 1663 1664 /* // Pre-reject inputs using KMM bimodality test. */1665 /* if (1) { */1666 /* KMMRejectUnpopular(input,x,y); */1667 /* /\* rejection = true; *\/ */1668 /* } */1669 /* else { */1670 /* KMMRejectBright(input,x,y); */1671 /* } */1672 1673 #ifdef TESTING1674 if (PS_SQR(x - TEST_X) + PS_SQR(y - TEST_Y) <= PS_SQR(TEST_RADIUS)) {1675 fprintf (stderr, "combine\n");1676 }1677 # endif1678 1748 1679 1749 psVector *reject = NULL; // Images to reject for this pixel -
branches/eam_branches/ipp-dev-20210817/psModules/src/imcombine/pmStack.h
r36710 r41843 47 47 ); 48 48 49 bool pmStackCombineByPercentile( 50 pmReadout *combined, 51 psArray *input, 52 psF64 minRange, 53 psF64 maxRange, 54 psImageMaskType badMaskBits, // treat these bits as 'bad' 55 psImageMaskType suspectMaskBits, // treat these bits as 'suspect' 56 psImageMaskType blankMaskBits // use this mask value for pixels missing input data (distinguish between Ninput = 0 and Ngood = 0?) 57 ); 58 49 59 /// Stack input images 50 60 bool pmStackCombine(pmReadout *combined,///< Combined readout (output)
Note:
See TracChangeset
for help on using the changeset viewer.
