IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Feb 7, 2008, 6:06:05 PM (18 years ago)
Author:
Paul Price
Message:

Adding feature: overlap between consecutive reads. If you're doing something like convolution, this will be a handy feature.

File:
1 edited

Legend:

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

    r16365 r16366  
    108108                                  pmReadout *readout, // Readout of interest
    109109                                  int numScans, // Number of scans to read at a time
     110                                  int overlap, // Number of scans to overlap with previous read
    110111                                  fpaReadType type // Type of image
    111112    )
     
    173174            *next = trimsec->x0;
    174175        } else {
    175             *next = image ? readout->row0 + numScans : 0;
     176            *next = image ? readout->row0 + numScans - overlap : 0;
    176177        }
    177178        *last = trimsec->y1;
     
    181182            *next = trimsec->y0;
    182183        } else {
    183             *next = image ? readout->row0 + numScans : 0;
     184            *next = image ? readout->col0 + numScans - overlap : 0;
    184185        }
    185186        *last = trimsec->x1;
     
    210211                        int z,          // Plane number
    211212                        int numScans,   // Number of scans to read at a time
     213                        int overlap,    // Number of scans to overlap with last read
    212214                        fpaReadType type // Type of image
    213215    )
     
    237239    int next;                           // Next position
    238240    int last;                           // Last position
    239     if (!readoutScanProperties(&next, &last, readout, numScans, type)) {
     241    if (!readoutScanProperties(&next, &last, readout, numScans, overlap, type)) {
    240242        psError(PS_ERR_UNKNOWN, false, "Unable to determine readout properties.");
    241243        return false;
     
    393395                             int z,     // Desired image plane
    394396                             int numScans, // Number of scans (row or col depends on CELL.READDIR); 0 for all
     397                             int overlap, // Number of scans (row/col) to overlap between scans
    395398                             fpaReadType type // Type of image
    396399    )
     
    400403    assert(z >= 0);
    401404    assert(numScans >= 0);
    402 
    403     psImage **imagePtr = readoutImageByType(readout, type); // Pointer to the image of interest
    404     if (*imagePtr && numScans == 0) {
     405    assert(overlap >= 0);
     406
     407    psImage **image = readoutImageByType(readout, type); // Pointer to the image of interest
     408    if (*image && numScans == 0) {
    405409        psError(PS_ERR_UNKNOWN, true, "Already read entire image --- won't clobber.");
    406410        return false;
     
    422426    int next;                           // Next position
    423427    int last;                           // Last position
    424     if (!readoutScanProperties(&next, &last, readout, numScans, type)) {
     428    if (!readoutScanProperties(&next, &last, readout, numScans, overlap, type)) {
    425429        psError(PS_ERR_UNKNOWN, false, "Unable to determine readout properties.");
    426430        return false;
     
    441445    }
    442446    float bad = psMetadataLookupF32(&mdok, cell->concepts, "CELL.BAD"); // Bad level
    443     if (!mdok) {
    444         psLogMsg(__func__, PS_LOG_WARN, "CELL.BAD is not set --- assuming zero.\n");
    445         bad = 0.0;
    446     }
    447447    psRegion *trimsec = psMetadataLookupPtr(&mdok, cell->concepts, "CELL.TRIMSEC"); // Trim sections
    448448    if (!mdok || !trimsec || psRegionIsNaN(*trimsec)) {
     
    479479    }
    480480    int upper = next + numScans;        // Upper limit to next section
     481    if (!*image) {
     482        upper += overlap;
     483    }
    481484
    482485    // Blow away existing data.
    483486    // Do this before returning, so that we're not returning data from a previous read
    484     psImage **image = readoutImageByType(readout, type);
    485487    psFree(*image);
    486488    *image = NULL;
     
    880882
    881883
    882 bool pmReadoutMore(pmReadout *readout, psFits *fits, int z, int numScans)
     884bool pmReadoutMore(pmReadout *readout, psFits *fits, int z, int numScans, int overlap)
    883885{
    884886    PS_ASSERT_PTR_NON_NULL(readout, false);
    885887    PS_ASSERT_FITS_NON_NULL(fits, false);
    886888
    887     return readoutMore(readout, fits, z, numScans, FPA_READ_TYPE_IMAGE);
    888 }
    889 
    890 bool pmReadoutReadChunk(pmReadout *readout, psFits *fits, int z, int numScans)
     889    return readoutMore(readout, fits, z, numScans, overlap, FPA_READ_TYPE_IMAGE);
     890}
     891
     892bool pmReadoutReadChunk(pmReadout *readout, psFits *fits, int z, int numScans, int overlap)
    891893{
    892894    PS_ASSERT_PTR_NON_NULL(readout, false);
     
    895897    PS_ASSERT_INT_NONNEGATIVE(numScans, false);
    896898
    897     return readoutReadChunk(readout, fits, z, numScans, FPA_READ_TYPE_IMAGE);
     899    return readoutReadChunk(readout, fits, z, numScans, overlap, FPA_READ_TYPE_IMAGE);
    898900}
    899901
     
    903905    PS_ASSERT_FITS_NON_NULL(fits, false);
    904906
    905     return readoutReadChunk(readout, fits, z, 0, FPA_READ_TYPE_IMAGE);
     907    return readoutReadChunk(readout, fits, z, 0, 0, FPA_READ_TYPE_IMAGE);
    906908}
    907909
     
    943945//////////////////////////////////////////////////////////////////////////////////////////////////////////////
    944946
     947bool pmReadoutMoreMask(pmReadout *readout, psFits *fits, int z, int numScans, int overlap)
     948{
     949    PS_ASSERT_PTR_NON_NULL(readout, false);
     950    PS_ASSERT_FITS_NON_NULL(fits, false);
     951
     952    return readoutMore(readout, fits, z, numScans, overlap, FPA_READ_TYPE_MASK);
     953}
     954
     955bool pmReadoutReadChunkMask(pmReadout *readout, psFits *fits, int z, int numScans, int overlap)
     956{
     957    PS_ASSERT_PTR_NON_NULL(readout, false);
     958    PS_ASSERT_FITS_NON_NULL(fits, false);
     959    PS_ASSERT_INT_NONNEGATIVE(z, false);
     960    PS_ASSERT_INT_NONNEGATIVE(numScans, false);
     961
     962    return readoutReadChunk(readout, fits, z, numScans, overlap, FPA_READ_TYPE_MASK);
     963}
     964
    945965bool pmReadoutReadMask(pmReadout *readout, psFits *fits, int z)
    946966{
     
    948968    PS_ASSERT_FITS_NON_NULL(fits, false);
    949969
    950     return readoutReadChunk(readout, fits, z, 0, FPA_READ_TYPE_MASK);
     970    return readoutReadChunk(readout, fits, z, 0, 0, FPA_READ_TYPE_MASK);
    951971}
    952972
     
    979999//////////////////////////////////////////////////////////////////////////////////////////////////////////////
    9801000
     1001bool pmReadoutMoreWeight(pmReadout *readout, psFits *fits, int z, int numScans, int overlap)
     1002{
     1003    PS_ASSERT_PTR_NON_NULL(readout, false);
     1004    PS_ASSERT_FITS_NON_NULL(fits, false);
     1005
     1006    return readoutMore(readout, fits, z, numScans, overlap, FPA_READ_TYPE_WEIGHT);
     1007}
     1008
     1009bool pmReadoutReadChunkWeight(pmReadout *readout, psFits *fits, int z, int numScans, int overlap)
     1010{
     1011    PS_ASSERT_PTR_NON_NULL(readout, false);
     1012    PS_ASSERT_FITS_NON_NULL(fits, false);
     1013    PS_ASSERT_INT_NONNEGATIVE(z, false);
     1014    PS_ASSERT_INT_NONNEGATIVE(numScans, false);
     1015
     1016    return readoutReadChunk(readout, fits, z, numScans, overlap, FPA_READ_TYPE_WEIGHT);
     1017}
     1018
    9811019bool pmReadoutReadWeight(pmReadout *readout, psFits *fits, int z)
    9821020{
     
    9841022    PS_ASSERT_FITS_NON_NULL(fits, false);
    9851023
    986     return readoutReadChunk(readout, fits, z, 0, FPA_READ_TYPE_WEIGHT);
     1024    return readoutReadChunk(readout, fits, z, 0, 0, FPA_READ_TYPE_WEIGHT);
    9871025}
    9881026
Note: See TracChangeset for help on using the changeset viewer.