IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 2815


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

...

File:
1 edited

Legend:

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

    r2812 r2815  
    55 *  @author GLG, MHPCC
    66 *
    7  *  @version $Revision: 1.3 $ $Name: not supported by cvs2svn $
    8  *  @date $Date: 2004-12-23 23:16:36 $
     7 *  @version $Revision: 1.4 $ $Name: not supported by cvs2svn $
     8 *  @date $Date: 2004-12-23 23:57:32 $
    99 *
    1010 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    2222                          };
    2323
    24 #define OUTPUT_ROWS_BASE 8
    25 #define OUTPUT_COLS_BASE 16
    26 #define OUTPUT_ROWS_NUM  32
    27 #define OUTPUT_COLS_NUM  32
    2824#define NUM_READOUTS  10
    29 #define OUT_IMAGE_SIZE 10
    3025
    3126int main(int argc, char* argv[])
     
    3631int doit()
    3732{
    38     return(0);
    3933    int i;
    40     int j;
    4134    int r;
    4235    psList *list = NULL;
     
    8477
    8578        psImage *tmpImage = psImageAlloc(numCols[r], numRows[r], PS_TYPE_F32);
    86         for (i=0;i<numRows[r];i++) {
    87             for (j=0;j<numCols[r];j++) {
    88                 tmpImage->data.F32[i][j] = (float) (i + j);
    89                 tmpImage->data.F32[i][j] = 1.0;
    90                 tmpImage->data.F32[i][j] = (float) r;
    91             }
    92         }
     79        PS_IMAGE_SET_F32(tmpImage, ((float) r));
    9380
    9481        *(int *) (& (tmpImage->row0)) = baseRows[r];
     
    113100    output = pmReadoutCombine(output, list, params, zero, scale, true, 1.0, 0.0);
    114101
    115     for (i=output->row0; i < (output->row0 + output->numRows) ; i++) {
    116         for (j=output->col0; j < (output->col0 + output->numCols) ; j++) {
    117             printf("%.1f ", output->data.F32[i-output->row0][j-output->col0]);
    118         }
    119         printf("\n");
    120     }
    121 
    122     psFree(params->stats);
    123     psFree(params);
    124     psFree(output);
    125     psFree(zero);
    126     psFree(scale);
    127 
    128     psListElem *tmpInput = (psListElem *) list->head;
    129     while (NULL != tmpInput) {
    130         psReadout *tmpReadout = (psReadout *) tmpInput->data;
    131         psFree(tmpReadout);
    132         tmpInput = tmpInput->next;
    133     }
    134     psFree(list);
    135 
    136     return(0);
    137 }
    138 
    139 #define EIGHT 8
    140 int quarters()
    141 {
    142     int i;
    143     int j;
    144     int r;
    145     psList *list = NULL;
    146     int baseRowsReadout[EIGHT];
    147     int baseColsReadout[EIGHT];
    148     int baseRows[EIGHT];
    149     int baseCols[EIGHT];
    150     int numRows[EIGHT];
    151     int numCols[EIGHT];
    152     int minOutRow = 10000;
    153     int minOutCol = 10000;
    154     int maxOutRow = -1;
    155     int maxOutCol = -1;
    156     psImage *output = NULL;
    157     psCombineParams *params = (psCombineParams *) psAlloc(sizeof(psCombineParams));
    158     psVector *zero = psVectorAlloc(EIGHT, PS_TYPE_F32);
    159     psVector *scale = psVectorAlloc(EIGHT, PS_TYPE_F32);
    160     for (i=0;i<EIGHT;i++) {
    161         zero->data.F32[i] = 1.0;
    162     }
    163     for (i=0;i<EIGHT;i++) {
    164         scale->data.F32[i] = 2.0;
    165     }
    166 
    167     params->stats = psStatsAlloc(PS_STAT_SAMPLE_MEAN);
    168     params->maskVal = 1;
    169     params->fracLow = 0.0;
    170     params->fracHigh = 10000.0;
    171     params->nKeep = 0;
    172 
    173     for (r=0;r<EIGHT;r++) {
    174         baseRowsReadout[r] = 0;
    175         baseColsReadout[r] = 0;
    176         baseRows[r] = 0;
    177         baseCols[r] = 0;
    178         numRows[r] = 10;
    179         numCols[r] = 10;
    180 
    181         psImage *tmpImage = psImageAlloc(numCols[r], numRows[r], PS_TYPE_F32);
    182         for (i=0;i<numRows[r];i++) {
    183             for (j=0;j<numCols[r];j++) {
    184                 tmpImage->data.F32[i][j] = (float) (i + j);
    185                 tmpImage->data.F32[i][j] = 1.0;
    186                 tmpImage->data.F32[i][j] = (float) r;
    187             }
    188         }
    189 
    190         *(int *) (& (tmpImage->row0)) = baseRows[r];
    191         *(int *) (& (tmpImage->col0)) = baseCols[r];
    192         psReadout *tmpReadout = psReadoutAlloc(baseColsReadout[r],
    193                                                baseRowsReadout[r],
    194                                                tmpImage);
    195         minOutRow = PS_MIN(minOutRow, (baseRowsReadout[r] + baseRows[r]));
    196         minOutCol = PS_MIN(minOutCol, (baseColsReadout[r] + baseCols[r]));
    197         maxOutRow = PS_MAX(maxOutRow, (baseRowsReadout[r] + baseRows[r] + numRows[r]));
    198         maxOutCol = PS_MAX(maxOutCol, (baseColsReadout[r] + baseCols[r] + numCols[r]));
    199 
    200         if (r == 0) {
    201             list = psListAlloc(tmpReadout);
    202         } else {
    203             psListAdd(list, PS_LIST_HEAD, tmpReadout);
    204         }
    205     }
    206     printf("tst_pmReadoutCombine(): (minOutRow, minOutCol) to (maxOutRow, maxOutCol) is (%d, %d) (%d, %d)\n",
    207            minOutRow, minOutCol, maxOutRow, maxOutCol);
    208 
    209     output = pmReadoutCombine(output, list, params, zero, scale, true, 1.0, 0.0);
    210 
    211     for (i=output->row0; i < (output->row0 + output->numRows) ; i++) {
    212         for (j=output->col0; j < (output->col0 + output->numCols) ; j++) {
     102    for (int i=output->row0; i < (output->row0 + output->numRows) ; i++) {
     103        for (int j=output->col0; j < (output->col0 + output->numCols) ; j++) {
    213104            printf("%.1f ", output->data.F32[i-output->row0][j-output->col0]);
    214105        }
     
    261152{
    262153    int i;
    263     int j;
    264154    int r;
    265155    psList *list = NULL;
     
    302192
    303193    for (r=0;r<NUM_READOUTS;r++) {
    304         baseRowsReadout[r] = r + 40;
    305         baseColsReadout[r] = r + 42;
    306         baseRows[r] = r;
    307         baseCols[r] = r+2;
    308         numRows[r] = 4 + (2 * r);
    309         numCols[r] = 8 + (2 * r);
    310 
    311194        baseRowsReadout[r] = 0;
    312195        baseColsReadout[r] = 0;
     
    317200
    318201        psImage *tmpImage = psImageAlloc(numCols[r], numRows[r], PS_TYPE_F32);
    319         for (i=0;i<numRows[r];i++) {
    320             for (j=0;j<numCols[r];j++) {
    321                 tmpImage->data.F32[i][j] = (float) (i + j);
    322                 tmpImage->data.F32[i][j] = 1.0;
    323                 tmpImage->data.F32[i][j] = (float) r;
    324             }
    325         }
    326 
     202        PS_IMAGE_SET_F32(tmpImage, ((float) r));
    327203        *(int *) (& (tmpImage->row0)) = baseRows[r];
    328204        *(int *) (& (tmpImage->col0)) = baseCols[r];
Note: See TracChangeset for help on using the changeset viewer.