IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 2204 for trunk/psLib/src/image


Ignore:
Timestamp:
Oct 26, 2004, 2:57:34 PM (22 years ago)
Author:
desonia
Message:

converted native C types to ps Types, where practical.

Location:
trunk/psLib/src/image
Files:
13 edited

Legend:

Unmodified
Added
Removed
  • trunk/psLib/src/image/psImage.c

    r2105 r2204  
    1010 *  @author Ross Harman, MHPCC
    1111 *
    12  *  @version $Revision: 1.50 $ $Name: not supported by cvs2svn $
    13  *  @date $Date: 2004-10-14 01:22:59 $
     12 *  @version $Revision: 1.51 $ $Name: not supported by cvs2svn $
     13 *  @date $Date: 2004-10-27 00:57:31 $
    1414 *
    1515 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    2929static void imageFree(psImage* image);
    3030
    31 psImage* psImageAlloc(unsigned int numCols,
    32                       unsigned int numRows,
     31psImage* psImageAlloc(psU32 numCols,
     32                      psU32 numRows,
    3333                      const psElemType type)
    3434{
    35     int area = 0;
    36     int elementSize = PSELEMTYPE_SIZEOF(type);  // element size in bytes
    37     int rowSize = numCols * elementSize;        // row size in bytes.
     35    psS32 area = 0;
     36    psS32 elementSize = PSELEMTYPE_SIZEOF(type);  // element size in bytes
     37    psS32 rowSize = numCols * elementSize;        // row size in bytes.
    3838
    3939    area = numCols * numRows;
     
    5151    p_psMemSetDeallocator(image, (psFreeFcn) imageFree);
    5252
    53     image->data.V = psAlloc(sizeof(void *) * numRows);
     53    image->data.V = psAlloc(sizeof(psPtr ) * numRows);
    5454
    5555    image->rawDataBuffer = psAlloc(area * elementSize);
     
    5757    // set the row pointers.
    5858    image->data.V[0] = image->rawDataBuffer;
    59     for (int i = 1; i < numRows; i++) {
    60         image->data.V[i] = (void *)((int8_t *) image->data.V[i - 1] + rowSize);
    61     }
    62 
    63     *(int *)&image->col0 = 0;
    64     *(int *)&image->row0 = 0;
    65     *(unsigned int *)&image->numCols = numCols;
    66     *(unsigned int *)&image->numRows = numRows;
     59    for (psS32 i = 1; i < numRows; i++) {
     60        image->data.V[i] = (psPtr )((int8_t *) image->data.V[i - 1] + rowSize);
     61    }
     62
     63    *(psS32 *)&image->col0 = 0;
     64    *(psS32 *)&image->row0 = 0;
     65    *(psU32 *)&image->numCols = numCols;
     66    *(psU32 *)&image->numRows = numRows;
    6767    *(psDimen* ) & image->type.dimen = PS_DIMEN_IMAGE;
    6868    *(psElemType* ) & image->type.type = type;
     
    8181    if (image->type.type == PS_TYPE_PTR) {
    8282        // 2-D array of pointers -- must dereference elements
    83         unsigned int oldNumRows = image->numRows;
    84         unsigned int oldNumCols = image->numCols;
    85         psPTR* rowPtr;
    86 
    87         for (unsigned int row = 0; row < oldNumRows; row++) {
     83        psU32 oldNumRows = image->numRows;
     84        psU32 oldNumCols = image->numCols;
     85        psPtr* rowPtr;
     86
     87        for (psU32 row = 0; row < oldNumRows; row++) {
    8888            rowPtr = image->data.PTR[row];
    89             for (unsigned int col = 0; col < oldNumCols; col++) {
     89            for (psU32 col = 0; col < oldNumCols; col++) {
    9090                psMemDecrRefCounter(rowPtr[col]);
    9191            }
     
    105105
    106106psImage* psImageRecycle(psImage* old,
    107                         unsigned int numCols,
    108                         unsigned int numRows,
     107                        psU32 numCols,
     108                        psU32 numRows,
    109109                        const psElemType type)
    110110{
    111     int elementSize = PSELEMTYPE_SIZEOF(type);  // element size in bytes
    112     int rowSize = numCols * elementSize;        // row size in bytes.
     111    psS32 elementSize = PSELEMTYPE_SIZEOF(type);  // element size in bytes
     112    psS32 rowSize = numCols * elementSize;        // row size in bytes.
    113113
    114114    if (old == NULL) {
     
    128128        // 2-D array of pointers -- must
    129129        // dereference
    130         unsigned int oldNumRows = old->numRows;
    131         unsigned int oldNumCols = old->numCols;
    132         psPTR* rowPtr;
    133 
    134         for (unsigned int row = 0; row < oldNumRows; row++) {
     130        psU32 oldNumRows = old->numRows;
     131        psU32 oldNumCols = old->numCols;
     132        psPtr* rowPtr;
     133
     134        for (psU32 row = 0; row < oldNumRows; row++) {
    135135            rowPtr = old->data.PTR[row];
    136             for (unsigned int col = 0; col < oldNumCols; col++) {
     136            for (psU32 col = 0; col < oldNumCols; col++) {
    137137                psMemDecrRefCounter(rowPtr[col]);
    138138                rowPtr[col] = NULL;
     
    149149    old->rawDataBuffer = psRealloc(old->data.V[0],
    150150                                   numCols * numRows * elementSize);
    151     old->data.V = (void **)psRealloc(old->data.V, numRows * sizeof(void *));
     151    old->data.V = (psPtr *)psRealloc(old->data.V, numRows * sizeof(psPtr ));
    152152
    153153    // recreate the row pointers
    154154    old->data.V[0] = old->rawDataBuffer;
    155     for (int i = 1; i < numRows; i++) {
    156         old->data.V[i] = (void *)((int8_t *) old->data.V[i - 1] + rowSize);
    157     }
    158 
    159     *(unsigned int *)&old->numCols = numCols;
    160     *(unsigned int *)&old->numRows = numRows;
     155    for (psS32 i = 1; i < numRows; i++) {
     156        old->data.V[i] = (psPtr )((int8_t *) old->data.V[i - 1] + rowSize);
     157    }
     158
     159    *(psU32 *)&old->numCols = numCols;
     160    *(psU32 *)&old->numRows = numRows;
    161161    *(psElemType* ) & old->type.type = type;
    162162
     
    169169{
    170170    psElemType inDatatype;
    171     int elementSize;
    172     int elements;
    173     int numRows;
    174     int numCols;
     171    psS32 elementSize;
     172    psS32 elements;
     173    psS32 numRows;
     174    psS32 numCols;
    175175
    176176    if (input == NULL || input->data.V == NULL) {
     
    218218    // datatype.
    219219    if (type == inDatatype) {
    220         for (int row=0;row<numRows;row++) {
     220        for (psS32 row=0;row<numRows;row++) {
    221221            memcpy(output->data.V[row], input->data.V[row], elementSize * numCols);
    222222        }
     
    227227        ps##INTYPE *in; \
    228228        ps##OUTTYPE *out; \
    229         for(int row=0;row<numRows;row++) { \
     229        for(psS32 row=0;row<numRows;row++) { \
    230230            in = IN->data.INTYPE[row]; \
    231231            out = OUT->data.OUTTYPE[row]; \
    232             for (int col=0;col<numCols;col++) { \
     232            for (psS32 col=0;col<numCols;col++) { \
    233233                *(out++) = *(in++); \
    234234            } \
     
    331331}
    332332
    333 int psImageFreeChildren(psImage* image)
     333psS32 psImageFreeChildren(psImage* image)
    334334{
    335     int numFreed = 0;
     335    psS32 numFreed = 0;
    336336
    337337    if (image == NULL) {
     
    345345        // orphan the children first
    346346        // (so psFree doesn't try to modify the parent's children array while I'm using it)
    347         for (int i=0;i<numFreed;i++) {
     347        for (psS32 i=0;i<numFreed;i++) {
    348348            children[i]->parent = NULL;
    349349        }
     
    366366                              float y,
    367367                              const psImage* mask,
    368                               unsigned int maskVal,
     368                              psU32 maskVal,
    369369                              psC64 unexposedValue,
    370370                              psImageInterpolateMode mode)
     
    438438        float y, \
    439439        const psImage* mask, \
    440         unsigned int maskVal, \
     440        psU32 maskVal, \
    441441        psF64 unexposedValue) \
    442442{ \
    443     int intX = (int) round((psF64)(x) - 0.5 + FLT_EPSILON); \
    444     int intY = (int) round((psF64)(y) - 0.5 + FLT_EPSILON); \
    445     int lastX = input->numCols - 1; \
    446     int lastY = input->numRows - 1; \
     443    psS32 intX = (psS32) round((psF64)(x) - 0.5 + FLT_EPSILON); \
     444    psS32 intY = (psS32) round((psF64)(y) - 0.5 + FLT_EPSILON); \
     445    psS32 lastX = input->numCols - 1; \
     446    psS32 lastY = input->numRows - 1; \
    447447    \
    448448    if ((intX < 0) || \
     
    463463        float y, \
    464464        const psImage* mask, \
    465         unsigned int maskVal, \
     465        psU32 maskVal, \
    466466        psC64 unexposedValue) \
    467467{ \
    468     int intX = (int) round((psF64)(x) - 0.5); \
    469     int intY = (int) round((psF64)(y) - 0.5); \
    470     int lastX = input->numCols - 1; \
    471     int lastY = input->numRows - 1; \
     468    psS32 intX = (psS32) round((psF64)(x) - 0.5); \
     469    psS32 intY = (psS32) round((psF64)(y) - 0.5); \
     470    psS32 lastX = input->numCols - 1; \
     471    psS32 lastY = input->numRows - 1; \
    472472    \
    473473    if ((intX < 0) || \
     
    501501        float y, \
    502502        const psImage* mask, \
    503         unsigned int maskVal, \
     503        psU32 maskVal, \
    504504        psF64 unexposedValue) \
    505505{ \
     
    508508    psF64 fracX = x - 0.5 - floorX; \
    509509    psF64 fracY = y - 0.5 - floorY; \
    510     int intFloorX = (int) floorX; \
    511     int intFloorY = (int) floorY; \
    512     int lastX = input->numCols - 1; \
    513     int lastY = input->numRows - 1; \
     510    psS32 intFloorX = (psS32) floorX; \
     511    psS32 intFloorY = (psS32) floorY; \
     512    psS32 lastX = input->numCols - 1; \
     513    psS32 lastY = input->numRows - 1; \
    514514    ps##TYPE V00; \
    515515    ps##TYPE V01; \
    516516    ps##TYPE V10; \
    517517    ps##TYPE V11; \
    518     bool valid00 = false; \
    519     bool valid01 = false; \
    520     bool valid10 = false; \
    521     bool valid11 = false; \
     518    psBool valid00 = false; \
     519    psBool valid01 = false; \
     520    psBool valid10 = false; \
     521    psBool valid11 = false; \
    522522    \
    523523    if (intFloorY >= 0 && intFloorY <= lastY) { \
     
    556556    \
    557557    psF64 V0; \
    558     bool valid0 = true; \
     558    psBool valid0 = true; \
    559559    if (valid00 && valid10) { \
    560560        V0 = V00*(1-fracX)+V10*fracX; \
     
    568568    \
    569569    psF64 V1; \
    570     bool valid1 = true; \
     570    psBool valid1 = true; \
    571571    if (valid01 && valid11) { \
    572572        V1 = V01*(1-fracX)+V11*fracX; \
     
    595595        float y, \
    596596        const psImage* mask, \
    597         unsigned int maskVal, \
     597        psU32 maskVal, \
    598598        psC64 unexposedValue) \
    599599{ \
     
    602602    psF64 fracX = x - 0.5 - floorX; \
    603603    psF64 fracY = y - 0.5 - floorY; \
    604     int intFloorX = (int) floorX; \
    605     int intFloorY = (int) floorY; \
    606     int lastX = input->numCols - 1; \
    607     int lastY = input->numRows - 1; \
     604    psS32 intFloorX = (psS32) floorX; \
     605    psS32 intFloorY = (psS32) floorY; \
     606    psS32 lastX = input->numCols - 1; \
     607    psS32 lastY = input->numRows - 1; \
    608608    ps##TYPE V00; \
    609609    ps##TYPE V01; \
    610610    ps##TYPE V10; \
    611611    ps##TYPE V11; \
    612     bool valid00 = false; \
    613     bool valid01 = false; \
    614     bool valid10 = false; \
    615     bool valid11 = false; \
     612    psBool valid00 = false; \
     613    psBool valid01 = false; \
     614    psBool valid10 = false; \
     615    psBool valid11 = false; \
    616616    \
    617617    if (intFloorY >= 0 && intFloorY <= lastY) { \
     
    650650    \
    651651    psC64 V0; \
    652     bool valid0 = true; \
     652    psBool valid0 = true; \
    653653    if (valid00 && valid10) { \
    654654        V0 = V00*(1-fracX)+V10*fracX; \
     
    662662    \
    663663    psC64 V1; \
    664     bool valid1 = true; \
     664    psBool valid1 = true; \
    665665    if (valid01 && valid11) { \
    666666        V0 = V01*(1-fracX)+V11*fracX; \
  • trunk/psLib/src/image/psImage.h

    r2105 r2204  
    1111 *  @author Ross Harman, MHPCC
    1212 *
    13  *  @version $Revision: 1.41 $ $Name: not supported by cvs2svn $
    14  *  @date $Date: 2004-10-14 01:22:59 $
     13 *  @version $Revision: 1.42 $ $Name: not supported by cvs2svn $
     14 *  @date $Date: 2004-10-27 00:57:31 $
    1515 *
    1616 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    4747{
    4848    const psType type;                 ///< Image data type and dimension.
    49     const unsigned int numCols;        ///< Number of columns in image
    50     const unsigned int numRows;        ///< Number of rows in image.
    51     const int col0;                    ///< Column position relative to parent.
    52     const int row0;                    ///< Row position relative to parent.
     49    const psU32 numCols;        ///< Number of columns in image
     50    const psU32 numRows;        ///< Number of rows in image.
     51    const psS32 col0;                    ///< Column position relative to parent.
     52    const psS32 row0;                    ///< Row position relative to parent.
    5353
    5454    union {
     
    6565        psC32** C32;                   ///< Single-precision complex data.
    6666        psC64** C64;                   ///< Double-precision complex data.
    67         psPTR** PTR;                   ///< Void pointers.
    68         psPTR*  V;                     ///< Pointer to data.
     67        psPtr** PTR;                   ///< Void pointers.
     68        psPtr*  V;                     ///< Pointer to data.
    6969    } data;                            ///< Union for data types.
    7070    const struct psImage* parent;      ///< Parent, if a subimage.
    7171    psArray* children;                 ///< Children of this region.
    7272
    73     void* rawDataBuffer;
     73    psPtr rawDataBuffer;
    7474}
    7575psImage;
     
    8484 */
    8585psImage* psImageAlloc(
    86     unsigned int numCols,              ///< Number of rows in image.
    87     unsigned int numRows,              ///< Number of columns in image.
     86    psU32 numCols,              ///< Number of rows in image.
     87    psU32 numRows,              ///< Number of columns in image.
    8888    const psElemType type              ///< Type of data for image.
    8989);
     
    9696psImage* psImageRecycle(
    9797    psImage* old,                      ///< the psImage to recycle by resizing image buffer
    98     unsigned int numCols,              ///< the desired number of columns in image
    99     unsigned int numRows,              ///< the desired number of rows in image
     98    psU32 numCols,              ///< the desired number of columns in image
     99    psU32 numRows,              ///< the desired number of rows in image
    100100    const psElemType type              ///< the desired datatype of the image
    101101);
     
    115115/** Frees all children of a psImage.
    116116 *
    117  *  @return int      Number of children freed.
     117 *  @return psS32      Number of children freed.
    118118 *
    119119 */
    120 int psImageFreeChildren(
     120psS32 psImageFreeChildren(
    121121    psImage* image                     ///< psImage in which all children shall be deallocated
    122122);
     
    132132    float y,                           ///< row location ot derive value of
    133133    const psImage* mask,               ///< if not NULL, the mask of the input image
    134     unsigned int maskVal,              ///< the mask value
     134    psU32 maskVal,              ///< the mask value
    135135    psC64 unexposedValue,              ///< return value if x,y location is not in image.
    136136    psImageInterpolateMode mode        ///< interpolation mode
     
    143143        float y,                       /**< row location ot derive value of */ \
    144144        const psImage* mask,           /**< if not NULL, the mask of the input image */ \
    145         unsigned int maskVal,          /**< the mask value */ \
     145        psU32 maskVal,          /**< the mask value */ \
    146146        psF64 unexposedValue           /**< return value if x,y location is not in image. */ \
    147147                                                 ); \
     
    151151        float y,                       /**< row location ot derive value of */ \
    152152        const psImage* mask,           /**< if not NULL, the mask of the input image */ \
    153         unsigned int maskVal,          /**< the mask value */ \
     153        psU32 maskVal,          /**< the mask value */ \
    154154        psF64 unexposedValue           /**< return value if x,y location is not in image. */ \
    155155                                                     );
     
    161161        float y,                       /**< row location ot derive value of */ \
    162162        const psImage* mask,           /**< if not NULL, the mask of the input image */ \
    163         unsigned int maskVal,          /**< the mask value */ \
     163        psU32 maskVal,          /**< the mask value */ \
    164164        psC64 unexposedValue           /**< return value if x,y location is not in image. */ \
    165165                                                 ); \
     
    169169        float y,                       /**< row location ot derive value of */ \
    170170        const psImage* mask,           /**< if not NULL, the mask of the input image */ \
    171         unsigned int maskVal,          /**< the mask value */ \
     171        psU32 maskVal,          /**< the mask value */ \
    172172        psC64 unexposedValue           /**< return value if x,y location is not in image. */ \
    173173                                                     );
  • trunk/psLib/src/image/psImageConvolve.c

    r1983 r2204  
    55 *  @author Robert DeSonia, MHPCC
    66 *
    7  *  @version $Revision: 1.6 $ $Name: not supported by cvs2svn $
    8  *  @date $Date: 2004-10-06 21:31:30 $
     7 *  @version $Revision: 1.7 $ $Name: not supported by cvs2svn $
     8 *  @date $Date: 2004-10-27 00:57:31 $
    99 *
    1010 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    2828static void freeKernel(psKernel* ptr);
    2929
    30 psKernel* psKernelAlloc(int xMin, int xMax, int yMin, int yMax)
     30psKernel* psKernelAlloc(psS32 xMin, psS32 xMax, psS32 yMin, psS32 yMax)
    3131{
    3232    psKernel* result;
    33     int numRows;
    34     int numCols;
     33    psS32 numRows;
     34    psS32 numCols;
    3535
    3636    // following is explicitly spelled out in the SDRS as a requirement
     
    4040                 yMin, yMax);
    4141
    42         int temp = yMin;
     42        psS32 temp = yMin;
    4343        yMin = yMax;
    4444        yMax = temp;
     
    5151                 xMin, xMax);
    5252
    53         int temp = xMin;
     53        psS32 temp = xMin;
    5454        xMin = xMax;
    5555        xMax = temp;
     
    7070    psKernelType** kernelRows = result->p_kernelRows;
    7171    psKernelType** imageRows = result->image->data.PS_TYPE_KERNEL_DATA;
    72     for (int i = 0; i < numRows; i++) {
     72    for (psS32 i = 0; i < numRows; i++) {
    7373        kernelRows[i] = imageRows[i] - xMin;
    7474    }
     
    9191                           const psVector* xShifts,
    9292                           const psVector* yShifts,
    93                            bool relative)
     93                           psBool relative)
    9494{
    95     int x = 0;
    96     int y = 0;
    97     int t = 0;
    98     int deltaT;
    99     int oldX;
    100     int oldY;
    101     int xMin = 0;
    102     int xMax = 0;
    103     int yMin = 0;
    104     int yMax = 0;
    105     int length = 0;
     95    psS32 x = 0;
     96    psS32 y = 0;
     97    psS32 t = 0;
     98    psS32 deltaT;
     99    psS32 oldX;
     100    psS32 oldY;
     101    psS32 xMin = 0;
     102    psS32 xMax = 0;
     103    psS32 yMin = 0;
     104    psS32 yMax = 0;
     105    psS32 length = 0;
    106106    psKernelType normalizeTime = 1.0;  // fraction of total time for each shift clock
    107107    psKernel* result = NULL;
     
    153153        y = 0; \
    154154        t = 0; \
    155         for (int lcv = 0; lcv < length; lcv++) { \
     155        for (psS32 lcv = 0; lcv < length; lcv++) { \
    156156            if (relative) { \
    157157                x += xShiftData[lcv]; \
     
    181181        y = 0; \
    182182        t = 0; \
    183         for (int i = 0; i < length; i++) { \
     183        for (psS32 i = 0; i < length; i++) { \
    184184            deltaT = t; \
    185185            oldX = x; \
     
    228228}
    229229
    230 psImage* psImageConvolve(psImage* out, const psImage* in, const psKernel* kernel, bool direct)
     230psImage* psImageConvolve(psImage* out, const psImage* in, const psKernel* kernel, psBool direct)
    231231{
    232232    if (in == NULL) {
     
    242242        return NULL;
    243243    }
    244     int xMin = kernel->xMin;
    245     int xMax = kernel->xMax;
    246     int yMin = kernel->yMin;
    247     int yMax = kernel->yMax;
     244    psS32 xMin = kernel->xMin;
     245    psS32 xMax = kernel->xMax;
     246    psS32 yMin = kernel->yMin;
     247    psS32 yMax = kernel->yMax;
    248248    psKernelType** kData = kernel->kernel;
    249249
    250250    // make the output image to the proper size and type
    251     int numRows = in->numRows;
    252     int numCols = in->numCols;
     251    psS32 numRows = in->numRows;
     252    psS32 numCols = in->numCols;
    253253
    254254
     
    261261            ps##TYPE** inData = in->data.TYPE; \
    262262            out = psImageRecycle(out, numCols, numRows, PS_TYPE_##TYPE); \
    263             for (int row=0;row<numRows;row++) { \
     263            for (psS32 row=0;row<numRows;row++) { \
    264264                ps##TYPE* outRow = out->data.TYPE[row]; \
    265                 for (int col=0;col<numCols;col++) { \
     265                for (psS32 col=0;col<numCols;col++) { \
    266266                    ps##TYPE pixel = 0.0; \
    267                     for (int kRow = yMin; kRow < yMax; kRow++) { \
     267                    for (psS32 kRow = yMin; kRow < yMax; kRow++) { \
    268268                        if (row-kRow >= 0 && row-kRow < numRows) { \
    269                             for (int kCol = xMin; kCol < xMax; kCol++) { \
     269                            for (psS32 kCol = xMin; kCol < xMax; kCol++) { \
    270270                                if (col-kCol >= 0 && col-kCol < numCols) { \
    271271                                    pixel += kData[kRow][kCol] * inData[row-kRow][col-kCol]; \
     
    310310    } else {
    311311        // fourier convolution
    312         int paddedCols = numCols+2*FOURIER_PADDING;
    313         int paddedRows = numRows+2*FOURIER_PADDING;
     312        psS32 paddedCols = numCols+2*FOURIER_PADDING;
     313        psS32 paddedRows = numRows+2*FOURIER_PADDING;
    314314
    315315        // check to see if kernel is smaller, otherwise padding it up will fail.
    316         int kRows = kernel->image->numRows;
    317         int kCols = kernel->image->numCols;
     316        psS32 kRows = kernel->image->numRows;
     317        psS32 kCols = kernel->image->numCols;
    318318        if (kRows >= numRows || kCols >= numCols) {
    319319            psErrorMsg(PS_ERRORNAME_DOMAIN "psImageConvolve",
     
    328328        // pad the image
    329329        psImage* paddedImage = psImageAlloc(paddedCols,paddedRows,in->type.type);
    330         int elementSize = PSELEMTYPE_SIZEOF(in->type.type);
     330        psS32 elementSize = PSELEMTYPE_SIZEOF(in->type.type);
    331331
    332332        // zero out padded area on top and bottom
     
    335335
    336336        // fill in the image-containing rows.
    337         int sidePaddingSize = FOURIER_PADDING*elementSize;
    338         int imageRowSize = numCols*elementSize;
     337        psS32 sidePaddingSize = FOURIER_PADDING*elementSize;
     338        psS32 imageRowSize = numCols*elementSize;
    339339        psU8* paddedData = paddedImage->data.U8[FOURIER_PADDING];
    340         for (int row=0;row<numRows;row++) {
     340        for (psS32 row=0;row<numRows;row++) {
    341341            // zero out padded area on left edge.
    342342            memset(paddedData,0,sidePaddingSize);
     
    354354        psImage* paddedKernel = psImageAlloc(paddedCols,paddedRows,PS_TYPE_KERNEL);
    355355        memset(paddedKernel->data.U8[0],0,sizeof(psKernelType)*numCols*numRows); // zero-out image
    356         int yMax = kernel->yMax;
    357         int xMax = kernel->xMax;
    358         for (int row = kernel->yMin; row <= yMax;row++) {
    359             int padRow = row;
     356        psS32 yMax = kernel->yMax;
     357        psS32 xMax = kernel->xMax;
     358        for (psS32 row = kernel->yMin; row <= yMax;row++) {
     359            psS32 padRow = row;
    360360            if (padRow < 0) {
    361361                padRow += paddedRows;
     
    363363            psKernelType* padData = paddedKernel->data.PS_TYPE_KERNEL_DATA[padRow];
    364364            psKernelType* kernelRow = kernel->kernel[row];
    365             for (int col = kernel->xMin; col <= xMax; col++) {
     365            for (psS32 col = kernel->xMin; col <= xMax; col++) {
    366366                if (col < 0) {
    367367                    padData[col+paddedCols] = kernelRow[col];
     
    418418        out = psImageRecycle(out,numCols,numRows,PS_TYPE_F32);
    419419        float factor = 1.0f/numCols/numRows;
    420         for (int row = 0; row < numRows; row++) {
     420        for (psS32 row = 0; row < numRows; row++) {
    421421            psF32* outRow = out->data.F32[row];
    422422            psC32* resultRow = complexOutSansPad->data.C32[row];
    423             for (int col = 0; col < numCols; col++) {
     423            for (psS32 col = 0; col < numCols; col++) {
    424424                outRow[col] = crealf(resultRow[col])*factor;
    425425            }
  • trunk/psLib/src/image/psImageConvolve.h

    r1863 r2204  
    77 *  @author Robert DeSonia, MHPCC
    88 *
    9  *  @version $Revision: 1.2 $ $Name: not supported by cvs2svn $
    10  *  @date $Date: 2004-09-23 18:30:57 $
     9 *  @version $Revision: 1.3 $ $Name: not supported by cvs2svn $
     10 *  @date $Date: 2004-10-27 00:57:31 $
    1111 *
    1212 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    1515#ifndef PS_IMAGE_CONVOLVE_H
    1616#define PS_IMAGE_CONVOLVE_H
    17 
    18 #include<stdbool.h>
    1917
    2018#include "psImage.h"
     
    3230{
    3331    psImage* image;                    ///< Kernel data, in the form of an image
    34     int xMin;                          ///< Most negative x index
    35     int yMin;                          ///< Most negative y index
    36     int xMax;                          ///< Most positive x index
    37     int yMax;                          ///< Most positive y index
     32    psS32 xMin;                          ///< Most negative x index
     33    psS32 yMin;                          ///< Most negative y index
     34    psS32 xMax;                          ///< Most positive x index
     35    psS32 yMax;                          ///< Most positive y index
    3836    psKernelType** kernel;             ///< Pointer to the kernel data
    3937    psKernelType** p_kernelRows;       ///< Pointer to the rows of the kernel data; not intended for user use.
     
    6866 */
    6967psKernel* psKernelAlloc(
    70     int xMin,                          ///< Most negative x index
    71     int xMax,                          ///< Most positive x index
    72     int yMin,                          ///< Most negative y index
    73     int yMax                           ///< Most positive y index
     68    psS32 xMin,                          ///< Most negative x index
     69    psS32 xMax,                          ///< Most positive x index
     70    psS32 yMin,                          ///< Most negative y index
     71    psS32 yMax                           ///< Most positive y index
    7472);
    7573
     
    9492    const psVector* xShifts,           ///< list of x-axis shifts
    9593    const psVector* yShifts,           ///< list of y-axis shifts
    96     bool relative
     94    psBool relative
    9795);
    9896
     
    118116    const psImage* in,                 ///< the psImage to convolve
    119117    const psKernel* kernel,            ///< kernel to colvolve with
    120     bool direct                        ///< specifies method, true=direct convolution, false=fourier
     118    psBool direct                        ///< specifies method, true=direct convolution, false=fourier
    121119);
    122120
  • trunk/psLib/src/image/psImageExtraction.c

    r2105 r2204  
    99 *  @author Robert DeSonia, MHPCC
    1010 *
    11  *  @version $Revision: 1.26 $ $Name: not supported by cvs2svn $
    12  *  @date $Date: 2004-10-14 01:22:59 $
     11 *  @version $Revision: 1.27 $ $Name: not supported by cvs2svn $
     12 *  @date $Date: 2004-10-27 00:57:31 $
    1313 *
    1414 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    2626psImage* imageSubset(psImage* out,
    2727                     psImage* image,
    28                      int col0,
    29                      int row0,
    30                      int col1,
    31                      int row1)
     28                     psS32 col0,
     29                     psS32 row0,
     30                     psS32 col1,
     31                     psS32 row1)
    3232{
    33     unsigned int elementSize;          // size of image element in bytes
    34     unsigned int inputColOffset;       // offset in bytes to first subset pixel in input row
     33    psU32 elementSize;          // size of image element in bytes
     34    psU32 inputColOffset;       // offset in bytes to first subset pixel in input row
    3535
    3636    if (image == NULL || image->data.V == NULL) {
     
    6868        return NULL;
    6969    }
    70     int numRows = row1-row0;
    71     int numCols = col1-col0;
     70    psS32 numRows = row1-row0;
     71    psS32 numCols = col1-col0;
    7272
    7373    elementSize = PSELEMTYPE_SIZEOF(image->type.type);
     
    8282
    8383    // increment the raw data buffer before freeing anything in the 'out'
    84     void* rawData = psMemIncrRefCounter(image->rawDataBuffer);
     84    psPtr rawData = psMemIncrRefCounter(image->rawDataBuffer);
    8585
    8686    if (out != NULL) {
     
    9797    }
    9898
    99     out->data.V = psRealloc(out->data.V,sizeof(void*)*numRows); // resize row pointer array
     99    out->data.V = psRealloc(out->data.V,sizeof(psPtr)*numRows); // resize row pointer array
    100100    *(psType*)&out->type = image->type;
    101     *(unsigned int*)&out->numCols = numCols;
    102     *(unsigned int*)&out->numRows = numRows;
    103     *(int*)&out->row0 = row0;
    104     *(int*)&out->col0 = col0;
     101    *(psU32*)&out->numCols = numCols;
     102    *(psU32*)&out->numRows = numRows;
     103    *(psS32*)&out->row0 = row0;
     104    *(psS32*)&out->col0 = col0;
    105105    out->parent = image;
    106106    out->children = NULL;
     
    111111
    112112    inputColOffset = elementSize * col0;
    113     for (int row = 0; row < numRows; row++) {
     113    for (psS32 row = 0; row < numRows; row++) {
    114114        out->data.V[row] = image->data.U8[row0 + row] + inputColOffset;
    115115    }
    116116
    117117    // add output image as a child of the input image.
    118     int n = 0;
     118    psS32 n = 0;
    119119    psArray* children = image->children;
    120120    if (children == NULL) {
     
    134134
    135135psImage* psImageSubset(psImage* image,
    136                        int col0,
    137                        int row0,
    138                        int col1,
    139                        int row1)
     136                       psS32 col0,
     137                       psS32 row0,
     138                       psS32 col1,
     139                       psS32 row1)
    140140{
    141141    return imageSubset(NULL,image,col0,row0,col1,row1);
     
    145145                           const char* section)
    146146{
    147     int col0;
    148     int col1;
    149     int row0;
    150     int row1;
     147    psS32 col0;
     148    psS32 col1;
     149    psS32 row0;
     150    psS32 row1;
    151151
    152152    // section should be of the form '[col0:col1,row0:row1]'
     
    177177}
    178178
    179 psImage* psImageTrim(psImage* image, int col0, int row0, int col1, int row1)
     179psImage* psImageTrim(psImage* image, psS32 col0, psS32 row0, psS32 col1, psS32 row1)
    180180{
    181181    if (image == NULL || image->data.V == NULL) {
     
    220220    psImageFreeChildren(image);
    221221
    222     unsigned int elementSize = PSELEMTYPE_SIZEOF(image->type.type);
    223     unsigned int numCols = col1-col0;
    224     unsigned int numRows = row1-row0;
    225     unsigned int rowSize = elementSize*numCols;
    226     unsigned int colOffset = elementSize * col0;
     222    psU32 elementSize = PSELEMTYPE_SIZEOF(image->type.type);
     223    psU32 numCols = col1-col0;
     224    psU32 numRows = row1-row0;
     225    psU32 rowSize = elementSize*numCols;
     226    psU32 colOffset = elementSize * col0;
    227227    psU8* imageData = image->rawDataBuffer;
    228     for (int row = row0; row < row1; row++) {
     228    for (psS32 row = row0; row < row1; row++) {
    229229        memmove(imageData,image->data.U8[row] + colOffset,rowSize);
    230230        imageData += rowSize;
    231231    }
    232232
    233     *(unsigned int*)&image->numRows = numRows;
    234     *(unsigned int*)&image->numCols = numCols;
     233    *(psU32*)&image->numRows = numRows;
     234    *(psU32*)&image->numCols = numCols;
    235235
    236236    // XXX: should I really resize the buffers?
    237     image->data.V = psRealloc(image->data.V,sizeof(void*)*numRows);
     237    image->data.V = psRealloc(image->data.V,sizeof(psPtr)*numRows);
    238238    image->rawDataBuffer = psRealloc(image->rawDataBuffer,rowSize*numRows);
    239239
    240240    image->data.V[0] = image->rawDataBuffer;
    241     for (int r = 1; r < numRows; r++) {
     241    for (psS32 r = 1; r < numRows; r++) {
    242242        image->data.U8[r] = image->data.U8[r-1] + rowSize;
    243243    }
     
    250250                       const psImage* restrict in,
    251251                       const psImage* restrict mask,
    252                        unsigned int maskVal,
    253                        int col0,
    254                        int row0,
    255                        int col1,
    256                        int row1,
     252                       psU32 maskVal,
     253                       psS32 col0,
     254                       psS32 row0,
     255                       psS32 col1,
     256                       psS32 row1,
    257257                       psImageCutDirection direction,
    258258                       const psStats* stats)
     
    261261    psStats* myStats;
    262262    psElemType type;
    263     int inRows;
    264     int inCols;
    265     int delta = 1;
     263    psS32 inRows;
     264    psS32 inCols;
     265    psS32 delta = 1;
    266266    psF64* outData;
    267267
     
    349349    *myStats = *stats;
    350350
    351     int numCols = col1-col0;
    352     int numRows = row1-row0;
     351    psS32 numCols = col1-col0;
     352    psS32 numRows = row1-row0;
    353353
    354354    if (direction == PS_CUT_X_POS || direction == PS_CUT_X_NEG) {
     
    380380    case PS_TYPE_##TYPE: { \
    381381            psMaskType* maskVecData = NULL; \
    382             for (int c=col0;c<col1;c++) { \
     382            for (psS32 c=col0;c<col1;c++) { \
    383383                ps##TYPE *imgData = in->data.TYPE[row0] + c; \
    384384                ps##TYPE *imgVecData = imgVec->data.TYPE; \
     
    387387                    maskData = (psMaskType* )(mask->data.V[row0]) + c; \
    388388                } \
    389                 for (int r=row0;r<row1;r++) { \
     389                for (psS32 r=row0;r<row1;r++) { \
    390390                    *(imgVecData++) = *imgData; \
    391391                    imgData += inCols; \
     
    437437        psVector* imgVec = NULL;
    438438        psVector* maskVec = NULL;
    439         int elementSize = PSELEMTYPE_SIZEOF(type);
     439        psS32 elementSize = PSELEMTYPE_SIZEOF(type);
    440440        psU32* outPosition = NULL;
    441441
     
    465465        }
    466466
    467         for (int r = row0; r < row1; r++) {
     467        for (psS32 r = row0; r < row1; r++) {
    468468            // point the vector struct to the
    469469            // data to calculate the stats
    470             imgVec->data.V = (void *)(in->data.U8[r] + col0 * elementSize);
     470            imgVec->data.V = (psPtr )(in->data.U8[r] + col0 * elementSize);
    471471            if (maskVec != NULL) {
    472                 maskVec->data.V = (void *)(mask->data.U8[r] + col0 * sizeof(psMaskType));
     472                maskVec->data.V = (psPtr )(mask->data.U8[r] + col0 * sizeof(psMaskType));
    473473            }
    474474            myStats = psVectorStats(myStats, imgVec, maskVec, maskVal);
     
    503503                     const psImage* in,
    504504                     const psImage* restrict mask,
    505                      unsigned int maskVal,
     505                     psU32 maskVal,
    506506                     float startCol,
    507507                     float startRow,
    508508                     float endCol,
    509509                     float endRow,
    510                      unsigned int nSamples,
     510                     psU32 nSamples,
    511511                     psImageInterpolateMode mode)
    512512{
     
    518518        return NULL;
    519519    }
    520     int numCols = in->numCols;
    521     int numRows = in->numRows;
     520    psS32 numCols = in->numCols;
     521    psS32 numRows = in->numRows;
    522522
    523523    if (nSamples < 2) {
     
    594594case PS_TYPE_##TYPE: { \
    595595        ps##TYPE* outData = out->data.TYPE; \
    596         for (int i = 0; i < nSamples; i++) { \
     596        for (psS32 i = 0; i < nSamples; i++) { \
    597597            float x = startCol + (float)i*dX; \
    598598            float y = startRow + (float)i*dY; \
     
    642642                           const psImage* in,
    643643                           const psImage* restrict mask,
    644                            unsigned int maskVal,
     644                           psU32 maskVal,
    645645                           float centerCol,
    646646                           float centerRow,
     
    659659        return NULL;
    660660    }
    661     int numCols = in->numCols;
    662     int numRows = in->numRows;
     661    psS32 numCols = in->numCols;
     662    psS32 numRows = in->numRows;
    663663
    664664    if (mask != NULL) {
     
    734734
    735735    // size the output vector to proper size.
    736     int numOut = radii->n - 1;
     736    psS32 numOut = radii->n - 1;
    737737    out = psVectorRecycle(out, numOut, PS_TYPE_F64);
    738738    psF64* outData = out->data.F64;
     
    741741    psF32* rSq = rSqVec->data.F32;
    742742
    743     int startRow = centerRow - rSq[numOut];
    744     int endRow = centerRow + rSq[numOut];
    745     int startCol = centerCol - rSq[numOut];
    746     int endCol = centerCol + rSq[numOut];
     743    psS32 startRow = centerRow - rSq[numOut];
     744    psS32 endRow = centerRow + rSq[numOut];
     745    psS32 startCol = centerCol - rSq[numOut];
     746    psS32 endCol = centerCol + rSq[numOut];
    747747
    748748    if (startRow < 0) {
     
    763763
    764764    // Square the radii data
    765     for (int d = 0; d <= numOut; d++) {
     765    for (psS32 d = 0; d <= numOut; d++) {
    766766        rSq[d] *= rSq[d];
    767767    }
     
    770770    psVector** buffer = psAlloc(sizeof(psVector*)*numOut);
    771771    psVector** bufferMask = psAlloc(sizeof(psVector*)*numOut);
    772     for (int lcv = 0; lcv < numOut; lcv++) {
     772    for (psS32 lcv = 0; lcv < numOut; lcv++) {
    773773        // n.b. alloc enough for the data by making the vectors slightly larger
    774774        // than the area of the region of interest.
     
    788788    float dY;
    789789    float dist;
    790     for (int row=startRow; row <= endRow; row++) {
     790    for (psS32 row=startRow; row <= endRow; row++) {
    791791        psF32* inRow = in->data.F32[row];
    792792        psMaskType* maskRow = NULL;
     
    794794            maskRow = mask->data.PS_TYPE_MASK_DATA[row];
    795795        }
    796         for (int col=startCol; col <= endCol; col++) {
     796        for (psS32 col=startCol; col <= endCol; col++) {
    797797            dX = centerCol - (float)col - 0.5f;
    798798            dY = centerRow - (float)row - 0.5f;
    799799            dist = dX*dX+dY*dY;
    800             for (int r = 0; r < numOut; r++) {
     800            for (psS32 r = 0; r < numOut; r++) {
    801801                if (rSq[r] < dist && dist < rSq[r+1]) {
    802                     int n = buffer[r]->n;
     802                    psS32 n = buffer[r]->n;
    803803                    if (n == buffer[r]->nalloc) { // in case buffers already full, expand
    804804                        buffer[r] = psVectorRealloc(buffer[r], n*2);
     
    825825    *myStats = *stats;
    826826
    827     for (int r = 0; r < numOut; r++) {
     827    for (psS32 r = 0; r < numOut; r++) {
    828828        myStats = psVectorStats(myStats,buffer[r], bufferMask[r],maskVal);
    829829        (void)p_psGetStatValue(myStats,&statVal);
     
    833833    psFree(myStats);
    834834
    835     for (int lcv = 0; lcv < numOut; lcv++) {
     835    for (psS32 lcv = 0; lcv < numOut; lcv++) {
    836836        psFree(buffer[lcv]);
    837837        psFree(bufferMask[lcv]);
  • trunk/psLib/src/image/psImageExtraction.h

    r2088 r2204  
    1010*  @author Robert DeSonia, MHPCC
    1111*
    12 *  @version $Revision: 1.18 $ $Name: not supported by cvs2svn $
    13 *  @date $Date: 2004-10-13 22:05:03 $
     12*  @version $Revision: 1.19 $ $Name: not supported by cvs2svn $
     13*  @date $Date: 2004-10-27 00:57:31 $
    1414*
    1515*  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    5454psImage* psImageSubset(
    5555    psImage* image,                    ///< Parent image.
    56     int col0,                          ///< starting column of subimage
    57     int row0,                          ///< starting row of subimage
    58     int col1,                          ///< exclusive end column of subimage.
    59     int row1                           ///< exclusive end row of subimage
     56    psS32 col0,                          ///< starting column of subimage
     57    psS32 row0,                          ///< starting row of subimage
     58    psS32 col1,                          ///< exclusive end column of subimage.
     59    psS32 row1                           ///< exclusive end row of subimage
    6060);
    6161
     
    9393psImage* psImageTrim(
    9494    psImage* image,                    ///< image to trim
    95     int col0,                          ///< column of trim region's left boundary
    96     int row0,                          ///< row of trim region's lower boundary
    97     int col1,                          ///< column of trim region's right boundary
    98     int row1                           ///< row of trim region's upper boundary
     95    psS32 col0,                          ///< column of trim region's left boundary
     96    psS32 row0,                          ///< row of trim region's lower boundary
     97    psS32 col1,                          ///< column of trim region's right boundary
     98    psS32 row1                           ///< row of trim region's upper boundary
    9999);
    100100
     
    130130    const psImage* restrict input,     ///< the input image in which to perform the slice
    131131    const psImage* restrict mask,      ///< the mask for the input image.
    132     unsigned int maskVal,              ///< the mask value to apply to the mask
    133     int col0,                          ///< the leftmost column of the slice region
    134     int row0,                          ///< the bottommost row of the slice region
    135     int col1,                          ///< exclusive end column of the slice region
    136     int row1,                           ///< exclusive end row of the slice region
     132    psU32 maskVal,              ///< the mask value to apply to the mask
     133    psS32 col0,                          ///< the leftmost column of the slice region
     134    psS32 row0,                          ///< the bottommost row of the slice region
     135    psS32 col1,                          ///< exclusive end column of the slice region
     136    psS32 row1,                           ///< exclusive end row of the slice region
    137137    psImageCutDirection direction,     ///< the slice dimension and direction
    138138    const psStats* stats               ///< the statistic to perform in slice operation
     
    161161    const psImage* input,              ///< the input image in which to perform the cut
    162162    const psImage* restrict mask,      ///< the mask for the input image.
    163     unsigned int maskVal,              ///< the mask value to apply to the mask
     163    psU32 maskVal,              ///< the mask value to apply to the mask
    164164    float startCol,                    ///< the column of the start of the cut line
    165165    float startRow,                    ///< the row of the start of the cut line
    166166    float endCol,                      ///< the column of the end of the cut line
    167167    float endRow,                      ///< the row of the end of the cut line
    168     unsigned int nSamples,             ///< the number of samples along the cut
     168    psU32 nSamples,             ///< the number of samples along the cut
    169169    psImageInterpolateMode mode        ///< the interpolation method to use
    170170);
     
    187187    const psImage* input,              ///< the input image in which to perform the cut
    188188    const psImage* restrict mask,      ///< the mask for the input image.
    189     unsigned int maskVal,              ///< the mask value to apply to the mask
     189    psU32 maskVal,              ///< the mask value to apply to the mask
    190190    float centerCol,                   ///< the column of the center of the cut circle
    191191    float centerRow,                   ///< the row of the center of the cut circle
  • trunk/psLib/src/image/psImageFFT.c

    r1983 r2204  
    55 *  @author Robert DeSonia, MHPCC
    66 *
    7  *  @version $Revision: 1.4 $ $Name: not supported by cvs2svn $
    8  *  @date $Date: 2004-10-06 21:31:30 $
     7 *  @version $Revision: 1.5 $ $Name: not supported by cvs2svn $
     8 *  @date $Date: 2004-10-27 00:57:31 $
    99 *
    1010 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
    1111 */
    1212#include <unistd.h>
    13 #include <stdbool.h>
    1413#include <string.h>
    1514#include <complex.h>
     
    2726#define PS_FFTW_PLAN_RIGOR FFTW_ESTIMATE
    2827
    29 static bool p_fftwWisdomImported = false;
     28static psBool p_fftwWisdomImported = false;
    3029
    3130psImage* psImageFFT(psImage* out, const psImage* in, psFftDirection direction)
    3231{
    33     unsigned int numCols;
    34     unsigned int numRows;
     32    psU32 numCols;
     33    psU32 numRows;
    3534    psElemType type;
    3635    fftwf_plan plan;
     
    7776
    7877    // n.b. FFTW can perform a in-place transform at the same rate or faster than out-of-place.
    79     int sign = ((direction & PS_FFT_FORWARD) != 0) ? FFTW_FORWARD : FFTW_BACKWARD;
     78    psS32 sign = ((direction & PS_FFT_FORWARD) != 0) ? FFTW_FORWARD : FFTW_BACKWARD;
    8079    out = psImageCopy(out, in, PS_TYPE_C32);
    8180    plan = fftwf_plan_dft_2d(numCols, numRows,
     
    118117{
    119118    psElemType type;
    120     unsigned int numCols;
    121     unsigned int numRows;
     119    psU32 numCols;
     120    psU32 numRows;
    122121
    123122    if (in == NULL) {
     
    140139
    141140        out = psImageRecycle(out, numCols, numRows, PS_TYPE_F32);
    142         for (unsigned int row = 0; row < numRows; row++) {
     141        for (psU32 row = 0; row < numRows; row++) {
    143142            outRow = out->data.F32[row];
    144143            inRow = in->data.C32[row];
    145144
    146             for (unsigned int col = 0; col < numCols; col++) {
     145            for (psU32 col = 0; col < numCols; col++) {
    147146                outRow[col] = crealf(inRow[col]);
    148147            }
     
    153152
    154153        out = psImageRecycle(out, numCols, numRows, PS_TYPE_F64);
    155         for (unsigned int row = 0; row < numRows; row++) {
     154        for (psU32 row = 0; row < numRows; row++) {
    156155            outRow = out->data.F64[row];
    157156            inRow = in->data.C64[row];
    158157
    159             for (unsigned int col = 0; col < numCols; col++) {
     158            for (psU32 col = 0; col < numCols; col++) {
    160159                outRow[col] = creal(inRow[col]);
    161160            }
     
    179178{
    180179    psElemType type;
    181     unsigned int numCols;
    182     unsigned int numRows;
     180    psU32 numCols;
     181    psU32 numRows;
    183182
    184183    if (in == NULL) {
     
    203202
    204203        out = psImageRecycle(out, numCols, numRows, PS_TYPE_F32);
    205         for (unsigned int row = 0; row < numRows; row++) {
     204        for (psU32 row = 0; row < numRows; row++) {
    206205            outRow = out->data.F32[row];
    207206            inRow = in->data.C32[row];
    208207
    209             for (unsigned int col = 0; col < numCols; col++) {
     208            for (psU32 col = 0; col < numCols; col++) {
    210209                outRow[col] = cimagf(inRow[col]);
    211210            }
     
    216215
    217216        out = psImageRecycle(out, numCols, numRows, PS_TYPE_F64);
    218         for (unsigned int row = 0; row < numRows; row++) {
     217        for (psU32 row = 0; row < numRows; row++) {
    219218            outRow = out->data.F64[row];
    220219            inRow = in->data.C64[row];
    221220
    222             for (unsigned int col = 0; col < numCols; col++) {
     221            for (psU32 col = 0; col < numCols; col++) {
    223222                outRow[col] = cimag(inRow[col]);
    224223            }
     
    241240{
    242241    psElemType type;
    243     unsigned int numCols;
    244     unsigned int numRows;
     242    psU32 numCols;
     243    psU32 numRows;
    245244
    246245    if (real == NULL || imag == NULL) {
     
    282281        out = psImageRecycle(out, numCols, numRows, PS_TYPE_C32);
    283282
    284         for (unsigned int row = 0; row < numRows; row++) {
     283        for (psU32 row = 0; row < numRows; row++) {
    285284            outRow = out->data.C32[row];
    286285            realRow = real->data.F32[row];
    287286            imagRow = imag->data.F32[row];
    288287
    289             for (unsigned int col = 0; col < numCols; col++) {
     288            for (psU32 col = 0; col < numCols; col++) {
    290289                outRow[col] = realRow[col] + I * imagRow[col];
    291290            }
     
    297296
    298297        out = psImageRecycle(out, numCols, numRows, PS_TYPE_C64);
    299         for (unsigned int row = 0; row < numRows; row++) {
     298        for (psU32 row = 0; row < numRows; row++) {
    300299            outRow = out->data.C64[row];
    301300            realRow = real->data.F64[row];
    302301            imagRow = imag->data.F64[row];
    303302
    304             for (unsigned int col = 0; col < numCols; col++) {
     303            for (psU32 col = 0; col < numCols; col++) {
    305304                outRow[col] = realRow[col] + I * imagRow[col];
    306305            }
     
    324323{
    325324    psElemType type;
    326     unsigned int numCols;
    327     unsigned int numRows;
     325    psU32 numCols;
     326    psU32 numRows;
    328327
    329328    if (in == NULL) {
     
    346345
    347346        out = psImageRecycle(out, numCols, numRows, PS_TYPE_C32);
    348         for (unsigned int row = 0; row < numRows; row++) {
     347        for (psU32 row = 0; row < numRows; row++) {
    349348            outRow = out->data.C32[row];
    350349            inRow = in->data.C32[row];
    351350
    352             for (unsigned int col = 0; col < numCols; col++) {
     351            for (psU32 col = 0; col < numCols; col++) {
    353352                outRow[col] = crealf(inRow[col]) - I * cimagf(inRow[col]);
    354353            }
     
    359358
    360359        out = psImageRecycle(out, numCols, numRows, PS_TYPE_C64);
    361         for (unsigned int row = 0; row < numRows; row++) {
     360        for (psU32 row = 0; row < numRows; row++) {
    362361            outRow = out->data.C64[row];
    363362            inRow = in->data.C64[row];
    364363
    365             for (unsigned int col = 0; col < numCols; col++) {
     364            for (psU32 col = 0; col < numCols; col++) {
    366365                outRow[col] = creal(inRow[col]) - I * cimag(inRow[col]);
    367366            }
     
    384383{
    385384    psElemType type;
    386     unsigned int numCols;
    387     unsigned int numRows;
    388     int numElementsSquared;
     385    psU32 numCols;
     386    psU32 numRows;
     387    psS32 numElementsSquared;
    389388
    390389    if (in == NULL) {
     
    405404
    406405        out = psImageRecycle(out, numCols, numRows, PS_TYPE_F32);
    407         for (unsigned int row = 0; row < numRows; row++) {
     406        for (psU32 row = 0; row < numRows; row++) {
    408407            outRow = out->data.F32[row];
    409408            inRow = in->data.C32[row];
    410409
    411             for (unsigned int col = 0; col < numCols; col++) {
     410            for (psU32 col = 0; col < numCols; col++) {
    412411                real = crealf(inRow[col]);
    413412                imag = cimagf(inRow[col]);
     
    422421
    423422        out = psImageRecycle(out, numCols, numRows, PS_TYPE_F64);
    424         for (unsigned int row = 0; row < numRows; row++) {
     423        for (psU32 row = 0; row < numRows; row++) {
    425424            outRow = out->data.F64[row];
    426425            inRow = in->data.C64[row];
    427426
    428             for (unsigned int col = 0; col < numCols; col++) {
     427            for (psU32 col = 0; col < numCols; col++) {
    429428                real = creal(inRow[col]);
    430429                imag = cimag(inRow[col]);
  • trunk/psLib/src/image/psImageIO.c

    r1941 r2204  
    77 *  @author Robert DeSonia, MHPCC
    88 *
    9  *  @version $Revision: 1.12 $ $Name: not supported by cvs2svn $
    10  *  @date $Date: 2004-10-02 02:08:00 $
     9 *  @version $Revision: 1.13 $ $Name: not supported by cvs2svn $
     10 *  @date $Date: 2004-10-27 00:57:31 $
    1111 *
    1212 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    1515#include <fitsio.h>
    1616#include <unistd.h>
    17 #include <stdbool.h>
    1817
    1918#include "psImageIO.h"
     
    2423
    2524psImage* psImageReadSection(psImage* output,
    26                             int col,
    27                             int row,
    28                             int numCols,
    29                             int numRows,
    30                             int z,
     25                            psS32 col,
     26                            psS32 row,
     27                            psS32 numCols,
     28                            psS32 numRows,
     29                            psS32 z,
    3130                            char *extname,
    32                             int extnum,
     31                            psS32 extnum,
    3332                            char *filename)
    3433{
    3534    fitsfile *fptr = NULL;      /* Pointer to the FITS file */
    36     int status = 0;             /* CFITSIO file vars */
    37     int nAxis = 0;
    38     int anynull = 0;
    39     int bitPix = 0;             /* Pixel type */
    40     long nAxes[3];
    41     long firstPixel[3];         /* lower-left corner of image subset */
    42     long lastPixel[3];          /* upper-right corner of image subset */
    43     long increment[3];          /* increment for image subset */
     35    psS32 status = 0;             /* CFITSIO file vars */
     36    psS32 nAxis = 0;
     37    psS32 anynull = 0;
     38    psS32 bitPix = 0;             /* Pixel type */
     39    psS64 nAxes[3];
     40    psS64 firstPixel[3];         /* lower-left corner of image subset */
     41    psS64 lastPixel[3];          /* upper-right corner of image subset */
     42    psS64 increment[3];          /* increment for image subset */
    4443    char fitsErr[80] = "";      /* CFITSIO error message string */
    45     int hduType = IMAGE_HDU;
    46     int fitsDatatype = 0;
    47     int datatype = 0;
     44    psS32 hduType = IMAGE_HDU;
     45    psS32 fitsDatatype = 0;
     46    psS32 datatype = 0;
    4847
    4948    if (filename == NULL) {
     
    228227}
    229228
    230 bool psImageWriteSection(psImage* input,
    231                          int col0,
    232                          int row0,
    233                          int z,
    234                          char *extname,
    235                          int extnum,
    236                          char *filename)
     229psBool psImageWriteSection(psImage* input,
     230                           psS32 col0,
     231                           psS32 row0,
     232                           psS32 z,
     233                           char *extname,
     234                           psS32 extnum,
     235                           char *filename)
    237236{
    238     int numCols = 0;
    239     int numRows = 0;
    240 
    241     int status = 0;             /* CFITSIO status */
     237    psS32 numCols = 0;
     238    psS32 numRows = 0;
     239
     240    psS32 status = 0;             /* CFITSIO status */
    242241    fitsfile *fptr = NULL;      /* pointer to the FITS file */
    243     long nAxes[3];              /* Image axis vars */
    244     long firstPixel[3];         /* First Pixel to read */
    245     long lastPixel[3];          /* Last Pixel to read */
     242    psS64 nAxes[3];              /* Image axis vars */
     243    psS64 firstPixel[3];         /* First Pixel to read */
     244    psS64 lastPixel[3];          /* Last Pixel to read */
    246245    char fitsErr[80];           /* FITSIO message string */
    247     int datatype = 0;           /* the datatype of the image */
    248     int bitPix = 0;             /* FITS bitPix value */
    249     int hduType = IMAGE_HDU;    /* the HDU type (image,table, etc.) */
     246    psS32 datatype = 0;           /* the datatype of the image */
     247    psS32 bitPix = 0;             /* FITS bitPix value */
     248    psS32 hduType = IMAGE_HDU;    /* the HDU type (image,table, etc.) */
    250249    double bscale = 1.0;
    251250    double bzero = 0.0;
    252     bool createNewHDU = false;
     251    psBool createNewHDU = false;
    253252
    254253    /* need a valid image to write */
     
    336335            }
    337336        } else {
    338             int numHDUs = 0;
     337            psS32 numHDUs = 0;
    339338
    340339            fits_get_num_hdus(fptr, &numHDUs, &status);
  • trunk/psLib/src/image/psImageIO.h

    r1442 r2204  
    1010 *  @author Robert DeSonia, MHPCC
    1111 *
    12  *  @version $Revision: 1.7 $ $Name: not supported by cvs2svn $
    13  *  @date $Date: 2004-08-10 01:05:53 $
     12 *  @version $Revision: 1.8 $ $Name: not supported by cvs2svn $
     13 *  @date $Date: 2004-10-27 00:57:31 $
    1414 *
    1515 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    1717#ifndef PS_IMAGEIO_H
    1818#define PS_IMAGEIO_H
    19 
    20 #include <stdbool.h>
    2119
    2220#include "psImage.h"
     
    3432    /**< the output psImage to recycle, or NULL if new psImage desired */
    3533
    36     int col0,
     34    psS32 col0,
    3735    /**< the column index of the origin to start reading */
    3836
    39     int row0,
     37    psS32 row0,
    4038    /**< the row index of the origin to start reading */
    4139
    42     int numCols,
     40    psS32 numCols,
    4341    /**< the number of desired columns to read */
    4442
    45     int numRows,
     43    psS32 numRows,
    4644    /**< the number of desired rows to read */
    4745
    48     int z,
     46    psS32 z,
    4947    /**< the z index to read if file is organized as a 3D image cube. */
    5048
     
    5452        */
    5553
    56     int extnum,
     54    psS32 extnum,
    5755    /**< the image extension to read (0=PHU, 1=first extension, etc.)  This is
    5856        *   only used if extname is NULL
     
    6563/** Read an image or subimage from a FITS file specified by a filename.
    6664 *
    67  *  return bool         TRUE is successful, otherwise FALSE.
     65 *  return psBool         TRUE is successful, otherwise FALSE.
    6866 */
    69 bool psImageWriteSection(
     67psBool psImageWriteSection(
    7068    psImage* input,
    7169    /**< the psImage to write */
    7270
    73     int col0,
     71    psS32 col0,
    7472    /**< the column index of the origin to start writing */
    7573
    76     int row0,
     74    psS32 row0,
    7775    /**< the row index of the origin to start writing */
    7876
    79     int z,
     77    psS32 z,
    8078    /**< the z index to start writing */
    8179
     
    8583    */
    8684
    87     int extnum,
     85    psS32 extnum,
    8886    /**< the image extension to write (0=PHU, 1=first extension, etc.)  This is
    8987    *   only used if extname is NULL.
  • trunk/psLib/src/image/psImageManip.c

    r2105 r2204  
    1010 *  @author Ross Harman, MHPCC
    1111 *
    12  *  @version $Revision: 1.28 $ $Name: not supported by cvs2svn $
    13  *  @date $Date: 2004-10-14 01:22:59 $
     12 *  @version $Revision: 1.29 $ $Name: not supported by cvs2svn $
     13 *  @date $Date: 2004-10-27 00:57:31 $
    1414 *
    1515 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    1818#include <math.h>                          // for isfinite(), etc.
    1919#include <stdlib.h>
    20 #include <stdbool.h>
    2120#include <string.h>                        // for memcpy, etc.
    2221
     
    2928#include "psImageErrors.h"
    3029
    31 int psImageClip(psImage* input,
    32                 psF64 min,
    33                 psF64 vmin,
    34                 psF64 max,
    35                 psF64 vmax)
     30psS32 psImageClip(psImage* input,
     31                  psF64 min,
     32                  psF64 vmin,
     33                  psF64 max,
     34                  psF64 vmax)
    3635{
    37     int numClipped = 0;
    38     unsigned int numRows;
    39     unsigned int numCols;
     36    psS32 numClipped = 0;
     37    psU32 numRows;
     38    psU32 numCols;
    4039
    4140    if (input == NULL) {
     
    7271                           (psF64)PS_MIN_##type,(psF64)PS_MAX_##type); \
    7372            } \
    74             for (unsigned int row = 0;row<numRows;row++) { \
     73            for (psU32 row = 0;row<numRows;row++) { \
    7574                ps##type* inputRow = input->data.type[row]; \
    76                 for (unsigned int col = 0; col < numCols; col++) { \
     75                for (psU32 col = 0; col < numCols; col++) { \
    7776                    if ((psF64)inputRow[col] < min) { \
    7877                        inputRow[col] = (ps##type)vmin; \
     
    103102                           (psF64)PS_MIN_##type,(psF64)PS_MAX_##type); \
    104103            } \
    105             for (unsigned int row = 0;row<numRows;row++) { \
     104            for (psU32 row = 0;row<numRows;row++) { \
    106105                ps##type* inputRow = input->data.type[row]; \
    107                 for (unsigned int col = 0; col < numCols; col++) { \
     106                for (psU32 col = 0; col < numCols; col++) { \
    108107                    if (absfcn(inputRow[col]) < min) { \
    109108                        inputRow[col] = (ps##type)vmin; \
     
    144143}
    145144
    146 int psImageClipNaN(psImage* input,
    147                    psF64 value)
     145psS32 psImageClipNaN(psImage* input,
     146                     psF64 value)
    148147{
    149     int numClipped = 0;
    150     unsigned int numRows;
    151     unsigned int numCols;
     148    psS32 numClipped = 0;
     149    psU32 numRows;
     150    psU32 numCols;
    152151
    153152    if (input == NULL) {
     
    161160        #define psImageClipNaNCase(type) \
    162161    case PS_TYPE_##type: \
    163         for (unsigned int row = 0;row<numRows;row++) { \
     162        for (psU32 row = 0;row<numRows;row++) { \
    164163            ps##type* inputRow = input->data.type[row]; \
    165             for (unsigned int col = 0; col < numCols; col++) { \
     164            for (psU32 col = 0; col < numCols; col++) { \
    166165                if (! isfinite(inputRow[col])) { \
    167166                    inputRow[col] = (ps##type)value; \
     
    190189}
    191190
    192 int psImageOverlaySection(psImage* image,
    193                           const psImage* overlay,
    194                           int col0,
    195                           int row0,
    196                           const char *op)
     191psS32 psImageOverlaySection(psImage* image,
     192                            const psImage* overlay,
     193                            psS32 col0,
     194                            psS32 row0,
     195                            const char *op)
    197196{
    198     unsigned int imageNumRows;
    199     unsigned int imageNumCols;
    200     unsigned int overlayNumRows;
    201     unsigned int overlayNumCols;
    202     unsigned int imageRowLimit;
    203     unsigned int imageColLimit;
     197    psU32 imageNumRows;
     198    psU32 imageNumCols;
     199    psU32 overlayNumRows;
     200    psU32 overlayNumCols;
     201    psU32 imageRowLimit;
     202    psU32 imageColLimit;
    204203    psElemType type;
    205204
     
    257256        #define psImageOverlayCase(DATATYPE) \
    258257    case PS_TYPE_##DATATYPE: \
    259         for (unsigned int row=row0;row<imageRowLimit;row++) { \
     258        for (psU32 row=row0;row<imageRowLimit;row++) { \
    260259            ps##DATATYPE* imageRow = image->data.DATATYPE[row]; \
    261260            ps##DATATYPE* overlayRow = overlay->data.DATATYPE[row-row0]; \
    262             for (unsigned int col=col0;col<imageColLimit;col++) { \
     261            for (psU32 col=col0;col<imageColLimit;col++) { \
    263262                switch (*op) { \
    264263                case '+': \
     
    315314}
    316315
    317 int psImageClipComplexRegion(psImage* input,
    318                              psC64 min,
    319                              psC64 vmin,
    320                              psC64 max,
    321                              psC64 vmax)
     316psS32 psImageClipComplexRegion(psImage* input,
     317                               psC64 min,
     318                               psC64 vmin,
     319                               psC64 max,
     320                               psC64 vmax)
    322321{
    323     int numClipped = 0;
    324     unsigned int numRows;
    325     unsigned int numCols;
     322    psS32 numClipped = 0;
     323    psU32 numRows;
     324    psU32 numCols;
    326325    psF64 realMin = creal(min);
    327326    psF64 imagMin = cimag(min);
     
    374373            break; \
    375374        } \
    376         for (unsigned int row = 0;row<numRows;row++) { \
     375        for (psU32 row = 0;row<numRows;row++) { \
    377376            ps##type* inputRow = input->data.type[row]; \
    378             for (unsigned int col = 0; col < numCols; col++) { \
     377            for (psU32 col = 0; col < numCols; col++) { \
    379378                if ( (realfcn(inputRow[col]) > realMax) || (imagfcn(inputRow[col]) > imagMax) ) { \
    380379                    inputRow[col] = (ps##type)vmax; \
     
    411410                      const psImage* restrict mask,
    412411                      psMaskType maskVal,
    413                       unsigned int scale,
     412                      psU32 scale,
    414413                      const psStats* stats)
    415414{
    416     int inRows;
    417     int inCols;
    418     int outRows;
    419     int outCols;
     415    psS32 inRows;
     416    psS32 inCols;
     417    psS32 outRows;
     418    psS32 outCols;
    420419    psVector* vec;                     // vector to hold the values of a single bin.
    421420    psVector* maskVec = NULL;          // vector to hold the mask of a single bin.
     
    491490        ps##type* vecData = vec->data.type; \
    492491        psMaskType* inRowMask = NULL; \
    493         for (int row = 0; row < outRows; row++) { \
     492        for (psS32 row = 0; row < outRows; row++) { \
    494493            outRowData = out->data.type[row]; \
    495             int inCurrentRow = row*scale; \
    496             int inNextRow = (row+1)*scale; \
    497             for (int col = 0; col < outCols; col++) { \
    498                 int inCurrentCol = col*scale; \
    499                 int inNextCol = (col+1)*scale; \
    500                 int n = 0; \
    501                 for (int inRow = inCurrentRow; inRow < inNextRow && inRow < inRows; inRow++) { \
     494            psS32 inCurrentRow = row*scale; \
     495            psS32 inNextRow = (row+1)*scale; \
     496            for (psS32 col = 0; col < outCols; col++) { \
     497                psS32 inCurrentCol = col*scale; \
     498                psS32 inNextCol = (col+1)*scale; \
     499                psS32 n = 0; \
     500                for (psS32 inRow = inCurrentRow; inRow < inNextRow && inRow < inRows; inRow++) { \
    502501                    ps##type* inRowData = in->data.type[inRow]; \
    503502                    if (mask != NULL) { \
    504503                        inRowMask = mask->data.PS_TYPE_MASK_DATA[inRow]; \
    505504                    } \
    506                     for (int inCol = inCurrentCol; inCol < inNextCol && inCol < inCols; inCol++) { \
     505                    for (psS32 inCol = inCurrentCol; inCol < inNextCol && inCol < inCols; inCol++) { \
    507506                        if (maskData != NULL) { \
    508507                            maskData[n] = inRowMask[inCol]; \
     
    555554psImage* psImageResample(psImage* out,
    556555                         const psImage* in,
    557                          int scale,
     556                         psS32 scale,
    558557                         psImageInterpolateMode mode)
    559558{
    560     int outRows;
    561     int outCols;
     559    psS32 outRows;
     560    psS32 outCols;
    562561    float invScale;
    563562
     
    597596case PS_TYPE_##TYPE: { \
    598597        out = psImageRecycle(out,outCols, outRows, PS_TYPE_##TYPE); \
    599         for (int row=0;row<outRows;row++) { \
     598        for (psS32 row=0;row<outRows;row++) { \
    600599            ps##TYPE* rowData = out->data.TYPE[row]; \
    601600            float inRow = (float)row * invScale; \
    602             for (int col=0;col<outCols;col++) { \
     601            for (psS32 col=0;col<outCols;col++) { \
    603602                rowData[col] = psImagePixelInterpolate(in,(float)col*invScale,inRow,NULL,0,0,mode); \
    604603            } \
     
    637636psImage* psImageRoll(psImage* out,
    638637                     const psImage* in,
    639                      int dx,
    640                      int dy)
     638                     psS32 dx,
     639                     psS32 dy)
    641640{
    642     int outRows;
    643     int outCols;
    644     int elementSize;
     641    psS32 outRows;
     642    psS32 outCols;
     643    psS32 elementSize;
    645644
    646645    if (in == NULL) {
     
    669668    }
    670669
    671     int segment1Size = elementSize * (outCols - dx);
    672     int segment2Size = elementSize * dx;
    673 
    674     for (int row = 0; row < outRows; row++) {
    675         int inRowNumber = row + dy;
     670    psS32 segment1Size = elementSize * (outCols - dx);
     671    psS32 segment2Size = elementSize * dx;
     672
     673    for (psS32 row = 0; row < outRows; row++) {
     674        psS32 inRowNumber = row + dy;
    676675
    677676        if (inRowNumber >= outRows) {
     
    706705    if (fabsf(angle - 90.0f) < FLT_EPSILON) {
    707706        // perform 1/4 rotate counter-clockwise
    708         int numRows = in->numCols;
    709         int numCols = in->numRows;
    710         int lastCol = numCols - 1;
     707        psS32 numRows = in->numCols;
     708        psS32 numCols = in->numRows;
     709        psS32 lastCol = numCols - 1;
    711710        psElemType type = in->type.type;
    712711
     
    716715    case PS_TYPE_##TYPE: { \
    717716            ps##TYPE** inData = in->data.TYPE; \
    718             for (int row=0;row<numRows;row++) { \
     717            for (psS32 row=0;row<numRows;row++) { \
    719718                ps##TYPE* outRow = out->data.TYPE[row]; \
    720                 for (int col=0;col<numCols;col++) { \
     719                for (psS32 col=0;col<numCols;col++) { \
    721720                    outRow[col] = inData[lastCol-col][row]; \
    722721                } \
     
    752751    } else if (fabsf(angle - 180.0f) < FLT_EPSILON) {
    753752        // perform 1/2 rotate
    754         int numRows = in->numRows;
    755         int lastRow = numRows - 1;
    756         int numCols = in->numCols;
    757         int lastCol = numCols - 1;
     753        psS32 numRows = in->numRows;
     754        psS32 lastRow = numRows - 1;
     755        psS32 numCols = in->numCols;
     756        psS32 lastCol = numCols - 1;
    758757        psElemType type = in->type.type;
    759758
     
    762761        #define PSIMAGE_ROTATE_180_CASE(TYPE) \
    763762    case PS_TYPE_##TYPE: { \
    764             for (int row=0;row<numRows;row++) { \
     763            for (psS32 row=0;row<numRows;row++) { \
    765764                ps##TYPE* outRow = out->data.TYPE[row]; \
    766765                ps##TYPE* inRow = in->data.TYPE[lastRow-row]; \
    767                 for (int col=0;col<numCols;col++) { \
     766                for (psS32 col=0;col<numCols;col++) { \
    768767                    outRow[col] = inRow[lastCol - col]; \
    769768                } \
     
    799798    } else if (fabsf(angle - 270.0f) < FLT_EPSILON) {
    800799        // perform 1/4 rotate clockwise
    801         int numRows = in->numCols;
    802         int lastRow = numRows - 1;
    803         int numCols = in->numRows;
     800        psS32 numRows = in->numCols;
     801        psS32 lastRow = numRows - 1;
     802        psS32 numCols = in->numRows;
    804803        psElemType type = in->type.type;
    805804
     
    809808    case PS_TYPE_##TYPE: { \
    810809            ps##TYPE** inData = in->data.TYPE; \
    811             for (int row=0;row<numRows;row++) { \
     810            for (psS32 row=0;row<numRows;row++) { \
    812811                ps##TYPE* outRow = out->data.TYPE[row]; \
    813                 for (int col=0;col<numCols;col++) { \
     812                for (psS32 col=0;col<numCols;col++) { \
    814813                    outRow[col] = inData[col][lastRow-row]; \
    815814                } \
     
    847846    } else {
    848847        psElemType type = in->type.type;
    849         int numRows = in->numRows;
    850         int numCols = in->numCols;
     848        psS32 numRows = in->numRows;
     849        psS32 numCols = in->numCols;
    851850        float centerX = (float)(numCols) / 2.0f;
    852851        float centerY = (float)(numRows) / 2.0f;
     
    859858        // y' = y cos(t) - x sin(t); i.e. y' = (y-centerY)*cosT - (x-centerX)*sinT;
    860859
    861         int outCols = ceil(abs(numCols * cosT) + abs(numRows * sinT)) + 1;
    862         int outRows = ceil(abs(numCols * sinT) + abs(numRows * cosT)) + 1;
     860        psS32 outCols = ceil(abs(numCols * cosT) + abs(numRows * sinT)) + 1;
     861        psS32 outRows = ceil(abs(numCols * sinT) + abs(numRows * cosT)) + 1;
    863862        float minX = (float)outCols / -2.0f;
    864         int intMinY = outRows / -2;
     863        psS32 intMinY = outRows / -2;
    865864
    866865        out = psImageRecycle(out, outCols, outRows, type);
     
    906905            float inY; \
    907906            ps##TYPE* outRow; \
    908             for (int y = 0; y < outRows; y++) { \
     907            for (psS32 y = 0; y < outRows; y++) { \
    909908                inX = minXTimesCosTPlusCenterX + (y+intMinY) * sinT; \
    910909                inY = CenterYMinusminXTimesSinT + (y+intMinY) * cosT; \
    911910                outRow = out->data.TYPE[y]; \
    912                 for (int x = 0; x < outCols; x++) { \
     911                for (psS32 x = 0; x < outCols; x++) { \
    913912                    outRow[x] = p_psImagePixelInterpolate##MODE##_##TYPE(in,inX,inY,NULL,0,unexposedValue); \
    914913                    inX += cosT; \
     
    993992                      psImageInterpolateMode mode)
    994993{
    995     int outRows;
    996     int outCols;
    997     int elementSize;
     994    psS32 outRows;
     995    psS32 outCols;
     996    psS32 elementSize;
    998997    psElemType type;
    999998
     
    10301029        break; \
    10311030    } \
    1032     for (int row=0;row<outRows;row++) { \
     1031    for (psS32 row=0;row<outRows;row++) { \
    10331032        ps##TYPE* outRow = out->data.TYPE[row]; \
    10341033        float y = dy+(float)row; \
    1035         for (int col=0;col<outCols;col++) { \
     1034        for (psS32 col=0;col<outCols;col++) { \
    10361035            outRow[col] = p_psImagePixelInterpolate##MODE##_##TYPE( \
    10371036                          in,dx+(float)col,y,NULL,0,unexposedValue); \
  • trunk/psLib/src/image/psImageManip.h

    r1635 r2204  
    1111 *  @author Ross Harman, MHPCC
    1212 *
    13  *  @version $Revision: 1.13 $ $Name: not supported by cvs2svn $
    14  *  @date $Date: 2004-08-27 19:49:54 $
     13 *  @version $Revision: 1.14 $ $Name: not supported by cvs2svn $
     14 *  @date $Date: 2004-10-27 00:57:31 $
    1515 *
    1616 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    3030 *  defined for psU8, psU16, psS8, psS16, psF32, psF64, psC32, and psC64.
    3131 *
    32  *  @return int     The number of clipped pixels
     32 *  @return psS32     The number of clipped pixels
    3333 */
    34 int psImageClip(
     34psS32 psImageClip(
    3535    psImage* input,                    ///< the image to clip
    3636    psF64 min,                         ///< the minimum image value allowed
     
    4747 *  This function is defined for psC32, and psC64 imagery only.
    4848 *
    49  *  @return int     The number of clipped pixels
     49 *  @return psS32     The number of clipped pixels
    5050 */
    51 int psImageClipComplexRegion(
     51psS32 psImageClipComplexRegion(
    5252    psImage* input,                    ///< the image to clip
    5353    psC64 min,                         ///< the minimum image value allowed
     
    6262 *  function is defined for psF32, psF64, psC32, and psC64.
    6363 *
    64  *  @return int     The number of clipped pixels
     64 *  @return psS32     The number of clipped pixels
    6565 */
    66 int psImageClipNaN(
     66psS32 psImageClipNaN(
    6767    psImage* input,                    ///< the image to clip
    6868    psF64 value                        ///< the value to set all NaN/Inf values to
     
    7878 *  function is defined for psU8, psS8, psS16, psF32, psF64, psC32, and psC64.
    7979 *
    80  *  @return int         0 if success, non-zero if failed.
     80 *  @return psS32         0 if success, non-zero if failed.
    8181 */
    82 int psImageOverlaySection(
     82psS32 psImageOverlaySection(
    8383    psImage* image,                    ///< target image
    8484    const psImage* overlay,            ///< the overlay image
    85     int col0,                          ///< the column to start overlay
    86     int row0,                          ///< the row to start overlay
     85    psS32 col0,                          ///< the column to start overlay
     86    psS32 row0,                          ///< the row to start overlay
    8787    const char *op                     ///< the operation to perform for overlay
    8888);
     
    103103    const psImage* restrict mask,      ///< mask for input image.  If NULL, no masking is done.
    104104    psMaskType maskVal,                ///< the bits to check in mask.
    105     unsigned int scale,                ///< the scale to rebin for each dimension
     105    psU32 scale,                ///< the scale to rebin for each dimension
    106106    const psStats* stats
    107107    ///< the statistic to perform when rebinning.  Only one method should be set.
     
    121121    psImage* out,                      ///< an psImage to recycle.  If NULL, a new image is created
    122122    const psImage* in,                 ///< input image
    123     int scale,                         ///< resample scaling factor
     123    psS32 scale,                         ///< resample scaling factor
    124124    psImageInterpolateMode mode        ///< the interpolation mode used in resampling
    125125);
     
    176176    psImage* out,                      ///< an psImage to recycle.  If NULL, a new image is created
    177177    const psImage* in,                 ///< input image
    178     int dx,                            ///< number of pixels to roll in the x-dimension
    179     int dy                             ///< number of pixels to roll in the y-dimension
     178    psS32 dx,                            ///< number of pixels to roll in the x-dimension
     179    psS32 dy                             ///< number of pixels to roll in the y-dimension
    180180);
    181181
  • trunk/psLib/src/image/psImageStats.c

    r2102 r2204  
    99*  @author GLG, MHPCC
    1010*
    11 *  @version $Revision: 1.43 $ $Name: not supported by cvs2svn $
    12 *  @date $Date: 2004-10-14 01:06:44 $
     11*  @version $Revision: 1.44 $ $Name: not supported by cvs2svn $
     12*  @date $Date: 2004-10-27 00:57:31 $
    1313*
    1414*  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    4040                      psImage* in,
    4141                      psImage* mask,
    42                       int maskVal)
     42                      psS32 maskVal)
    4343{
    4444    psVector* junkData = NULL;
     
    106106                              psImage* in,
    107107                              psImage* mask,
    108                               unsigned int maskVal)
     108                              psU32 maskVal)
    109109{
    110110    psVector* junkData = NULL;
     
    150150
    151151// XXX: Why do we have this function?
    152 float *p_psCalcScaleFactorsFit(int n)
    153 {
    154     int i = 0;
     152float *p_psCalcScaleFactorsFit(psS32 n)
     153{
     154    psS32 i = 0;
    155155    float tmp = 0.0;
    156156    float *scalingFactors = (float *)psAlloc(n * sizeof(float));
     
    175175output a vector of evenly spaced floating point values between -1.0:1.0.
    176176 *****************************************************************************/
    177 float *p_psCalcScaleFactorsEval(int n)
    178 {
    179     int i = 0;
     177float *p_psCalcScaleFactorsEval(psS32 n)
     178{
     179    psS32 i = 0;
    180180    float tmp = 0.0;
    181181
     
    196196
    197197// XXX: Use a static array of CHebyshev polynomials.
    198 psPolynomial1D **p_psCreateChebyshevPolys(int maxChebyPoly)
     198psPolynomial1D **p_psCreateChebyshevPolys(psS32 maxChebyPoly)
    199199{
    200200    if (maxChebyPoly < 1) {
     
    202202    }
    203203    psPolynomial1D **chebPolys = NULL;
    204     int i = 0;
    205     int j = 0;
     204    psS32 i = 0;
     205    psS32 j = 0;
    206206
    207207    chebPolys = (psPolynomial1D **) psAlloc(maxChebyPoly * sizeof(psPolynomial1D *));
     
    245245                                     const psImage* input)
    246246{
    247     int x = 0;
    248     int y = 0;
    249     int i = 0;
    250     int j = 0;
     247    psS32 x = 0;
     248    psS32 y = 0;
     249    psS32 i = 0;
     250    psS32 j = 0;
    251251    float **sums = NULL;
    252252    psPolynomial1D* *chebPolys = NULL;
    253     int maxChebyPoly = 0;
     253    psS32 maxChebyPoly = 0;
    254254    float *cScalingFactors = NULL;
    255255    float *rScalingFactors = NULL;
     
    365365psImage* psImageEvalPolynomial(psImage* input, const psPolynomial2D* coeffs)
    366366{
    367     int x = 0;
    368     int y = 0;
    369     int i = 0;
    370     int j = 0;
     367    psS32 x = 0;
     368    psS32 y = 0;
     369    psS32 i = 0;
     370    psS32 j = 0;
    371371    //    float **sums = NULL;
    372372    psPolynomial1D* *chebPolys = NULL;
    373     int maxChebyPoly = 0;
     373    psS32 maxChebyPoly = 0;
    374374    float *cScalingFactors = NULL;
    375375    float *rScalingFactors = NULL;
  • trunk/psLib/src/image/psImageStats.h

    r1951 r2204  
    99*  @author George Gusciora, MHPCC
    1010*
    11 *  @version $Revision: 1.17 $ $Name: not supported by cvs2svn $
    12 *  @date $Date: 2004-10-05 01:03:11 $
     11*  @version $Revision: 1.18 $ $Name: not supported by cvs2svn $
     12*  @date $Date: 2004-10-27 00:57:31 $
    1313*
    1414*  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    4040    psImage* in,                       ///< image (or subimage) to calculate stats
    4141    psImage* mask,                     ///< mask data for image (NULL ok)
    42     int maskVal                        ///< mask Mask for mask
     42    psS32 maskVal                        ///< mask Mask for mask
    4343);
    4444
     
    5555    psImage* in,                       ///< Image data to be histogramed.
    5656    psImage* mask,                     ///< mask data for image (NULL ok)
    57     unsigned int maskVal               ///< mask Mask for mask
     57    psU32 maskVal               ///< mask Mask for mask
    5858);
    5959
Note: See TracChangeset for help on using the changeset viewer.