IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 12654


Ignore:
Timestamp:
Mar 28, 2007, 1:45:31 PM (19 years ago)
Author:
Paul Price
Message:

Distinguishing between mosaicking (different cells within the same chip) and stacking (same cells within different chips) for concept averaging.

Location:
trunk/psModules/src
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/psModules/src/camera/pmFPAMosaic.c

    r12629 r12654  
    510510        int yTargetBase = (y0->data.S32[i] - yMin) / yBinTarget; // The base y position in the target frame
    511511
    512         // in the first case, we are just copy a section pixel-by-pixel
    513         if ((xBinSource->data.S32[i] == xBinTarget) && 
    514             (yBinSource->data.S32[i] == yBinTarget) &&
    515             (xFlip->data.U8[i] == 0) &&
    516             (yFlip->data.U8[i] == 0)) {
     512        // in the first case, we are just copy a section pixel-by-pixel
     513        if ((xBinSource->data.S32[i] == xBinTarget) &&
     514            (yBinSource->data.S32[i] == yBinTarget) &&
     515            (xFlip->data.U8[i] == 0) &&
     516            (yFlip->data.U8[i] == 0)) {
    517517            // Let someone else do the hard work
    518518            psImageOverlaySection(mosaic, image, xTargetBase, yTargetBase, "+");
    519             continue;
    520         } 
    521        
    522         // in the second case, there's a difference with the parities, but we don't have to
    523         // worry about binning
    524         if (xBinSource->data.S32[i] == xBinTarget && yBinSource->data.S32[i] == yBinTarget) {
     519            continue;
     520        }
     521
     522        // in the second case, there's a difference with the parities, but we don't have to
     523        // worry about binning
     524        if (xBinSource->data.S32[i] == xBinTarget && yBinSource->data.S32[i] == yBinTarget) {
    525525            switch (type) {
    526526                COPY_WITH_PARITY_DIFFERENCE(F32);
    527527                COPY_WITH_PARITY_DIFFERENCE(U8);
    528               default:
     528              default:
    529529                psAbort("Should never get here.\n");
    530530            }
    531             continue;
    532         } 
    533        
    534         // In the third case, the images are flipped and have different binnnig.
    535         // We have to do all of the hard work ourselves
    536         switch (type) {
    537             FILL_IN(F32);
    538             FILL_IN(U8);
    539           default:
    540             psAbort("Should never get here.\n");
    541         }
     531            continue;
     532        }
     533
     534        // In the third case, the images are flipped and have different binnnig.
     535        // We have to do all of the hard work ourselves
     536        switch (type) {
     537            FILL_IN(F32);
     538            FILL_IN(U8);
     539          default:
     540            psAbort("Should never get here.\n");
     541        }
    542542    } // Iterating over images
    543543
     
    10481048        }
    10491049        chipRegion = psRegionAlloc(0, 0, 0, 0); // We've cut and paste, so there's no valid trimsec
    1050         *chipRegion = psRegionForImage (mosaicImage, *chipRegion);
     1050        *chipRegion = psRegionForImage (mosaicImage, *chipRegion);
    10511051    }
    10521052    psTrace("psModules.camera", 1, "xBin,yBin: %d,%d\n", xBin, yBin);
     
    10541054    // Set the concepts for the target cell
    10551055    psList *sourceCells = psArrayToList(source->cells); // List of cells
    1056     pmConceptsAverageCells(targetCell, sourceCells, chipRegion, NULL);
     1056    pmConceptsAverageCells(targetCell, sourceCells, chipRegion, NULL, false);
    10571057    {
    10581058        psMetadataItem *item = psMetadataLookup(targetCell->concepts, "CELL.X0");
     
    11821182        }
    11831183    }
    1184     pmConceptsAverageCells(targetCell, sourceCells, fpaRegion, NULL);
     1184    pmConceptsAverageCells(targetCell, sourceCells, fpaRegion, NULL, false);
    11851185    {
    11861186        psMetadataItem *item = psMetadataLookup(targetCell->concepts, "CELL.X0");
  • trunk/psModules/src/concepts/pmConceptsAverage.c

    r12653 r12654  
    2222// Set a variety of concepts in a cell by averaging over several
    2323// XXX does not properly set XSIZE, YSIZE
    24 bool pmConceptsAverageCells(pmCell *target, psList *sources, psRegion *trimsec, psRegion *biassec)
     24bool pmConceptsAverageCells(pmCell *target, psList *sources, psRegion *trimsec, psRegion *biassec, bool same)
    2525{
    2626    PS_ASSERT_PTR_NON_NULL(target, false);
     
    6161            xBin    = psMetadataLookupS32(NULL, cell->concepts, "CELL.XBIN");
    6262            yBin    = psMetadataLookupS32(NULL, cell->concepts, "CELL.YBIN");
    63             x0      = psMetadataLookupS32(NULL, cell->concepts, "CELL.X0");
    64             y0      = psMetadataLookupS32(NULL, cell->concepts, "CELL.Y0");
     63
     64            if (same) {
     65                // Only makes sense to update these if they are the same cell
     66                x0  = psMetadataLookupS32(NULL, cell->concepts, "CELL.X0");
     67                y0  = psMetadataLookupS32(NULL, cell->concepts, "CELL.Y0");
     68            }
    6569        } else {
    6670            if (timeSys != psMetadataLookupS32(NULL, cell->concepts, "CELL.TIMESYS")) {
     
    8488                success = false;
    8589            }
    86             if (x0 != psMetadataLookupS32(NULL, cell->concepts, "CELL.X0")) {
    87                 psError(PS_ERR_BAD_PARAMETER_VALUE, true, "Differing CELL.X0 in use: %d vs %d\n",
    88                         x0, psMetadataLookupS32(NULL, cell->concepts, "CELL.X0"));
    89                 success = false;
    90             }
    91             if (y0 != psMetadataLookupS32(NULL, cell->concepts, "CELL.Y0")) {
    92                 psError(PS_ERR_BAD_PARAMETER_VALUE, true, "Differing CELL.Y0 in use: %d vs %d\n",
    93                         y0, psMetadataLookupS32(NULL, cell->concepts, "CELL.Y0"));
    94                 success = false;
     90            if (same) {
     91                if (x0 != psMetadataLookupS32(NULL, cell->concepts, "CELL.X0")) {
     92                    psError(PS_ERR_BAD_PARAMETER_VALUE, true, "Differing CELL.X0 in use: %d vs %d\n",
     93                            x0, psMetadataLookupS32(NULL, cell->concepts, "CELL.X0"));
     94                    success = false;
     95                }
     96                if (y0 != psMetadataLookupS32(NULL, cell->concepts, "CELL.Y0")) {
     97                    psError(PS_ERR_BAD_PARAMETER_VALUE, true, "Differing CELL.Y0 in use: %d vs %d\n",
     98                            y0, psMetadataLookupS32(NULL, cell->concepts, "CELL.Y0"));
     99                    success = false;
     100                }
    95101            }
    96102        }
     
    123129    MD_UPDATE(target->concepts, "CELL.XBIN", S32, xBin);
    124130    MD_UPDATE(target->concepts, "CELL.YBIN", S32, yBin);
    125     MD_UPDATE(target->concepts, "CELL.X0", S32, x0);
    126     MD_UPDATE(target->concepts, "CELL.Y0", S32, y0);
     131    if (same) {
     132        MD_UPDATE(target->concepts, "CELL.X0", S32, x0);
     133        MD_UPDATE(target->concepts, "CELL.Y0", S32, y0);
     134    }
    127135
    128136    // CELL.TIME needs special care
  • trunk/psModules/src/concepts/pmConceptsAverage.h

    r11253 r12654  
    44 * @author Paul Price, IfA
    55 *
    6  * @version $Revision: 1.5 $ $Name: not supported by cvs2svn $
    7  * @date $Date: 2007-01-24 02:54:14 $
     6 * @version $Revision: 1.6 $ $Name: not supported by cvs2svn $
     7 * @date $Date: 2007-03-28 23:45:31 $
    88 * Copyright 2005-2006 Institute for Astronomy, University of Hawaii
    99 */
     
    3131/// - CELL.READDIR
    3232/// - CELL.TIMESYS
     33/// - CELL.X0, CELL.Y0
    3334/// And for others, it takes the "worst" possible value:
    3435/// - CELL.SATURATION
    3536/// - CELL.BAD
     37/// These concepts are only handled if the cells are all the same cell (mosaicking vs stacking):
     38/// - CELL.X0, CELL.Y0
    3639bool pmConceptsAverageCells(pmCell *target,///< Target cell
    3740                            psList *sources, ///< List of source cells
    3841                            psRegion *trimsec, ///< The new trim section
    39                             psRegion *biassec ///< The new bias section
     42                            psRegion *biassec, ///< The new bias section
     43                            bool same   ///< Are the cells the same cell from different chips?
    4044                           );
    4145
  • trunk/psModules/src/imcombine/pmReadoutCombine.c

    r12651 r12654  
    398398        psListAdd(inputCells, PS_LIST_TAIL, readout->parent);
    399399    }
    400     bool success = pmConceptsAverageCells(output->parent, inputCells, NULL, NULL);
     400    bool success = pmConceptsAverageCells(output->parent, inputCells, NULL, NULL, true);
    401401    psFree(inputCells);
    402402
Note: See TracChangeset for help on using the changeset viewer.