IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 2590


Ignore:
Timestamp:
Dec 1, 2004, 12:08:32 PM (22 years ago)
Author:
gusciora
Message:

...

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/psModules/test/tst_pmReadoutCombine.c

    r2287 r2590  
    11/** @file tst_pmReadoutCombine.c
    22 *
    3  *  @brief This file contains the tests for pmReadoutCombine.c:
    4  *
    53 *  test00() This routine will test the basic functionality.
    64 *
    75 *  @author GLG, MHPCC
    86 *
    9  *  @version $Revision: 1.1 $ $Name: not supported by cvs2svn $
    10  *  @date $Date: 2004-11-05 04:49:47 $
     7 *  @version $Revision: 1.2 $ $Name: not supported by cvs2svn $
     8 *  @date $Date: 2004-12-01 22:08:32 $
    119 *
    1210 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    2725#define OUTPUT_COLS_NUM  32
    2826#define NUM_READOUTS  10
     27#define OUT_IMAGE_SIZE 10
    2928
    3029int main(int argc, char* argv[])
     
    5453    psVector *scale = psVectorAlloc(NUM_READOUTS, PS_TYPE_F32);
    5554    for (i=0;i<NUM_READOUTS;i++) {
    56         zero->data.F32[i] = 0.0;
     55        zero->data.F32[i] = 1.0;
    5756    }
    5857    for (i=0;i<NUM_READOUTS;i++) {
    59         scale->data.F32[i] = 1.0;
     58        scale->data.F32[i] = 2.0;
    6059    }
    6160
     
    8685                tmpImage->data.F32[i][j] = (float) (i + j);
    8786                tmpImage->data.F32[i][j] = 1.0;
     87                tmpImage->data.F32[i][j] = (float) r;
    8888            }
    8989        }
     
    134134}
    135135
     136#define EIGHT 8
     137int quarters()
     138{
     139    int i;
     140    int j;
     141    int r;
     142    psList *list = NULL;
     143    int baseRowsReadout[EIGHT];
     144    int baseColsReadout[EIGHT];
     145    int baseRows[EIGHT];
     146    int baseCols[EIGHT];
     147    int numRows[EIGHT];
     148    int numCols[EIGHT];
     149    int minOutRow = 10000;
     150    int minOutCol = 10000;
     151    int maxOutRow = -1;
     152    int maxOutCol = -1;
     153    psImage *output = NULL;
     154    psCombineParams *params = (psCombineParams *) psAlloc(sizeof(psCombineParams));
     155    psVector *zero = psVectorAlloc(EIGHT, PS_TYPE_F32);
     156    psVector *scale = psVectorAlloc(EIGHT, PS_TYPE_F32);
     157    for (i=0;i<EIGHT;i++) {
     158        zero->data.F32[i] = 1.0;
     159    }
     160    for (i=0;i<EIGHT;i++) {
     161        scale->data.F32[i] = 2.0;
     162    }
     163
     164    params->stats = psStatsAlloc(PS_STAT_SAMPLE_MEAN);
     165    params->maskVal = 1;
     166    params->fracLow = 0.0;
     167    params->fracHigh = 10000.0;
     168    params->nKeep = 0;
     169
     170    for (r=0;r<EIGHT;r++) {
     171        baseRowsReadout[r] = 0;
     172        baseColsReadout[r] = 0;
     173        baseRows[r] = 0;
     174        baseCols[r] = 0;
     175        numRows[r] = 10;
     176        numCols[r] = 10;
     177
     178        psImage *tmpImage = psImageAlloc(numCols[r], numRows[r], PS_TYPE_F32);
     179        for (i=0;i<numRows[r];i++) {
     180            for (j=0;j<numCols[r];j++) {
     181                tmpImage->data.F32[i][j] = (float) (i + j);
     182                tmpImage->data.F32[i][j] = 1.0;
     183                tmpImage->data.F32[i][j] = (float) r;
     184            }
     185        }
     186
     187        *(int *) (& (tmpImage->row0)) = baseRows[r];
     188        *(int *) (& (tmpImage->col0)) = baseCols[r];
     189        psReadout *tmpReadout = psReadoutAlloc(baseColsReadout[r],
     190                                               baseRowsReadout[r],
     191                                               tmpImage);
     192        minOutRow = PS_MIN(minOutRow, (baseRowsReadout[r] + baseRows[r]));
     193        minOutCol = PS_MIN(minOutCol, (baseColsReadout[r] + baseCols[r]));
     194        maxOutRow = PS_MAX(maxOutRow, (baseRowsReadout[r] + baseRows[r] + numRows[r]));
     195        maxOutCol = PS_MAX(maxOutCol, (baseColsReadout[r] + baseCols[r] + numCols[r]));
     196
     197        if (r == 0) {
     198            list = psListAlloc(tmpReadout);
     199        } else {
     200            psListAdd(list, PS_LIST_HEAD, tmpReadout);
     201        }
     202    }
     203    printf("tst_pmReadoutCombine(): (minOutRow, minOutCol) to (maxOutRow, maxOutCol) is (%d, %d) (%d, %d)\n",
     204           minOutRow, minOutCol, maxOutRow, maxOutCol);
     205
     206    output = pmReadoutCombine(output, list, params, zero, scale, true, 1.0, 0.0);
     207
     208    for (i=output->row0; i < (output->row0 + output->numRows) ; i++) {
     209        for (j=output->col0; j < (output->col0 + output->numCols) ; j++) {
     210            printf("%.1f ", output->data.F32[i-output->row0][j-output->col0]);
     211        }
     212        printf("\n");
     213    }
     214
     215    psFree(params->stats);
     216    psFree(params);
     217    psFree(output);
     218    psFree(zero);
     219    psFree(scale);
     220
     221    psListElem *tmpInput = (psListElem *) list->head;
     222    while (NULL != tmpInput) {
     223        psReadout *tmpReadout = (psReadout *) tmpInput->data;
     224        psFree(tmpReadout);
     225        tmpInput = tmpInput->next;
     226    }
     227    psFree(list);
     228
     229    return(0);
     230}
     231
    136232int test00( void )
    137233{
Note: See TracChangeset for help on using the changeset viewer.