IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Sep 18, 2007, 10:23:23 AM (19 years ago)
Author:
Paul Price
Message:

Copying an FPA onto itself takes forever --- you never get to the
bottom of the metadata.

File:
1 edited

Legend:

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

    r13194 r14884  
    211211        if (mdok && trimsec && !psRegionIsNaN(*trimsec)) {
    212212            *trimsec = psImageBinningSetRuffRegion(binning, *trimsec);
    213             // force integer pixels : truncate x0, roundup x1:
    214             trimsec->x0 = (int)trimsec->x0;
    215             if (trimsec->x1 > (int)trimsec->x1) {
    216                 trimsec->x1 = (int)trimsec->x1 + 1;
    217             } else {
    218                 trimsec->x1 = (int)trimsec->x1;
    219             }           
    220             trimsec->y0 = (int)trimsec->y0;
    221             if (trimsec->y1 > (int)trimsec->y1) {
    222                 trimsec->y1 = (int)trimsec->y1 + 1;
    223             } else {
    224                 trimsec->y1 = (int)trimsec->y1;
    225             }           
     213            // force integer pixels : truncate x0, roundup x1:
     214            trimsec->x0 = (int)trimsec->x0;
     215            if (trimsec->x1 > (int)trimsec->x1) {
     216                trimsec->x1 = (int)trimsec->x1 + 1;
     217            } else {
     218                trimsec->x1 = (int)trimsec->x1;
     219            }
     220            trimsec->y0 = (int)trimsec->y0;
     221            if (trimsec->y1 > (int)trimsec->y1) {
     222                trimsec->y1 = (int)trimsec->y1 + 1;
     223            } else {
     224                trimsec->y1 = (int)trimsec->y1;
     225            }
    226226        }
    227227        psList *biassecs = psMetadataLookupPtr(&mdok, target->concepts, "CELL.BIASSEC"); // The bias sections
     
    232232                if (!psRegionIsNaN(*biassec)) {
    233233                    *biassec = psImageBinningSetRuffRegion(binning, *biassec);
    234                     // force integer pixels : truncate x0, roundup x1:
    235                     biassec->x0 = (int)biassec->x0;
    236                     if (biassec->x1 > (int)biassec->x1) {
    237                         biassec->x1 = (int)biassec->x1 + 1;
    238                     } else {
    239                         biassec->x1 = (int)biassec->x1;
    240                     }           
    241                     biassec->y0 = (int)biassec->y0;
    242                     if (biassec->y1 > (int)biassec->y1) {
    243                         biassec->y1 = (int)biassec->y1 + 1;
    244                     } else {
    245                         biassec->y1 = (int)biassec->y1;
    246                     }           
     234                    // force integer pixels : truncate x0, roundup x1:
     235                    biassec->x0 = (int)biassec->x0;
     236                    if (biassec->x1 > (int)biassec->x1) {
     237                        biassec->x1 = (int)biassec->x1 + 1;
     238                    } else {
     239                        biassec->x1 = (int)biassec->x1;
     240                    }
     241                    biassec->y0 = (int)biassec->y0;
     242                    if (biassec->y1 > (int)biassec->y1) {
     243                        biassec->y1 = (int)biassec->y1 + 1;
     244                    } else {
     245                        biassec->y1 = (int)biassec->y1;
     246                    }
    247247                }
    248248            }
     
    393393        pmCell *sourceCell = sourceCells->data[i]; // The sources cell
    394394        const char *cellName = psMetadataLookupStr(NULL, sourceCell->concepts, "CELL.NAME"); // Name of cell
    395         // XXX are there other concepts I need to copy first?
    396         pmCell *targetCell = pmCellAlloc (targetChip, cellName);
    397         int xParityTarget = psMetadataLookupS32(&status, sourceCell->concepts, "CELL.XPARITY"); // Target x parity
    398         psMetadataAddS32 (targetCell->concepts, PS_LIST_TAIL, "CELL.XPARITY", PS_META_REPLACE, "", xParityTarget);
    399         int yParityTarget = psMetadataLookupS32(&status, sourceCell->concepts, "CELL.YPARITY"); // Target y parity
    400         psMetadataAddS32 (targetCell->concepts, PS_LIST_TAIL, "CELL.YPARITY", PS_META_REPLACE, "", yParityTarget);
    401         if (!cellCopy(targetCell, sourceCell, true, 1, 1)) {
    402             psError(PS_ERR_BAD_PARAMETER_VALUE, false, "failed to duplicate chip\n");
    403             return NULL;
    404         }
    405         // update the attributes
    406         targetCell->file_exists = sourceCell->file_exists;
    407         targetCell->data_exists = sourceCell->data_exists;
    408         targetCell->process     = sourceCell->process;
     395        // XXX are there other concepts I need to copy first?
     396        pmCell *targetCell = pmCellAlloc (targetChip, cellName);
     397        int xParityTarget = psMetadataLookupS32(&status, sourceCell->concepts, "CELL.XPARITY"); // Target x parity
     398        psMetadataAddS32 (targetCell->concepts, PS_LIST_TAIL, "CELL.XPARITY", PS_META_REPLACE, "", xParityTarget);
     399        int yParityTarget = psMetadataLookupS32(&status, sourceCell->concepts, "CELL.YPARITY"); // Target y parity
     400        psMetadataAddS32 (targetCell->concepts, PS_LIST_TAIL, "CELL.YPARITY", PS_META_REPLACE, "", yParityTarget);
     401        if (!cellCopy(targetCell, sourceCell, true, 1, 1)) {
     402            psError(PS_ERR_BAD_PARAMETER_VALUE, false, "failed to duplicate chip\n");
     403            return NULL;
     404        }
     405        // update the attributes
     406        targetCell->file_exists = sourceCell->file_exists;
     407        targetCell->data_exists = sourceCell->data_exists;
     408        targetCell->process     = sourceCell->process;
    409409    }
    410410
     
    467467    PS_ASSERT_PTR_NON_NULL(target, false);
    468468    PS_ASSERT_PTR_NON_NULL(source, false);
     469    if (target == source) {
     470        psError(PS_ERR_BAD_PARAMETER_VALUE, true, "Can't copy FPA onto itself.");
     471        return false;
     472    }
    469473    return fpaCopy(target, source, true, 1, 1);
    470474}
     
    474478    PS_ASSERT_PTR_NON_NULL(target, false);
    475479    PS_ASSERT_PTR_NON_NULL(source, false);
     480    if (target == source) {
     481        psError(PS_ERR_BAD_PARAMETER_VALUE, true, "Can't copy chip onto itself.");
     482        return false;
     483    }
    476484    return chipCopy(target, source, true, 1, 1);
    477485}
     
    481489    PS_ASSERT_PTR_NON_NULL(target, false);
    482490    PS_ASSERT_PTR_NON_NULL(source, false);
     491    if (target == source) {
     492        psError(PS_ERR_BAD_PARAMETER_VALUE, true, "Can't copy cell onto itself.");
     493        return false;
     494    }
    483495    return cellCopy(target, source, true, 1, 1);
    484496}
     
    491503    PS_ASSERT_INT_POSITIVE(xBin, false);
    492504    PS_ASSERT_INT_POSITIVE(yBin, false);
     505    if (target == source) {
     506        psError(PS_ERR_BAD_PARAMETER_VALUE, true, "Can't copy FPA onto itself.");
     507        return false;
     508    }
    493509    return fpaCopy(target, source, false, xBin, yBin);
    494510}
     
    500516    PS_ASSERT_INT_POSITIVE(xBin, false);
    501517    PS_ASSERT_INT_POSITIVE(yBin, false);
     518    if (target == source) {
     519        psError(PS_ERR_BAD_PARAMETER_VALUE, true, "Can't copy chip onto itself.");
     520        return false;
     521    }
    502522    return chipCopy(target, source, false, xBin, yBin);
    503523}
     
    509529    PS_ASSERT_INT_POSITIVE(xBin, false);
    510530    PS_ASSERT_INT_POSITIVE(yBin, false);
     531    if (target == source) {
     532        psError(PS_ERR_BAD_PARAMETER_VALUE, true, "Can't copy cell onto itself.");
     533        return false;
     534    }
    511535    return cellCopy(target, source, false, xBin, yBin);
    512536}
Note: See TracChangeset for help on using the changeset viewer.