IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 2276


Ignore:
Timestamp:
Nov 4, 2004, 9:18:50 AM (22 years ago)
Author:
gusciora
Message:

...

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/psModules/src/pmReadoutCombine.c

    r2275 r2276  
    55 *  @author GLG, MHPCC
    66 *
    7  *  @version $Revision: 1.2 $ $Name: not supported by cvs2svn $
    8  *  @date $Date: 2004-11-04 02:02:10 $
     7 *  @version $Revision: 1.3 $ $Name: not supported by cvs2svn $
     8 *  @date $Date: 2004-11-04 19:18:50 $
    99 *
    1010 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    6161    int numInputCols = -1;
    6262    int numInputRows = -1;
     63    int minInputCols = HUGE;
     64    int minInputRowss = HUGE;
    6365    psListElem *tmpInput = NULL;
    6466    int numInputs = 0;
     
    6870    // We step through each readout in the input image list.  If any readout is
    6971    // NULL, empty, or has the wrong type, we generate an error and return
    70     // NULL.  If any readout is not the same size as any other image, we
    71     // generate an error and return NULL.
     72    // NULL.  We determine how big of an output image is needed to combine
     73    // these input images.  We do this by taking the
     74    //     max(readout->col0 + readout->numCols + image->col0 + image->numCols)
     75    //     max(readout->row0 + readout->numRows + image->row0 + image->numRows)
     76    // We then compare that to
     77    //     output->col0 + output->numCols
     78    //     output->row0 + output->numRows
     79    // to determine if the output image actually stores that pixel.  A similar
     80    // thing is done for the minimul row and column.
     81    //
    7282    tmpInput = (psListElem *) inputs->head;
    73 
    7483    while (NULL != tmpInput) {
    7584        tmpReadout = (psReadout *) tmpInput->data;
     
    7887        PS_READOUT_CHECK_TYPE(tmpReadout, PS_TYPE_F32, output);
    7988
    80         if (numInputCols == -1) {
    81             // XXX        numInputCols = tmpReadout->image->numCols + OFFSET??;
    82             numInputCols = tmpReadout->image->numCols;
    83         }
    84         if (numInputRows == -1) {
    85             // XXX            numInputRows = tmpReadout->image->numRows + OFFSET;
    86             numInputRows = tmpReadout->image->numRows;
    87         }
    88 
    89         // XXX
    90         if (numInputCols != tmpReadout->image->numCols) {
    91             psError(PS_ERR_UNKNOWN,true, "Image %d not same size as other input images (%d, %d)\n",
    92                     tmpReadout->image->numRows, tmpReadout->image->numCols);
    93             return(NULL);
    94         }
    95         // XXX
    96         if (numInputRows != tmpReadout->image->numRows) {
    97             psError(PS_ERR_UNKNOWN,true, "Image %d not same size as other input images (%d, %d)\n",
    98                     tmpReadout->image->numRows, tmpReadout->image->numCols);
    99             return(NULL);
    100         }
    101 
     89        minInputRows = PS_MIN(minInputRows,
     90                              (tmpReadout->row0 + tmpReadout->image->row0));
     91        tmpF = tmpReadout->col0 +
     92               tmpReadout->numCols +
     93               tmpReadout->image->col0 +
     94               tmpReadout->image->numCols;
     95        maxInputCols = PS_MAX(maxInputCols, tmpF);
     96
     97        minInputCols = PS_MIN(minInputCols,
     98                              (tmpReadout->col0 + tmpReadout->image->col0));
     99        tmpF = tmpReadout->row0 +
     100               tmpReadout->numRows +
     101               tmpReadout->image->row0 +
     102               tmpReadout->image->numRows;
     103        maxInputRows = PS_MAX(maxInputRows, tmpF);
    102104        tmpInput = tmpInput->next;
    103105        numInputs++;
     
    105107
    106108    if (output == NULL) {
    107         output = psImageAlloc(numInputCols, numInputRows, PS_TYPE_F32);
    108     }
    109 
     109        output = psImageAlloc(numInputCols-minInputCols,
     110                              numInputRows-minInputRows, PS_TYPE_F32);
     111        output->col0 = minInputCols;
     112        output->row0 = minInputRows;
     113    } else {
     114        if (((output->col0 + output->numCols) < maxInputCols) ||
     115                ((output->row0 + output->numRows) < maxInputRows)) {
     116            psError(__func__, "Output image (%d, %d) is too small to hold combined images.\n",
     117                    output->row0 + output->numRows,
     118                    output->col0 + output->numCols);
     119            return(NULL);
     120        }
     121
     122        if ((output->col0 > minInputCols) ||
     123                (output->row0 > minInputRows)) {
     124            psError(__func__, "Output image offset is larger then input image offset.\n");
     125            return(NULL);
     126        }
     127    }
    110128
    111129    if (1 < p_psDetermineNumBits(params->stats->options)) {
     
    127145    for (i = 0; i < output->numRows ; i++) {
    128146        for (j = 0; j < output->numCols ; j++) {
     147
    129148            for (int r = 0; r < numInputs ; r++) {
    130                 //                if (i,j are valid for this readout) {
     149                // if (i,j are valid for this readout) {
    131150                if (0) {
    132                     //                    tmpPixels->data.F32[r] = WHATEVER;
     151                    // tmpPixels->data.F32[r] = WHATEVER;
    133152                    tmpPixelMask->data.U8[r] = 0;
    134153                } else {
Note: See TracChangeset for help on using the changeset viewer.