IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Nov 4, 2004, 6:49:47 PM (22 years ago)
Author:
gusciora
Message:

This version of ReadoutCombine compiles, and runs, and generates correct
answers for simple input.

File:
1 edited

Legend:

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

    r2286 r2287  
    55 *  @author GLG, MHPCC
    66 *
    7  *  @version $Revision: 1.6 $ $Name: not supported by cvs2svn $
    8  *  @date $Date: 2004-11-05 02:45:42 $
     7 *  @version $Revision: 1.7 $ $Name: not supported by cvs2svn $
     8 *  @date $Date: 2004-11-05 04:49:47 $
    99 *
    1010 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    6565    psListElem *tmpInput = NULL;
    6666    int numInputs = 0;
    67     psReadout *tmpReadout;
     67    psReadout *tmpReadout = NULL;
    6868    float tmpF;
    6969
     
    135135    //
    136136    if (output == NULL) {
    137         output = psImageAlloc(1+maxInputCols-minInputCols,
    138                               1+maxInputRows-minInputRows, PS_TYPE_F32);
     137        output = psImageAlloc(maxInputCols-minInputCols,
     138                              maxInputRows-minInputRows, PS_TYPE_F32);
    139139        *(int *) &(output->col0) = minInputCols;
    140140        *(int *) &(output->row0) = minInputRows;
     
    168168    psReadout **tmpReadouts = (psReadout **) psAlloc(numInputs * sizeof(psReadout *));
    169169
    170 
    171170    // For each input readout, we create a pointer to that readout in
    172171    // "tmpReadouts[]", and we store the min/max pixel indices for that
     
    174173    // (outRowLower, outColLower, outRowUpper, outColUpper).
    175174    i = 0;
     175    tmpInput = (psListElem *) inputs->head;
    176176    while (NULL != tmpInput) {
    177177        tmpReadouts[i] = (psReadout *) tmpInput->data;
    178         outRowLower->data.U32[i] = tmpReadouts[i]->row0 + tmpReadout->image->row0;
    179         outColLower->data.U32[i] = tmpReadouts[i]->col0 + tmpReadout->image->col0;
     178        outRowLower->data.U32[i] = tmpReadouts[i]->row0 + tmpReadouts[i]->image->row0;
     179        outColLower->data.U32[i] = tmpReadouts[i]->col0 + tmpReadouts[i]->image->col0;
    180180        outRowUpper->data.U32[i] = tmpReadouts[i]->row0 +
    181181                                   tmpReadouts[i]->image->row0 +
     
    185185                                   tmpReadouts[i]->image->numCols;
    186186
     187        //        printf("Bounds: [%d][%d] to [%d][%d]\n", outRowLower->data.U32[i], outColLower->data.U32[i], outRowUpper->data.U32[i], outColUpper->data.U32[i]);
     188
     189
    187190        tmpInput = tmpInput->next;
    188191        i++;
    189 
    190192    }
    191193
     
    197199    // stats routine on those pixels/mask.  Then we set the output pixel value
    198200    // to the result of the stats call.
    199     for (i = output->row0; i < output->numRows ; i++) {
    200         for (j = output->col0; j < output->numCols ; j++) {
     201
     202    for (i = output->row0; i < (output->row0 + output->numRows) ; i++) {
     203        for (j = output->col0; j < (output->col0 + output->numCols) ; j++) {
    201204            for (int r = 0; r < numInputs ; r++) {
     205                //                printf("[%d][%d]: [%d][%d] to [%d][%d]\n", i, j, outRowLower->data.U32[r], outColLower->data.U32[r], outRowUpper->data.U32[r], outColUpper->data.U32[r]);
    202206                if ((outRowLower->data.U32[r] <= i) &&
    203207                        (outColLower->data.U32[r] <= j) &&
     
    206210
    207211                    int imageRow = i - (tmpReadouts[r]->row0 +
    208                                         tmpReadouts[i]->image->row0);
     212                                        tmpReadouts[r]->image->row0);
    209213                    int imageCol = j - (tmpReadouts[r]->col0 +
    210214                                        tmpReadouts[r]->image->col0);
    211                     if (!(maskVal && tmpReadouts[i]->mask->data.U8[imageRow][imageCol])) {
    212                         tmpPixels->data.F32[r] = tmpReadouts[i]->image->data.F32[imageRow][imageCol];
     215
     216                    if ((NULL == tmpReadouts[r]->mask) ||
     217                            !(maskVal && tmpReadouts[r]->mask->data.U8[imageRow][imageCol])) {
     218                        tmpPixels->data.F32[r] = tmpReadouts[r]->image->data.F32[imageRow][imageCol];
    213219                        tmpPixelMask->data.U8[r] = 0;
    214220                    } else {
     
    220226                    tmpPixelMask->data.U8[r] = 1;
    221227                }
     228                //                printf("readout[%d], image [%d][%d] is %f\n", r, i, j, tmpPixels->data.F32[r]);
    222229            }
    223230            // At this point, we have scanned all input readouts for this
     
    299306
    300307    psFree(tmpPixels);
    301     psFree(tmpPixels);
    302308    psFree(tmpPixelMask);
    303309    psFree(tmpPixelMaskNKeep);
Note: See TracChangeset for help on using the changeset viewer.