IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 1877


Ignore:
Timestamp:
Sep 24, 2004, 8:31:02 AM (22 years ago)
Author:
gusciora
Message:

...

File:
1 edited

Legend:

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

    r1871 r1877  
    88 *  @author George Gusciora, MHPCC
    99 *
    10  *  @version $Revision: 1.2 $ $Name: not supported by cvs2svn $
    11  *  @date $Date: 2004-09-24 00:23:48 $
     10 *  @version $Revision: 1.3 $ $Name: not supported by cvs2svn $
     11 *  @date $Date: 2004-09-24 18:31:02 $
    1212 *
    1313 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    118118        psImageStats(stat, in->image, in->mask, 0xffffffff);
    119119        p_psImageSubtractScalar(in->image, stat->value);
    120         return(in)
    121           }
    122 
    123           if (((overScanAxis == PM_OVERSCAN_NONE) ||
    124                   (overScanAxis == PM_OVERSCAN_ALL)) &&
    125                   (fit == PM_FIT_NONE)) {
    126               //XXX: psWarningMsg()
    127               //XXX: Then what?
    128               return(in)
    129                 }
    130 
    131                 // XXX: Is there a better way to extract a psVector from a psImage without
    132                 // having to copy every element in that vector?
    133 
    134                 // XXX: If we get here, do we know that overScanAxis == PM_OVERSCAN_ROW
    135                 // or PM_OVERSCAN_COL?
    136 
    137                 if ((overScanAxis == PM_OVERSCAN_ROW) || (overScanAxis == PM_OVERSCAN_COL)) {
    138                     if (overScanAxis == PM_OVERSCAN_ROW) {
    139                         tmp = psVectorAlloc((in->image)->numCols, PS_TYPE_F32);
    140                         tmpRow = psVectorAlloc((in->image)->numCols, PS_TYPE_F32);
    141                         tmpMask = psVectorAlloc((in->image)->numCols, PS_TYPE_U8);
    142                         for (i=0;i<(in->image)->numCols;i++) {
    143                             for (j=0;j<(in->image)->numRows;j++) {
    144                                 tmpRow->data.F32[j] = (in->image)->data.F32[i][j];
    145                                 tmpMask->data.U8[j] = (in->mask)->data.U8[i][j];
    146                             }
    147                             stat = psVectorStats(stat, tmpRow, tmpMask, 0xffffffff);
    148                             tmp->data.F32[i] = stat->value;
    149                         }
    150                     }
    151                     if (overScanAxis == PM_OVERSCAN_COL) {
    152                         tmp = psVectorAlloc((in->image)->numRows, PS_TYPE_F32);
    153                         tmpcol = psVectorAlloc((in->image)->numRows, PS_TYPE_F32);
    154                         tmpMask = psVectorAlloc((in->image)->nuRows, PS_TYPE_U8);
    155                         for (i=0;i<(in->image)->numRows;i++) {
    156                             for (j=0;j<(in->image)->numCols;j++) {
    157                                 tmpRow->data.F32[j] = (in->image)->data.F32[i][j];
    158                                 tmpMask->data.U8[j] = (in->mask)->data.U8[i][j];
    159                             }
    160                             stat = psVectorStats(stat, tmpRow, tmpMask, 0xffffffff);
    161                             tmp->data.F32[i] = stat->value;
    162                         }
    163                     }
    164 
    165                     if (nBin > 0) {
    166                         numBins = 1+((tmp->n)/nBin);
    167                         psVector *myBin = psVectorAlloc(numBins, PS_TYPE_F32);
    168 
    169                         for (i=0;i<numBins;i++) {
    170                             // XXX: do this
    171                         }
    172                         // XXX: resize tmp to myBin, and store myBin elements there.
    173                     } else {
    174                         nBin = 1;
    175                     }
    176 
    177                     if (!((fitSpec == NULL) || (fit ==PM_FIT_NONE))) {
    178                         fit the vector to a linear or cubic spline.
    179                     }
    180 
    181                     if (overScanAxis == PM_OVERSCAN_ROW) {
    182                         for (i=0;i<(in->image)->numCols;i++) {
    183                             for (j=0;j<(in->image)->numRows;j++) {
    184                                 (in->image)->data.F32[i][j]-= tmp->data.F32[j/nBin];
    185                             }
    186                         }
    187                     }
    188 
    189                     if (overScanAxis == PM_OVERSCAN_COLUMN) {
    190                         for (i=0;i<(in->image)->numRows;i++) {
    191                             for (j=0;j<(in->image)->numCols;j++) {
    192                                 (in->image)->data.F32[i][j]-= tmp->data.F32[j/nBin];
    193                             }
    194                         }
    195                     }
    196                     return(in);
    197                 }
    198 
    199                 if (bias != NULL) {
    200                     return(psSubtractFrame(in, bias));
    201                 }
    202 
    203                 // XXX: psErrorMsg(): Shouldn't get here?
    204             }
    205 
     120        return(in);
     121    }
     122
     123    if (((overScanAxis == PM_OVERSCAN_NONE) ||
     124            (overScanAxis == PM_OVERSCAN_ALL)) &&
     125            (fit == PM_FIT_NONE)) {
     126        //XXX: psWarningMsg()
     127        //XXX: Then what?
     128        return(in);
     129    }
     130
     131    // XXX: Is there a better way to extract a psVector from a psImage without
     132    // having to copy every element in that vector?
     133
     134    // XXX: If we get here, do we know that overScanAxis == PM_OVERSCAN_ROW
     135    // or PM_OVERSCAN_COL?
     136
     137    if ((overScanAxis == PM_OVERSCAN_ROW) || (overScanAxis == PM_OVERSCAN_COL)) {
     138        if (overScanAxis == PM_OVERSCAN_ROW) {
     139            tmp = psVectorAlloc((in->image)->numCols, PS_TYPE_F32);
     140            tmpRow = psVectorAlloc((in->image)->numCols, PS_TYPE_F32);
     141            tmpMask = psVectorAlloc((in->image)->numCols, PS_TYPE_U8);
     142            for (i=0;i<(in->image)->numCols;i++) {
     143                for (j=0;j<(in->image)->numRows;j++) {
     144                    tmpRow->data.F32[j] = (in->image)->data.F32[i][j];
     145                    tmpMask->data.U8[j] = (in->mask)->data.U8[i][j];
     146                }
     147                stat = psVectorStats(stat, tmpRow, tmpMask, 0xffffffff);
     148                tmp->data.F32[i] = stat->value;
     149            }
     150        }
     151        if (overScanAxis == PM_OVERSCAN_COL) {
     152            tmp = psVectorAlloc((in->image)->numRows, PS_TYPE_F32);
     153            tmpcol = psVectorAlloc((in->image)->numRows, PS_TYPE_F32);
     154            tmpMask = psVectorAlloc((in->image)->nuRows, PS_TYPE_U8);
     155            for (i=0;i<(in->image)->numRows;i++) {
     156                for (j=0;j<(in->image)->numCols;j++) {
     157                    tmpRow->data.F32[j] = (in->image)->data.F32[i][j];
     158                    tmpMask->data.U8[j] = (in->mask)->data.U8[i][j];
     159                }
     160                stat = psVectorStats(stat, tmpRow, tmpMask, 0xffffffff);
     161                tmp->data.F32[i] = stat->value;
     162            }
     163        }
     164
     165        if (nBin > 0) {
     166            numBins = 1+((tmp->n)/nBin);
     167            psVector *myBin = psVectorAlloc(numBins, PS_TYPE_F32);
     168
     169            for (i=0;i<numBins;i++) {
     170                // XXX: do this
     171            }
     172            // XXX: resize tmp to myBin, and store myBin elements there.
     173        } else {
     174            nBin = 1;
     175        }
     176
     177        if (!((fitSpec == NULL) || (fit ==PM_FIT_NONE))) {
     178            fit the vector to a linear or cubic spline.
     179        }
     180
     181        if (overScanAxis == PM_OVERSCAN_ROW) {
     182            for (i=0;i<(in->image)->numCols;i++) {
     183                for (j=0;j<(in->image)->numRows;j++) {
     184                    (in->image)->data.F32[i][j]-= tmp->data.F32[j/nBin];
     185                }
     186            }
     187        }
     188
     189        if (overScanAxis == PM_OVERSCAN_COLUMN) {
     190            for (i=0;i<(in->image)->numRows;i++) {
     191                for (j=0;j<(in->image)->numCols;j++) {
     192                    (in->image)->data.F32[i][j]-= tmp->data.F32[j/nBin];
     193                }
     194            }
     195        }
     196        return(in);
     197    }
     198
     199    if (bias != NULL) {
     200        return(psSubtractFrame(in, bias));
     201    }
     202
     203    // XXX: psErrorMsg(): Shouldn't get here?
     204}
     205
Note: See TracChangeset for help on using the changeset viewer.