IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 3309


Ignore:
Timestamp:
Feb 23, 2005, 11:32:40 AM (21 years ago)
Author:
desonia
Message:

added support in psImageStats for subset images.

Location:
trunk/psLib/src
Files:
3 edited

Legend:

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

    r3264 r3309  
    99 *  @author Robert DeSonia, MHPCC
    1010 *
    11  *  @version $Revision: 1.30 $ $Name: not supported by cvs2svn $
    12  *  @date $Date: 2005-02-17 19:26:24 $
     11 *  @version $Revision: 1.31 $ $Name: not supported by cvs2svn $
     12 *  @date $Date: 2005-02-23 21:32:40 $
    1313 *
    1414 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    394394
    395395        switch (type) {
    396             //            PSIMAGE_CUT_VERTICAL(U8);        Not a requirement
     396            PSIMAGE_CUT_VERTICAL(U8);  // Not a requirement
    397397            PSIMAGE_CUT_VERTICAL(U16);
    398             //            PSIMAGE_CUT_VERTICAL(U32);        Not a requirement
    399             //            PSIMAGE_CUT_VERTICAL(U64);        Not a requirement
     398            PSIMAGE_CUT_VERTICAL(U32); // Not a requirement
     399            PSIMAGE_CUT_VERTICAL(U64); // Not a requirement
    400400            PSIMAGE_CUT_VERTICAL(S8);
    401             //            PSIMAGE_CUT_VERTICAL(S16);        Not a requirement
    402             //            PSIMAGE_CUT_VERTICAL(S32);        Not a requirement
    403             //            PSIMAGE_CUT_VERTICAL(S64);        Not a requirement
     401            PSIMAGE_CUT_VERTICAL(S16); // Not a requirement
     402            PSIMAGE_CUT_VERTICAL(S32); // Not a requirement
     403            PSIMAGE_CUT_VERTICAL(S64); // Not a requirement
    404404            PSIMAGE_CUT_VERTICAL(F32);
    405405            PSIMAGE_CUT_VERTICAL(F64);
    406             //            PSIMAGE_CUT_VERTICAL(C32);        Not a requirement
    407             //            PSIMAGE_CUT_VERTICAL(C64);        Not a requirement
     406            PSIMAGE_CUT_VERTICAL(C32); // Not a requirement
     407            PSIMAGE_CUT_VERTICAL(C64); // Not a requirement
    408408        default: {
    409409                char* typeStr;
  • trunk/psLib/src/image/psImageStats.c

    r3302 r3309  
    99 *  @author GLG, MHPCC
    1010 *
    11  *  @version $Revision: 1.67 $ $Name: not supported by cvs2svn $
    12  *  @date $Date: 2005-02-22 20:06:24 $
     11 *  @version $Revision: 1.68 $ $Name: not supported by cvs2svn $
     12 *  @date $Date: 2005-02-23 21:32:40 $
    1313 *
    1414 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    130130    psVector* junkMask = NULL;
    131131
    132     junkData = psAlloc(sizeof(psVector));
    133     junkData->type = in->type;
    134     junkData->nalloc = in->numRows * in->numCols;
    135     junkData->n = junkData->nalloc;
    136     junkData->data.V = in->data.V[0];  // since psImage data is contiguous...
     132    if (in->parent == NULL) {
     133        // stuff the image data into a psVector struct.
     134        junkData = (psVector *) psAlloc(sizeof(psVector));
     135        junkData->type = in->type;
     136        junkData->nalloc = in->numRows * in->numCols;
     137        junkData->n = junkData->nalloc;
     138        junkData->data.V = in->data.V[0];      // since psImage data is contiguous...
     139    } else {
     140        // image not necessarily contiguous
     141        int numRows = in->numRows;
     142        int numCols = in->numCols;
     143        int rowSize = numCols * (PSELEMTYPE_SIZEOF(in->type.type));
     144
     145        junkData = psVectorAlloc(numRows*numCols, in->type.type);
     146        junkData->n = junkData->nalloc;
     147
     148        psU8* data = junkData->data.V;
     149        for (int row = 0; row < numRows; row++) {
     150            memcpy(data, in->data.V[row], rowSize);
     151            data += rowSize;
     152        }
     153    }
    137154
    138155    if (mask != NULL) {
    139         // stuff the mask data into a psVector struct.
    140         junkMask = psAlloc(sizeof(psVector));
    141         junkMask->type = mask->type;
    142         junkMask->nalloc = mask->numRows * mask->numCols;
    143         junkMask->n = junkMask->nalloc;
    144         junkMask->data.V = mask->data.V[0];
     156        if (mask->parent == NULL) {
     157            // stuff the mask data into a psVector struct.
     158            junkMask = psAlloc(sizeof(psVector));
     159            junkMask->type = mask->type;
     160            junkMask->nalloc = mask->numRows * mask->numCols;
     161            junkMask->n = junkMask->nalloc;
     162            junkMask->data.V = mask->data.V[0];
     163        } else {
     164            // image not necessarily contiguous
     165            int numRows = mask->numRows;
     166            int numCols = mask->numCols;
     167            int rowSize = numCols * (PSELEMTYPE_SIZEOF(mask->type.type));
     168
     169            junkMask = psVectorAlloc(numRows*numCols, mask->type.type);
     170            junkMask->n = junkMask->nalloc;
     171
     172            psU8* data = junkMask->data.V;
     173            for (int row = 0; row < numRows; row++) {
     174                memcpy(data, mask->data.V[row], rowSize);
     175                data += rowSize;
     176            }
     177        }
    145178    }
    146179
  • trunk/psLib/src/imageops/psImageStats.c

    r3302 r3309  
    99 *  @author GLG, MHPCC
    1010 *
    11  *  @version $Revision: 1.67 $ $Name: not supported by cvs2svn $
    12  *  @date $Date: 2005-02-22 20:06:24 $
     11 *  @version $Revision: 1.68 $ $Name: not supported by cvs2svn $
     12 *  @date $Date: 2005-02-23 21:32:40 $
    1313 *
    1414 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    130130    psVector* junkMask = NULL;
    131131
    132     junkData = psAlloc(sizeof(psVector));
    133     junkData->type = in->type;
    134     junkData->nalloc = in->numRows * in->numCols;
    135     junkData->n = junkData->nalloc;
    136     junkData->data.V = in->data.V[0];  // since psImage data is contiguous...
     132    if (in->parent == NULL) {
     133        // stuff the image data into a psVector struct.
     134        junkData = (psVector *) psAlloc(sizeof(psVector));
     135        junkData->type = in->type;
     136        junkData->nalloc = in->numRows * in->numCols;
     137        junkData->n = junkData->nalloc;
     138        junkData->data.V = in->data.V[0];      // since psImage data is contiguous...
     139    } else {
     140        // image not necessarily contiguous
     141        int numRows = in->numRows;
     142        int numCols = in->numCols;
     143        int rowSize = numCols * (PSELEMTYPE_SIZEOF(in->type.type));
     144
     145        junkData = psVectorAlloc(numRows*numCols, in->type.type);
     146        junkData->n = junkData->nalloc;
     147
     148        psU8* data = junkData->data.V;
     149        for (int row = 0; row < numRows; row++) {
     150            memcpy(data, in->data.V[row], rowSize);
     151            data += rowSize;
     152        }
     153    }
    137154
    138155    if (mask != NULL) {
    139         // stuff the mask data into a psVector struct.
    140         junkMask = psAlloc(sizeof(psVector));
    141         junkMask->type = mask->type;
    142         junkMask->nalloc = mask->numRows * mask->numCols;
    143         junkMask->n = junkMask->nalloc;
    144         junkMask->data.V = mask->data.V[0];
     156        if (mask->parent == NULL) {
     157            // stuff the mask data into a psVector struct.
     158            junkMask = psAlloc(sizeof(psVector));
     159            junkMask->type = mask->type;
     160            junkMask->nalloc = mask->numRows * mask->numCols;
     161            junkMask->n = junkMask->nalloc;
     162            junkMask->data.V = mask->data.V[0];
     163        } else {
     164            // image not necessarily contiguous
     165            int numRows = mask->numRows;
     166            int numCols = mask->numCols;
     167            int rowSize = numCols * (PSELEMTYPE_SIZEOF(mask->type.type));
     168
     169            junkMask = psVectorAlloc(numRows*numCols, mask->type.type);
     170            junkMask->n = junkMask->nalloc;
     171
     172            psU8* data = junkMask->data.V;
     173            for (int row = 0; row < numRows; row++) {
     174                memcpy(data, mask->data.V[row], rowSize);
     175                data += rowSize;
     176            }
     177        }
    145178    }
    146179
Note: See TracChangeset for help on using the changeset viewer.