Changeset 3309 for trunk/psLib/src/image/psImageStats.c
- Timestamp:
- Feb 23, 2005, 11:32:40 AM (21 years ago)
- File:
-
- 1 edited
-
trunk/psLib/src/image/psImageStats.c (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/src/image/psImageStats.c
r3302 r3309 9 9 * @author GLG, MHPCC 10 10 * 11 * @version $Revision: 1.6 7$ $Name: not supported by cvs2svn $12 * @date $Date: 2005-02-2 2 20:06:24$11 * @version $Revision: 1.68 $ $Name: not supported by cvs2svn $ 12 * @date $Date: 2005-02-23 21:32:40 $ 13 13 * 14 14 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 130 130 psVector* junkMask = NULL; 131 131 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 } 137 154 138 155 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 } 145 178 } 146 179
Note:
See TracChangeset
for help on using the changeset viewer.
