Changeset 2204 for trunk/psLib/src/image
- Timestamp:
- Oct 26, 2004, 2:57:34 PM (22 years ago)
- Location:
- trunk/psLib/src/image
- Files:
-
- 13 edited
-
psImage.c (modified) (24 diffs)
-
psImage.h (modified) (11 diffs)
-
psImageConvolve.c (modified) (17 diffs)
-
psImageConvolve.h (modified) (6 diffs)
-
psImageExtraction.c (modified) (30 diffs)
-
psImageExtraction.h (modified) (6 diffs)
-
psImageFFT.c (modified) (18 diffs)
-
psImageIO.c (modified) (5 diffs)
-
psImageIO.h (modified) (6 diffs)
-
psImageManip.c (modified) (28 diffs)
-
psImageManip.h (modified) (8 diffs)
-
psImageStats.c (modified) (9 diffs)
-
psImageStats.h (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/src/image/psImage.c
r2105 r2204 10 10 * @author Ross Harman, MHPCC 11 11 * 12 * @version $Revision: 1.5 0$ $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 $ 14 14 * 15 15 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 29 29 static void imageFree(psImage* image); 30 30 31 psImage* psImageAlloc( unsigned intnumCols,32 unsigned intnumRows,31 psImage* psImageAlloc(psU32 numCols, 32 psU32 numRows, 33 33 const psElemType type) 34 34 { 35 intarea = 0;36 intelementSize = PSELEMTYPE_SIZEOF(type); // element size in bytes37 introwSize = 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. 38 38 39 39 area = numCols * numRows; … … 51 51 p_psMemSetDeallocator(image, (psFreeFcn) imageFree); 52 52 53 image->data.V = psAlloc(sizeof( void *) * numRows);53 image->data.V = psAlloc(sizeof(psPtr ) * numRows); 54 54 55 55 image->rawDataBuffer = psAlloc(area * elementSize); … … 57 57 // set the row pointers. 58 58 image->data.V[0] = image->rawDataBuffer; 59 for ( inti = 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; 67 67 *(psDimen* ) & image->type.dimen = PS_DIMEN_IMAGE; 68 68 *(psElemType* ) & image->type.type = type; … … 81 81 if (image->type.type == PS_TYPE_PTR) { 82 82 // 2-D array of pointers -- must dereference elements 83 unsigned intoldNumRows = image->numRows;84 unsigned intoldNumCols = image->numCols;85 psP TR* rowPtr;86 87 for ( unsigned introw = 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++) { 88 88 rowPtr = image->data.PTR[row]; 89 for ( unsigned intcol = 0; col < oldNumCols; col++) {89 for (psU32 col = 0; col < oldNumCols; col++) { 90 90 psMemDecrRefCounter(rowPtr[col]); 91 91 } … … 105 105 106 106 psImage* psImageRecycle(psImage* old, 107 unsigned intnumCols,108 unsigned intnumRows,107 psU32 numCols, 108 psU32 numRows, 109 109 const psElemType type) 110 110 { 111 intelementSize = PSELEMTYPE_SIZEOF(type); // element size in bytes112 introwSize = 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. 113 113 114 114 if (old == NULL) { … … 128 128 // 2-D array of pointers -- must 129 129 // dereference 130 unsigned intoldNumRows = old->numRows;131 unsigned intoldNumCols = old->numCols;132 psP TR* rowPtr;133 134 for ( unsigned introw = 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++) { 135 135 rowPtr = old->data.PTR[row]; 136 for ( unsigned intcol = 0; col < oldNumCols; col++) {136 for (psU32 col = 0; col < oldNumCols; col++) { 137 137 psMemDecrRefCounter(rowPtr[col]); 138 138 rowPtr[col] = NULL; … … 149 149 old->rawDataBuffer = psRealloc(old->data.V[0], 150 150 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 )); 152 152 153 153 // recreate the row pointers 154 154 old->data.V[0] = old->rawDataBuffer; 155 for ( inti = 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; 161 161 *(psElemType* ) & old->type.type = type; 162 162 … … 169 169 { 170 170 psElemType inDatatype; 171 intelementSize;172 intelements;173 intnumRows;174 intnumCols;171 psS32 elementSize; 172 psS32 elements; 173 psS32 numRows; 174 psS32 numCols; 175 175 176 176 if (input == NULL || input->data.V == NULL) { … … 218 218 // datatype. 219 219 if (type == inDatatype) { 220 for ( introw=0;row<numRows;row++) {220 for (psS32 row=0;row<numRows;row++) { 221 221 memcpy(output->data.V[row], input->data.V[row], elementSize * numCols); 222 222 } … … 227 227 ps##INTYPE *in; \ 228 228 ps##OUTTYPE *out; \ 229 for( introw=0;row<numRows;row++) { \229 for(psS32 row=0;row<numRows;row++) { \ 230 230 in = IN->data.INTYPE[row]; \ 231 231 out = OUT->data.OUTTYPE[row]; \ 232 for ( intcol=0;col<numCols;col++) { \232 for (psS32 col=0;col<numCols;col++) { \ 233 233 *(out++) = *(in++); \ 234 234 } \ … … 331 331 } 332 332 333 intpsImageFreeChildren(psImage* image)333 psS32 psImageFreeChildren(psImage* image) 334 334 { 335 intnumFreed = 0;335 psS32 numFreed = 0; 336 336 337 337 if (image == NULL) { … … 345 345 // orphan the children first 346 346 // (so psFree doesn't try to modify the parent's children array while I'm using it) 347 for ( inti=0;i<numFreed;i++) {347 for (psS32 i=0;i<numFreed;i++) { 348 348 children[i]->parent = NULL; 349 349 } … … 366 366 float y, 367 367 const psImage* mask, 368 unsigned intmaskVal,368 psU32 maskVal, 369 369 psC64 unexposedValue, 370 370 psImageInterpolateMode mode) … … 438 438 float y, \ 439 439 const psImage* mask, \ 440 unsigned intmaskVal, \440 psU32 maskVal, \ 441 441 psF64 unexposedValue) \ 442 442 { \ 443 int intX = (int) round((psF64)(x) - 0.5 + FLT_EPSILON); \444 int intY = (int) round((psF64)(y) - 0.5 + FLT_EPSILON); \445 intlastX = input->numCols - 1; \446 intlastY = 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; \ 447 447 \ 448 448 if ((intX < 0) || \ … … 463 463 float y, \ 464 464 const psImage* mask, \ 465 unsigned intmaskVal, \465 psU32 maskVal, \ 466 466 psC64 unexposedValue) \ 467 467 { \ 468 int intX = (int) round((psF64)(x) - 0.5); \469 int intY = (int) round((psF64)(y) - 0.5); \470 intlastX = input->numCols - 1; \471 intlastY = 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; \ 472 472 \ 473 473 if ((intX < 0) || \ … … 501 501 float y, \ 502 502 const psImage* mask, \ 503 unsigned intmaskVal, \503 psU32 maskVal, \ 504 504 psF64 unexposedValue) \ 505 505 { \ … … 508 508 psF64 fracX = x - 0.5 - floorX; \ 509 509 psF64 fracY = y - 0.5 - floorY; \ 510 int intFloorX = (int) floorX; \511 int intFloorY = (int) floorY; \512 intlastX = input->numCols - 1; \513 intlastY = 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; \ 514 514 ps##TYPE V00; \ 515 515 ps##TYPE V01; \ 516 516 ps##TYPE V10; \ 517 517 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; \ 522 522 \ 523 523 if (intFloorY >= 0 && intFloorY <= lastY) { \ … … 556 556 \ 557 557 psF64 V0; \ 558 bool valid0 = true; \558 psBool valid0 = true; \ 559 559 if (valid00 && valid10) { \ 560 560 V0 = V00*(1-fracX)+V10*fracX; \ … … 568 568 \ 569 569 psF64 V1; \ 570 bool valid1 = true; \570 psBool valid1 = true; \ 571 571 if (valid01 && valid11) { \ 572 572 V1 = V01*(1-fracX)+V11*fracX; \ … … 595 595 float y, \ 596 596 const psImage* mask, \ 597 unsigned intmaskVal, \597 psU32 maskVal, \ 598 598 psC64 unexposedValue) \ 599 599 { \ … … 602 602 psF64 fracX = x - 0.5 - floorX; \ 603 603 psF64 fracY = y - 0.5 - floorY; \ 604 int intFloorX = (int) floorX; \605 int intFloorY = (int) floorY; \606 intlastX = input->numCols - 1; \607 intlastY = 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; \ 608 608 ps##TYPE V00; \ 609 609 ps##TYPE V01; \ 610 610 ps##TYPE V10; \ 611 611 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; \ 616 616 \ 617 617 if (intFloorY >= 0 && intFloorY <= lastY) { \ … … 650 650 \ 651 651 psC64 V0; \ 652 bool valid0 = true; \652 psBool valid0 = true; \ 653 653 if (valid00 && valid10) { \ 654 654 V0 = V00*(1-fracX)+V10*fracX; \ … … 662 662 \ 663 663 psC64 V1; \ 664 bool valid1 = true; \664 psBool valid1 = true; \ 665 665 if (valid01 && valid11) { \ 666 666 V0 = V01*(1-fracX)+V11*fracX; \ -
trunk/psLib/src/image/psImage.h
r2105 r2204 11 11 * @author Ross Harman, MHPCC 12 12 * 13 * @version $Revision: 1.4 1$ $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 $ 15 15 * 16 16 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 47 47 { 48 48 const psType type; ///< Image data type and dimension. 49 const unsigned intnumCols; ///< Number of columns in image50 const unsigned intnumRows; ///< Number of rows in image.51 const intcol0; ///< Column position relative to parent.52 const introw0; ///< 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. 53 53 54 54 union { … … 65 65 psC32** C32; ///< Single-precision complex data. 66 66 psC64** C64; ///< Double-precision complex data. 67 psP TR** PTR; ///< Void pointers.68 psP TR* V; ///< Pointer to data.67 psPtr** PTR; ///< Void pointers. 68 psPtr* V; ///< Pointer to data. 69 69 } data; ///< Union for data types. 70 70 const struct psImage* parent; ///< Parent, if a subimage. 71 71 psArray* children; ///< Children of this region. 72 72 73 void*rawDataBuffer;73 psPtr rawDataBuffer; 74 74 } 75 75 psImage; … … 84 84 */ 85 85 psImage* psImageAlloc( 86 unsigned intnumCols, ///< Number of rows in image.87 unsigned intnumRows, ///< Number of columns in image.86 psU32 numCols, ///< Number of rows in image. 87 psU32 numRows, ///< Number of columns in image. 88 88 const psElemType type ///< Type of data for image. 89 89 ); … … 96 96 psImage* psImageRecycle( 97 97 psImage* old, ///< the psImage to recycle by resizing image buffer 98 unsigned intnumCols, ///< the desired number of columns in image99 unsigned intnumRows, ///< the desired number of rows in image98 psU32 numCols, ///< the desired number of columns in image 99 psU32 numRows, ///< the desired number of rows in image 100 100 const psElemType type ///< the desired datatype of the image 101 101 ); … … 115 115 /** Frees all children of a psImage. 116 116 * 117 * @return intNumber of children freed.117 * @return psS32 Number of children freed. 118 118 * 119 119 */ 120 intpsImageFreeChildren(120 psS32 psImageFreeChildren( 121 121 psImage* image ///< psImage in which all children shall be deallocated 122 122 ); … … 132 132 float y, ///< row location ot derive value of 133 133 const psImage* mask, ///< if not NULL, the mask of the input image 134 unsigned intmaskVal, ///< the mask value134 psU32 maskVal, ///< the mask value 135 135 psC64 unexposedValue, ///< return value if x,y location is not in image. 136 136 psImageInterpolateMode mode ///< interpolation mode … … 143 143 float y, /**< row location ot derive value of */ \ 144 144 const psImage* mask, /**< if not NULL, the mask of the input image */ \ 145 unsigned intmaskVal, /**< the mask value */ \145 psU32 maskVal, /**< the mask value */ \ 146 146 psF64 unexposedValue /**< return value if x,y location is not in image. */ \ 147 147 ); \ … … 151 151 float y, /**< row location ot derive value of */ \ 152 152 const psImage* mask, /**< if not NULL, the mask of the input image */ \ 153 unsigned intmaskVal, /**< the mask value */ \153 psU32 maskVal, /**< the mask value */ \ 154 154 psF64 unexposedValue /**< return value if x,y location is not in image. */ \ 155 155 ); … … 161 161 float y, /**< row location ot derive value of */ \ 162 162 const psImage* mask, /**< if not NULL, the mask of the input image */ \ 163 unsigned intmaskVal, /**< the mask value */ \163 psU32 maskVal, /**< the mask value */ \ 164 164 psC64 unexposedValue /**< return value if x,y location is not in image. */ \ 165 165 ); \ … … 169 169 float y, /**< row location ot derive value of */ \ 170 170 const psImage* mask, /**< if not NULL, the mask of the input image */ \ 171 unsigned intmaskVal, /**< the mask value */ \171 psU32 maskVal, /**< the mask value */ \ 172 172 psC64 unexposedValue /**< return value if x,y location is not in image. */ \ 173 173 ); -
trunk/psLib/src/image/psImageConvolve.c
r1983 r2204 5 5 * @author Robert DeSonia, MHPCC 6 6 * 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 $ 9 9 * 10 10 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 28 28 static void freeKernel(psKernel* ptr); 29 29 30 psKernel* psKernelAlloc( int xMin, int xMax, int yMin, intyMax)30 psKernel* psKernelAlloc(psS32 xMin, psS32 xMax, psS32 yMin, psS32 yMax) 31 31 { 32 32 psKernel* result; 33 intnumRows;34 intnumCols;33 psS32 numRows; 34 psS32 numCols; 35 35 36 36 // following is explicitly spelled out in the SDRS as a requirement … … 40 40 yMin, yMax); 41 41 42 inttemp = yMin;42 psS32 temp = yMin; 43 43 yMin = yMax; 44 44 yMax = temp; … … 51 51 xMin, xMax); 52 52 53 inttemp = xMin;53 psS32 temp = xMin; 54 54 xMin = xMax; 55 55 xMax = temp; … … 70 70 psKernelType** kernelRows = result->p_kernelRows; 71 71 psKernelType** imageRows = result->image->data.PS_TYPE_KERNEL_DATA; 72 for ( inti = 0; i < numRows; i++) {72 for (psS32 i = 0; i < numRows; i++) { 73 73 kernelRows[i] = imageRows[i] - xMin; 74 74 } … … 91 91 const psVector* xShifts, 92 92 const psVector* yShifts, 93 bool relative)93 psBool relative) 94 94 { 95 intx = 0;96 inty = 0;97 intt = 0;98 intdeltaT;99 intoldX;100 intoldY;101 intxMin = 0;102 intxMax = 0;103 intyMin = 0;104 intyMax = 0;105 intlength = 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; 106 106 psKernelType normalizeTime = 1.0; // fraction of total time for each shift clock 107 107 psKernel* result = NULL; … … 153 153 y = 0; \ 154 154 t = 0; \ 155 for ( intlcv = 0; lcv < length; lcv++) { \155 for (psS32 lcv = 0; lcv < length; lcv++) { \ 156 156 if (relative) { \ 157 157 x += xShiftData[lcv]; \ … … 181 181 y = 0; \ 182 182 t = 0; \ 183 for ( inti = 0; i < length; i++) { \183 for (psS32 i = 0; i < length; i++) { \ 184 184 deltaT = t; \ 185 185 oldX = x; \ … … 228 228 } 229 229 230 psImage* psImageConvolve(psImage* out, const psImage* in, const psKernel* kernel, bool direct)230 psImage* psImageConvolve(psImage* out, const psImage* in, const psKernel* kernel, psBool direct) 231 231 { 232 232 if (in == NULL) { … … 242 242 return NULL; 243 243 } 244 intxMin = kernel->xMin;245 intxMax = kernel->xMax;246 intyMin = kernel->yMin;247 intyMax = kernel->yMax;244 psS32 xMin = kernel->xMin; 245 psS32 xMax = kernel->xMax; 246 psS32 yMin = kernel->yMin; 247 psS32 yMax = kernel->yMax; 248 248 psKernelType** kData = kernel->kernel; 249 249 250 250 // make the output image to the proper size and type 251 intnumRows = in->numRows;252 intnumCols = in->numCols;251 psS32 numRows = in->numRows; 252 psS32 numCols = in->numCols; 253 253 254 254 … … 261 261 ps##TYPE** inData = in->data.TYPE; \ 262 262 out = psImageRecycle(out, numCols, numRows, PS_TYPE_##TYPE); \ 263 for ( introw=0;row<numRows;row++) { \263 for (psS32 row=0;row<numRows;row++) { \ 264 264 ps##TYPE* outRow = out->data.TYPE[row]; \ 265 for ( intcol=0;col<numCols;col++) { \265 for (psS32 col=0;col<numCols;col++) { \ 266 266 ps##TYPE pixel = 0.0; \ 267 for ( intkRow = yMin; kRow < yMax; kRow++) { \267 for (psS32 kRow = yMin; kRow < yMax; kRow++) { \ 268 268 if (row-kRow >= 0 && row-kRow < numRows) { \ 269 for ( intkCol = xMin; kCol < xMax; kCol++) { \269 for (psS32 kCol = xMin; kCol < xMax; kCol++) { \ 270 270 if (col-kCol >= 0 && col-kCol < numCols) { \ 271 271 pixel += kData[kRow][kCol] * inData[row-kRow][col-kCol]; \ … … 310 310 } else { 311 311 // fourier convolution 312 intpaddedCols = numCols+2*FOURIER_PADDING;313 intpaddedRows = numRows+2*FOURIER_PADDING;312 psS32 paddedCols = numCols+2*FOURIER_PADDING; 313 psS32 paddedRows = numRows+2*FOURIER_PADDING; 314 314 315 315 // check to see if kernel is smaller, otherwise padding it up will fail. 316 intkRows = kernel->image->numRows;317 intkCols = kernel->image->numCols;316 psS32 kRows = kernel->image->numRows; 317 psS32 kCols = kernel->image->numCols; 318 318 if (kRows >= numRows || kCols >= numCols) { 319 319 psErrorMsg(PS_ERRORNAME_DOMAIN "psImageConvolve", … … 328 328 // pad the image 329 329 psImage* paddedImage = psImageAlloc(paddedCols,paddedRows,in->type.type); 330 intelementSize = PSELEMTYPE_SIZEOF(in->type.type);330 psS32 elementSize = PSELEMTYPE_SIZEOF(in->type.type); 331 331 332 332 // zero out padded area on top and bottom … … 335 335 336 336 // fill in the image-containing rows. 337 intsidePaddingSize = FOURIER_PADDING*elementSize;338 intimageRowSize = numCols*elementSize;337 psS32 sidePaddingSize = FOURIER_PADDING*elementSize; 338 psS32 imageRowSize = numCols*elementSize; 339 339 psU8* paddedData = paddedImage->data.U8[FOURIER_PADDING]; 340 for ( introw=0;row<numRows;row++) {340 for (psS32 row=0;row<numRows;row++) { 341 341 // zero out padded area on left edge. 342 342 memset(paddedData,0,sidePaddingSize); … … 354 354 psImage* paddedKernel = psImageAlloc(paddedCols,paddedRows,PS_TYPE_KERNEL); 355 355 memset(paddedKernel->data.U8[0],0,sizeof(psKernelType)*numCols*numRows); // zero-out image 356 intyMax = kernel->yMax;357 intxMax = kernel->xMax;358 for ( introw = kernel->yMin; row <= yMax;row++) {359 intpadRow = row;356 psS32 yMax = kernel->yMax; 357 psS32 xMax = kernel->xMax; 358 for (psS32 row = kernel->yMin; row <= yMax;row++) { 359 psS32 padRow = row; 360 360 if (padRow < 0) { 361 361 padRow += paddedRows; … … 363 363 psKernelType* padData = paddedKernel->data.PS_TYPE_KERNEL_DATA[padRow]; 364 364 psKernelType* kernelRow = kernel->kernel[row]; 365 for ( intcol = kernel->xMin; col <= xMax; col++) {365 for (psS32 col = kernel->xMin; col <= xMax; col++) { 366 366 if (col < 0) { 367 367 padData[col+paddedCols] = kernelRow[col]; … … 418 418 out = psImageRecycle(out,numCols,numRows,PS_TYPE_F32); 419 419 float factor = 1.0f/numCols/numRows; 420 for ( introw = 0; row < numRows; row++) {420 for (psS32 row = 0; row < numRows; row++) { 421 421 psF32* outRow = out->data.F32[row]; 422 422 psC32* resultRow = complexOutSansPad->data.C32[row]; 423 for ( intcol = 0; col < numCols; col++) {423 for (psS32 col = 0; col < numCols; col++) { 424 424 outRow[col] = crealf(resultRow[col])*factor; 425 425 } -
trunk/psLib/src/image/psImageConvolve.h
r1863 r2204 7 7 * @author Robert DeSonia, MHPCC 8 8 * 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 $ 11 11 * 12 12 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 15 15 #ifndef PS_IMAGE_CONVOLVE_H 16 16 #define PS_IMAGE_CONVOLVE_H 17 18 #include<stdbool.h>19 17 20 18 #include "psImage.h" … … 32 30 { 33 31 psImage* image; ///< Kernel data, in the form of an image 34 intxMin; ///< Most negative x index35 intyMin; ///< Most negative y index36 intxMax; ///< Most positive x index37 intyMax; ///< Most positive y index32 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 38 36 psKernelType** kernel; ///< Pointer to the kernel data 39 37 psKernelType** p_kernelRows; ///< Pointer to the rows of the kernel data; not intended for user use. … … 68 66 */ 69 67 psKernel* psKernelAlloc( 70 intxMin, ///< Most negative x index71 intxMax, ///< Most positive x index72 intyMin, ///< Most negative y index73 intyMax ///< Most positive y index68 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 74 72 ); 75 73 … … 94 92 const psVector* xShifts, ///< list of x-axis shifts 95 93 const psVector* yShifts, ///< list of y-axis shifts 96 bool relative94 psBool relative 97 95 ); 98 96 … … 118 116 const psImage* in, ///< the psImage to convolve 119 117 const psKernel* kernel, ///< kernel to colvolve with 120 bool direct ///< specifies method, true=direct convolution, false=fourier118 psBool direct ///< specifies method, true=direct convolution, false=fourier 121 119 ); 122 120 -
trunk/psLib/src/image/psImageExtraction.c
r2105 r2204 9 9 * @author Robert DeSonia, MHPCC 10 10 * 11 * @version $Revision: 1.2 6$ $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 $ 13 13 * 14 14 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 26 26 psImage* imageSubset(psImage* out, 27 27 psImage* image, 28 intcol0,29 introw0,30 intcol1,31 introw1)28 psS32 col0, 29 psS32 row0, 30 psS32 col1, 31 psS32 row1) 32 32 { 33 unsigned intelementSize; // size of image element in bytes34 unsigned intinputColOffset; // offset in bytes to first subset pixel in input row33 psU32 elementSize; // size of image element in bytes 34 psU32 inputColOffset; // offset in bytes to first subset pixel in input row 35 35 36 36 if (image == NULL || image->data.V == NULL) { … … 68 68 return NULL; 69 69 } 70 intnumRows = row1-row0;71 intnumCols = col1-col0;70 psS32 numRows = row1-row0; 71 psS32 numCols = col1-col0; 72 72 73 73 elementSize = PSELEMTYPE_SIZEOF(image->type.type); … … 82 82 83 83 // increment the raw data buffer before freeing anything in the 'out' 84 void*rawData = psMemIncrRefCounter(image->rawDataBuffer);84 psPtr rawData = psMemIncrRefCounter(image->rawDataBuffer); 85 85 86 86 if (out != NULL) { … … 97 97 } 98 98 99 out->data.V = psRealloc(out->data.V,sizeof( void*)*numRows); // resize row pointer array99 out->data.V = psRealloc(out->data.V,sizeof(psPtr)*numRows); // resize row pointer array 100 100 *(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; 105 105 out->parent = image; 106 106 out->children = NULL; … … 111 111 112 112 inputColOffset = elementSize * col0; 113 for ( introw = 0; row < numRows; row++) {113 for (psS32 row = 0; row < numRows; row++) { 114 114 out->data.V[row] = image->data.U8[row0 + row] + inputColOffset; 115 115 } 116 116 117 117 // add output image as a child of the input image. 118 intn = 0;118 psS32 n = 0; 119 119 psArray* children = image->children; 120 120 if (children == NULL) { … … 134 134 135 135 psImage* psImageSubset(psImage* image, 136 intcol0,137 introw0,138 intcol1,139 introw1)136 psS32 col0, 137 psS32 row0, 138 psS32 col1, 139 psS32 row1) 140 140 { 141 141 return imageSubset(NULL,image,col0,row0,col1,row1); … … 145 145 const char* section) 146 146 { 147 intcol0;148 intcol1;149 introw0;150 introw1;147 psS32 col0; 148 psS32 col1; 149 psS32 row0; 150 psS32 row1; 151 151 152 152 // section should be of the form '[col0:col1,row0:row1]' … … 177 177 } 178 178 179 psImage* psImageTrim(psImage* image, int col0, int row0, int col1, introw1)179 psImage* psImageTrim(psImage* image, psS32 col0, psS32 row0, psS32 col1, psS32 row1) 180 180 { 181 181 if (image == NULL || image->data.V == NULL) { … … 220 220 psImageFreeChildren(image); 221 221 222 unsigned intelementSize = PSELEMTYPE_SIZEOF(image->type.type);223 unsigned intnumCols = col1-col0;224 unsigned intnumRows = row1-row0;225 unsigned introwSize = elementSize*numCols;226 unsigned intcolOffset = 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; 227 227 psU8* imageData = image->rawDataBuffer; 228 for ( introw = row0; row < row1; row++) {228 for (psS32 row = row0; row < row1; row++) { 229 229 memmove(imageData,image->data.U8[row] + colOffset,rowSize); 230 230 imageData += rowSize; 231 231 } 232 232 233 *( unsigned int*)&image->numRows = numRows;234 *( unsigned int*)&image->numCols = numCols;233 *(psU32*)&image->numRows = numRows; 234 *(psU32*)&image->numCols = numCols; 235 235 236 236 // 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); 238 238 image->rawDataBuffer = psRealloc(image->rawDataBuffer,rowSize*numRows); 239 239 240 240 image->data.V[0] = image->rawDataBuffer; 241 for ( intr = 1; r < numRows; r++) {241 for (psS32 r = 1; r < numRows; r++) { 242 242 image->data.U8[r] = image->data.U8[r-1] + rowSize; 243 243 } … … 250 250 const psImage* restrict in, 251 251 const psImage* restrict mask, 252 unsigned intmaskVal,253 intcol0,254 introw0,255 intcol1,256 introw1,252 psU32 maskVal, 253 psS32 col0, 254 psS32 row0, 255 psS32 col1, 256 psS32 row1, 257 257 psImageCutDirection direction, 258 258 const psStats* stats) … … 261 261 psStats* myStats; 262 262 psElemType type; 263 intinRows;264 intinCols;265 intdelta = 1;263 psS32 inRows; 264 psS32 inCols; 265 psS32 delta = 1; 266 266 psF64* outData; 267 267 … … 349 349 *myStats = *stats; 350 350 351 intnumCols = col1-col0;352 intnumRows = row1-row0;351 psS32 numCols = col1-col0; 352 psS32 numRows = row1-row0; 353 353 354 354 if (direction == PS_CUT_X_POS || direction == PS_CUT_X_NEG) { … … 380 380 case PS_TYPE_##TYPE: { \ 381 381 psMaskType* maskVecData = NULL; \ 382 for ( intc=col0;c<col1;c++) { \382 for (psS32 c=col0;c<col1;c++) { \ 383 383 ps##TYPE *imgData = in->data.TYPE[row0] + c; \ 384 384 ps##TYPE *imgVecData = imgVec->data.TYPE; \ … … 387 387 maskData = (psMaskType* )(mask->data.V[row0]) + c; \ 388 388 } \ 389 for ( intr=row0;r<row1;r++) { \389 for (psS32 r=row0;r<row1;r++) { \ 390 390 *(imgVecData++) = *imgData; \ 391 391 imgData += inCols; \ … … 437 437 psVector* imgVec = NULL; 438 438 psVector* maskVec = NULL; 439 intelementSize = PSELEMTYPE_SIZEOF(type);439 psS32 elementSize = PSELEMTYPE_SIZEOF(type); 440 440 psU32* outPosition = NULL; 441 441 … … 465 465 } 466 466 467 for ( intr = row0; r < row1; r++) {467 for (psS32 r = row0; r < row1; r++) { 468 468 // point the vector struct to the 469 469 // 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); 471 471 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)); 473 473 } 474 474 myStats = psVectorStats(myStats, imgVec, maskVec, maskVal); … … 503 503 const psImage* in, 504 504 const psImage* restrict mask, 505 unsigned intmaskVal,505 psU32 maskVal, 506 506 float startCol, 507 507 float startRow, 508 508 float endCol, 509 509 float endRow, 510 unsigned intnSamples,510 psU32 nSamples, 511 511 psImageInterpolateMode mode) 512 512 { … … 518 518 return NULL; 519 519 } 520 intnumCols = in->numCols;521 intnumRows = in->numRows;520 psS32 numCols = in->numCols; 521 psS32 numRows = in->numRows; 522 522 523 523 if (nSamples < 2) { … … 594 594 case PS_TYPE_##TYPE: { \ 595 595 ps##TYPE* outData = out->data.TYPE; \ 596 for ( inti = 0; i < nSamples; i++) { \596 for (psS32 i = 0; i < nSamples; i++) { \ 597 597 float x = startCol + (float)i*dX; \ 598 598 float y = startRow + (float)i*dY; \ … … 642 642 const psImage* in, 643 643 const psImage* restrict mask, 644 unsigned intmaskVal,644 psU32 maskVal, 645 645 float centerCol, 646 646 float centerRow, … … 659 659 return NULL; 660 660 } 661 intnumCols = in->numCols;662 intnumRows = in->numRows;661 psS32 numCols = in->numCols; 662 psS32 numRows = in->numRows; 663 663 664 664 if (mask != NULL) { … … 734 734 735 735 // size the output vector to proper size. 736 intnumOut = radii->n - 1;736 psS32 numOut = radii->n - 1; 737 737 out = psVectorRecycle(out, numOut, PS_TYPE_F64); 738 738 psF64* outData = out->data.F64; … … 741 741 psF32* rSq = rSqVec->data.F32; 742 742 743 intstartRow = centerRow - rSq[numOut];744 intendRow = centerRow + rSq[numOut];745 intstartCol = centerCol - rSq[numOut];746 intendCol = 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]; 747 747 748 748 if (startRow < 0) { … … 763 763 764 764 // Square the radii data 765 for ( intd = 0; d <= numOut; d++) {765 for (psS32 d = 0; d <= numOut; d++) { 766 766 rSq[d] *= rSq[d]; 767 767 } … … 770 770 psVector** buffer = psAlloc(sizeof(psVector*)*numOut); 771 771 psVector** bufferMask = psAlloc(sizeof(psVector*)*numOut); 772 for ( intlcv = 0; lcv < numOut; lcv++) {772 for (psS32 lcv = 0; lcv < numOut; lcv++) { 773 773 // n.b. alloc enough for the data by making the vectors slightly larger 774 774 // than the area of the region of interest. … … 788 788 float dY; 789 789 float dist; 790 for ( introw=startRow; row <= endRow; row++) {790 for (psS32 row=startRow; row <= endRow; row++) { 791 791 psF32* inRow = in->data.F32[row]; 792 792 psMaskType* maskRow = NULL; … … 794 794 maskRow = mask->data.PS_TYPE_MASK_DATA[row]; 795 795 } 796 for ( intcol=startCol; col <= endCol; col++) {796 for (psS32 col=startCol; col <= endCol; col++) { 797 797 dX = centerCol - (float)col - 0.5f; 798 798 dY = centerRow - (float)row - 0.5f; 799 799 dist = dX*dX+dY*dY; 800 for ( intr = 0; r < numOut; r++) {800 for (psS32 r = 0; r < numOut; r++) { 801 801 if (rSq[r] < dist && dist < rSq[r+1]) { 802 intn = buffer[r]->n;802 psS32 n = buffer[r]->n; 803 803 if (n == buffer[r]->nalloc) { // in case buffers already full, expand 804 804 buffer[r] = psVectorRealloc(buffer[r], n*2); … … 825 825 *myStats = *stats; 826 826 827 for ( intr = 0; r < numOut; r++) {827 for (psS32 r = 0; r < numOut; r++) { 828 828 myStats = psVectorStats(myStats,buffer[r], bufferMask[r],maskVal); 829 829 (void)p_psGetStatValue(myStats,&statVal); … … 833 833 psFree(myStats); 834 834 835 for ( intlcv = 0; lcv < numOut; lcv++) {835 for (psS32 lcv = 0; lcv < numOut; lcv++) { 836 836 psFree(buffer[lcv]); 837 837 psFree(bufferMask[lcv]); -
trunk/psLib/src/image/psImageExtraction.h
r2088 r2204 10 10 * @author Robert DeSonia, MHPCC 11 11 * 12 * @version $Revision: 1.1 8$ $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 $ 14 14 * 15 15 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 54 54 psImage* psImageSubset( 55 55 psImage* image, ///< Parent image. 56 intcol0, ///< starting column of subimage57 introw0, ///< starting row of subimage58 intcol1, ///< exclusive end column of subimage.59 introw1 ///< exclusive end row of subimage56 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 60 60 ); 61 61 … … 93 93 psImage* psImageTrim( 94 94 psImage* image, ///< image to trim 95 intcol0, ///< column of trim region's left boundary96 introw0, ///< row of trim region's lower boundary97 intcol1, ///< column of trim region's right boundary98 introw1 ///< row of trim region's upper boundary95 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 99 99 ); 100 100 … … 130 130 const psImage* restrict input, ///< the input image in which to perform the slice 131 131 const psImage* restrict mask, ///< the mask for the input image. 132 unsigned intmaskVal, ///< the mask value to apply to the mask133 intcol0, ///< the leftmost column of the slice region134 introw0, ///< the bottommost row of the slice region135 intcol1, ///< exclusive end column of the slice region136 introw1, ///< exclusive end row of the slice region132 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 137 137 psImageCutDirection direction, ///< the slice dimension and direction 138 138 const psStats* stats ///< the statistic to perform in slice operation … … 161 161 const psImage* input, ///< the input image in which to perform the cut 162 162 const psImage* restrict mask, ///< the mask for the input image. 163 unsigned intmaskVal, ///< the mask value to apply to the mask163 psU32 maskVal, ///< the mask value to apply to the mask 164 164 float startCol, ///< the column of the start of the cut line 165 165 float startRow, ///< the row of the start of the cut line 166 166 float endCol, ///< the column of the end of the cut line 167 167 float endRow, ///< the row of the end of the cut line 168 unsigned intnSamples, ///< the number of samples along the cut168 psU32 nSamples, ///< the number of samples along the cut 169 169 psImageInterpolateMode mode ///< the interpolation method to use 170 170 ); … … 187 187 const psImage* input, ///< the input image in which to perform the cut 188 188 const psImage* restrict mask, ///< the mask for the input image. 189 unsigned intmaskVal, ///< the mask value to apply to the mask189 psU32 maskVal, ///< the mask value to apply to the mask 190 190 float centerCol, ///< the column of the center of the cut circle 191 191 float centerRow, ///< the row of the center of the cut circle -
trunk/psLib/src/image/psImageFFT.c
r1983 r2204 5 5 * @author Robert DeSonia, MHPCC 6 6 * 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 $ 9 9 * 10 10 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii 11 11 */ 12 12 #include <unistd.h> 13 #include <stdbool.h>14 13 #include <string.h> 15 14 #include <complex.h> … … 27 26 #define PS_FFTW_PLAN_RIGOR FFTW_ESTIMATE 28 27 29 static bool p_fftwWisdomImported = false;28 static psBool p_fftwWisdomImported = false; 30 29 31 30 psImage* psImageFFT(psImage* out, const psImage* in, psFftDirection direction) 32 31 { 33 unsigned intnumCols;34 unsigned intnumRows;32 psU32 numCols; 33 psU32 numRows; 35 34 psElemType type; 36 35 fftwf_plan plan; … … 77 76 78 77 // n.b. FFTW can perform a in-place transform at the same rate or faster than out-of-place. 79 intsign = ((direction & PS_FFT_FORWARD) != 0) ? FFTW_FORWARD : FFTW_BACKWARD;78 psS32 sign = ((direction & PS_FFT_FORWARD) != 0) ? FFTW_FORWARD : FFTW_BACKWARD; 80 79 out = psImageCopy(out, in, PS_TYPE_C32); 81 80 plan = fftwf_plan_dft_2d(numCols, numRows, … … 118 117 { 119 118 psElemType type; 120 unsigned intnumCols;121 unsigned intnumRows;119 psU32 numCols; 120 psU32 numRows; 122 121 123 122 if (in == NULL) { … … 140 139 141 140 out = psImageRecycle(out, numCols, numRows, PS_TYPE_F32); 142 for ( unsigned introw = 0; row < numRows; row++) {141 for (psU32 row = 0; row < numRows; row++) { 143 142 outRow = out->data.F32[row]; 144 143 inRow = in->data.C32[row]; 145 144 146 for ( unsigned intcol = 0; col < numCols; col++) {145 for (psU32 col = 0; col < numCols; col++) { 147 146 outRow[col] = crealf(inRow[col]); 148 147 } … … 153 152 154 153 out = psImageRecycle(out, numCols, numRows, PS_TYPE_F64); 155 for ( unsigned introw = 0; row < numRows; row++) {154 for (psU32 row = 0; row < numRows; row++) { 156 155 outRow = out->data.F64[row]; 157 156 inRow = in->data.C64[row]; 158 157 159 for ( unsigned intcol = 0; col < numCols; col++) {158 for (psU32 col = 0; col < numCols; col++) { 160 159 outRow[col] = creal(inRow[col]); 161 160 } … … 179 178 { 180 179 psElemType type; 181 unsigned intnumCols;182 unsigned intnumRows;180 psU32 numCols; 181 psU32 numRows; 183 182 184 183 if (in == NULL) { … … 203 202 204 203 out = psImageRecycle(out, numCols, numRows, PS_TYPE_F32); 205 for ( unsigned introw = 0; row < numRows; row++) {204 for (psU32 row = 0; row < numRows; row++) { 206 205 outRow = out->data.F32[row]; 207 206 inRow = in->data.C32[row]; 208 207 209 for ( unsigned intcol = 0; col < numCols; col++) {208 for (psU32 col = 0; col < numCols; col++) { 210 209 outRow[col] = cimagf(inRow[col]); 211 210 } … … 216 215 217 216 out = psImageRecycle(out, numCols, numRows, PS_TYPE_F64); 218 for ( unsigned introw = 0; row < numRows; row++) {217 for (psU32 row = 0; row < numRows; row++) { 219 218 outRow = out->data.F64[row]; 220 219 inRow = in->data.C64[row]; 221 220 222 for ( unsigned intcol = 0; col < numCols; col++) {221 for (psU32 col = 0; col < numCols; col++) { 223 222 outRow[col] = cimag(inRow[col]); 224 223 } … … 241 240 { 242 241 psElemType type; 243 unsigned intnumCols;244 unsigned intnumRows;242 psU32 numCols; 243 psU32 numRows; 245 244 246 245 if (real == NULL || imag == NULL) { … … 282 281 out = psImageRecycle(out, numCols, numRows, PS_TYPE_C32); 283 282 284 for ( unsigned introw = 0; row < numRows; row++) {283 for (psU32 row = 0; row < numRows; row++) { 285 284 outRow = out->data.C32[row]; 286 285 realRow = real->data.F32[row]; 287 286 imagRow = imag->data.F32[row]; 288 287 289 for ( unsigned intcol = 0; col < numCols; col++) {288 for (psU32 col = 0; col < numCols; col++) { 290 289 outRow[col] = realRow[col] + I * imagRow[col]; 291 290 } … … 297 296 298 297 out = psImageRecycle(out, numCols, numRows, PS_TYPE_C64); 299 for ( unsigned introw = 0; row < numRows; row++) {298 for (psU32 row = 0; row < numRows; row++) { 300 299 outRow = out->data.C64[row]; 301 300 realRow = real->data.F64[row]; 302 301 imagRow = imag->data.F64[row]; 303 302 304 for ( unsigned intcol = 0; col < numCols; col++) {303 for (psU32 col = 0; col < numCols; col++) { 305 304 outRow[col] = realRow[col] + I * imagRow[col]; 306 305 } … … 324 323 { 325 324 psElemType type; 326 unsigned intnumCols;327 unsigned intnumRows;325 psU32 numCols; 326 psU32 numRows; 328 327 329 328 if (in == NULL) { … … 346 345 347 346 out = psImageRecycle(out, numCols, numRows, PS_TYPE_C32); 348 for ( unsigned introw = 0; row < numRows; row++) {347 for (psU32 row = 0; row < numRows; row++) { 349 348 outRow = out->data.C32[row]; 350 349 inRow = in->data.C32[row]; 351 350 352 for ( unsigned intcol = 0; col < numCols; col++) {351 for (psU32 col = 0; col < numCols; col++) { 353 352 outRow[col] = crealf(inRow[col]) - I * cimagf(inRow[col]); 354 353 } … … 359 358 360 359 out = psImageRecycle(out, numCols, numRows, PS_TYPE_C64); 361 for ( unsigned introw = 0; row < numRows; row++) {360 for (psU32 row = 0; row < numRows; row++) { 362 361 outRow = out->data.C64[row]; 363 362 inRow = in->data.C64[row]; 364 363 365 for ( unsigned intcol = 0; col < numCols; col++) {364 for (psU32 col = 0; col < numCols; col++) { 366 365 outRow[col] = creal(inRow[col]) - I * cimag(inRow[col]); 367 366 } … … 384 383 { 385 384 psElemType type; 386 unsigned intnumCols;387 unsigned intnumRows;388 intnumElementsSquared;385 psU32 numCols; 386 psU32 numRows; 387 psS32 numElementsSquared; 389 388 390 389 if (in == NULL) { … … 405 404 406 405 out = psImageRecycle(out, numCols, numRows, PS_TYPE_F32); 407 for ( unsigned introw = 0; row < numRows; row++) {406 for (psU32 row = 0; row < numRows; row++) { 408 407 outRow = out->data.F32[row]; 409 408 inRow = in->data.C32[row]; 410 409 411 for ( unsigned intcol = 0; col < numCols; col++) {410 for (psU32 col = 0; col < numCols; col++) { 412 411 real = crealf(inRow[col]); 413 412 imag = cimagf(inRow[col]); … … 422 421 423 422 out = psImageRecycle(out, numCols, numRows, PS_TYPE_F64); 424 for ( unsigned introw = 0; row < numRows; row++) {423 for (psU32 row = 0; row < numRows; row++) { 425 424 outRow = out->data.F64[row]; 426 425 inRow = in->data.C64[row]; 427 426 428 for ( unsigned intcol = 0; col < numCols; col++) {427 for (psU32 col = 0; col < numCols; col++) { 429 428 real = creal(inRow[col]); 430 429 imag = cimag(inRow[col]); -
trunk/psLib/src/image/psImageIO.c
r1941 r2204 7 7 * @author Robert DeSonia, MHPCC 8 8 * 9 * @version $Revision: 1.1 2$ $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 $ 11 11 * 12 12 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 15 15 #include <fitsio.h> 16 16 #include <unistd.h> 17 #include <stdbool.h>18 17 19 18 #include "psImageIO.h" … … 24 23 25 24 psImage* psImageReadSection(psImage* output, 26 intcol,27 introw,28 intnumCols,29 intnumRows,30 intz,25 psS32 col, 26 psS32 row, 27 psS32 numCols, 28 psS32 numRows, 29 psS32 z, 31 30 char *extname, 32 intextnum,31 psS32 extnum, 33 32 char *filename) 34 33 { 35 34 fitsfile *fptr = NULL; /* Pointer to the FITS file */ 36 intstatus = 0; /* CFITSIO file vars */37 intnAxis = 0;38 intanynull = 0;39 intbitPix = 0; /* Pixel type */40 longnAxes[3];41 longfirstPixel[3]; /* lower-left corner of image subset */42 longlastPixel[3]; /* upper-right corner of image subset */43 longincrement[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 */ 44 43 char fitsErr[80] = ""; /* CFITSIO error message string */ 45 inthduType = IMAGE_HDU;46 intfitsDatatype = 0;47 intdatatype = 0;44 psS32 hduType = IMAGE_HDU; 45 psS32 fitsDatatype = 0; 46 psS32 datatype = 0; 48 47 49 48 if (filename == NULL) { … … 228 227 } 229 228 230 bool psImageWriteSection(psImage* input,231 intcol0,232 introw0,233 intz,234 char *extname,235 intextnum,236 char *filename)229 psBool psImageWriteSection(psImage* input, 230 psS32 col0, 231 psS32 row0, 232 psS32 z, 233 char *extname, 234 psS32 extnum, 235 char *filename) 237 236 { 238 intnumCols = 0;239 intnumRows = 0;240 241 intstatus = 0; /* CFITSIO status */237 psS32 numCols = 0; 238 psS32 numRows = 0; 239 240 psS32 status = 0; /* CFITSIO status */ 242 241 fitsfile *fptr = NULL; /* pointer to the FITS file */ 243 longnAxes[3]; /* Image axis vars */244 longfirstPixel[3]; /* First Pixel to read */245 longlastPixel[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 */ 246 245 char fitsErr[80]; /* FITSIO message string */ 247 intdatatype = 0; /* the datatype of the image */248 intbitPix = 0; /* FITS bitPix value */249 inthduType = 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.) */ 250 249 double bscale = 1.0; 251 250 double bzero = 0.0; 252 bool createNewHDU = false;251 psBool createNewHDU = false; 253 252 254 253 /* need a valid image to write */ … … 336 335 } 337 336 } else { 338 intnumHDUs = 0;337 psS32 numHDUs = 0; 339 338 340 339 fits_get_num_hdus(fptr, &numHDUs, &status); -
trunk/psLib/src/image/psImageIO.h
r1442 r2204 10 10 * @author Robert DeSonia, MHPCC 11 11 * 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 $ 14 14 * 15 15 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 17 17 #ifndef PS_IMAGEIO_H 18 18 #define PS_IMAGEIO_H 19 20 #include <stdbool.h>21 19 22 20 #include "psImage.h" … … 34 32 /**< the output psImage to recycle, or NULL if new psImage desired */ 35 33 36 intcol0,34 psS32 col0, 37 35 /**< the column index of the origin to start reading */ 38 36 39 introw0,37 psS32 row0, 40 38 /**< the row index of the origin to start reading */ 41 39 42 intnumCols,40 psS32 numCols, 43 41 /**< the number of desired columns to read */ 44 42 45 intnumRows,43 psS32 numRows, 46 44 /**< the number of desired rows to read */ 47 45 48 intz,46 psS32 z, 49 47 /**< the z index to read if file is organized as a 3D image cube. */ 50 48 … … 54 52 */ 55 53 56 intextnum,54 psS32 extnum, 57 55 /**< the image extension to read (0=PHU, 1=first extension, etc.) This is 58 56 * only used if extname is NULL … … 65 63 /** Read an image or subimage from a FITS file specified by a filename. 66 64 * 67 * return bool TRUE is successful, otherwise FALSE.65 * return psBool TRUE is successful, otherwise FALSE. 68 66 */ 69 bool psImageWriteSection(67 psBool psImageWriteSection( 70 68 psImage* input, 71 69 /**< the psImage to write */ 72 70 73 intcol0,71 psS32 col0, 74 72 /**< the column index of the origin to start writing */ 75 73 76 introw0,74 psS32 row0, 77 75 /**< the row index of the origin to start writing */ 78 76 79 intz,77 psS32 z, 80 78 /**< the z index to start writing */ 81 79 … … 85 83 */ 86 84 87 intextnum,85 psS32 extnum, 88 86 /**< the image extension to write (0=PHU, 1=first extension, etc.) This is 89 87 * only used if extname is NULL. -
trunk/psLib/src/image/psImageManip.c
r2105 r2204 10 10 * @author Ross Harman, MHPCC 11 11 * 12 * @version $Revision: 1.2 8$ $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 $ 14 14 * 15 15 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 18 18 #include <math.h> // for isfinite(), etc. 19 19 #include <stdlib.h> 20 #include <stdbool.h>21 20 #include <string.h> // for memcpy, etc. 22 21 … … 29 28 #include "psImageErrors.h" 30 29 31 intpsImageClip(psImage* input,32 psF64 min,33 psF64 vmin,34 psF64 max,35 psF64 vmax)30 psS32 psImageClip(psImage* input, 31 psF64 min, 32 psF64 vmin, 33 psF64 max, 34 psF64 vmax) 36 35 { 37 intnumClipped = 0;38 unsigned intnumRows;39 unsigned intnumCols;36 psS32 numClipped = 0; 37 psU32 numRows; 38 psU32 numCols; 40 39 41 40 if (input == NULL) { … … 72 71 (psF64)PS_MIN_##type,(psF64)PS_MAX_##type); \ 73 72 } \ 74 for ( unsigned introw = 0;row<numRows;row++) { \73 for (psU32 row = 0;row<numRows;row++) { \ 75 74 ps##type* inputRow = input->data.type[row]; \ 76 for ( unsigned intcol = 0; col < numCols; col++) { \75 for (psU32 col = 0; col < numCols; col++) { \ 77 76 if ((psF64)inputRow[col] < min) { \ 78 77 inputRow[col] = (ps##type)vmin; \ … … 103 102 (psF64)PS_MIN_##type,(psF64)PS_MAX_##type); \ 104 103 } \ 105 for ( unsigned introw = 0;row<numRows;row++) { \104 for (psU32 row = 0;row<numRows;row++) { \ 106 105 ps##type* inputRow = input->data.type[row]; \ 107 for ( unsigned intcol = 0; col < numCols; col++) { \106 for (psU32 col = 0; col < numCols; col++) { \ 108 107 if (absfcn(inputRow[col]) < min) { \ 109 108 inputRow[col] = (ps##type)vmin; \ … … 144 143 } 145 144 146 intpsImageClipNaN(psImage* input,147 psF64 value)145 psS32 psImageClipNaN(psImage* input, 146 psF64 value) 148 147 { 149 intnumClipped = 0;150 unsigned intnumRows;151 unsigned intnumCols;148 psS32 numClipped = 0; 149 psU32 numRows; 150 psU32 numCols; 152 151 153 152 if (input == NULL) { … … 161 160 #define psImageClipNaNCase(type) \ 162 161 case PS_TYPE_##type: \ 163 for ( unsigned introw = 0;row<numRows;row++) { \162 for (psU32 row = 0;row<numRows;row++) { \ 164 163 ps##type* inputRow = input->data.type[row]; \ 165 for ( unsigned intcol = 0; col < numCols; col++) { \164 for (psU32 col = 0; col < numCols; col++) { \ 166 165 if (! isfinite(inputRow[col])) { \ 167 166 inputRow[col] = (ps##type)value; \ … … 190 189 } 191 190 192 intpsImageOverlaySection(psImage* image,193 const psImage* overlay,194 intcol0,195 introw0,196 const char *op)191 psS32 psImageOverlaySection(psImage* image, 192 const psImage* overlay, 193 psS32 col0, 194 psS32 row0, 195 const char *op) 197 196 { 198 unsigned intimageNumRows;199 unsigned intimageNumCols;200 unsigned intoverlayNumRows;201 unsigned intoverlayNumCols;202 unsigned intimageRowLimit;203 unsigned intimageColLimit;197 psU32 imageNumRows; 198 psU32 imageNumCols; 199 psU32 overlayNumRows; 200 psU32 overlayNumCols; 201 psU32 imageRowLimit; 202 psU32 imageColLimit; 204 203 psElemType type; 205 204 … … 257 256 #define psImageOverlayCase(DATATYPE) \ 258 257 case PS_TYPE_##DATATYPE: \ 259 for ( unsigned introw=row0;row<imageRowLimit;row++) { \258 for (psU32 row=row0;row<imageRowLimit;row++) { \ 260 259 ps##DATATYPE* imageRow = image->data.DATATYPE[row]; \ 261 260 ps##DATATYPE* overlayRow = overlay->data.DATATYPE[row-row0]; \ 262 for ( unsigned intcol=col0;col<imageColLimit;col++) { \261 for (psU32 col=col0;col<imageColLimit;col++) { \ 263 262 switch (*op) { \ 264 263 case '+': \ … … 315 314 } 316 315 317 intpsImageClipComplexRegion(psImage* input,318 psC64 min,319 psC64 vmin,320 psC64 max,321 psC64 vmax)316 psS32 psImageClipComplexRegion(psImage* input, 317 psC64 min, 318 psC64 vmin, 319 psC64 max, 320 psC64 vmax) 322 321 { 323 intnumClipped = 0;324 unsigned intnumRows;325 unsigned intnumCols;322 psS32 numClipped = 0; 323 psU32 numRows; 324 psU32 numCols; 326 325 psF64 realMin = creal(min); 327 326 psF64 imagMin = cimag(min); … … 374 373 break; \ 375 374 } \ 376 for ( unsigned introw = 0;row<numRows;row++) { \375 for (psU32 row = 0;row<numRows;row++) { \ 377 376 ps##type* inputRow = input->data.type[row]; \ 378 for ( unsigned intcol = 0; col < numCols; col++) { \377 for (psU32 col = 0; col < numCols; col++) { \ 379 378 if ( (realfcn(inputRow[col]) > realMax) || (imagfcn(inputRow[col]) > imagMax) ) { \ 380 379 inputRow[col] = (ps##type)vmax; \ … … 411 410 const psImage* restrict mask, 412 411 psMaskType maskVal, 413 unsigned intscale,412 psU32 scale, 414 413 const psStats* stats) 415 414 { 416 intinRows;417 intinCols;418 intoutRows;419 intoutCols;415 psS32 inRows; 416 psS32 inCols; 417 psS32 outRows; 418 psS32 outCols; 420 419 psVector* vec; // vector to hold the values of a single bin. 421 420 psVector* maskVec = NULL; // vector to hold the mask of a single bin. … … 491 490 ps##type* vecData = vec->data.type; \ 492 491 psMaskType* inRowMask = NULL; \ 493 for ( introw = 0; row < outRows; row++) { \492 for (psS32 row = 0; row < outRows; row++) { \ 494 493 outRowData = out->data.type[row]; \ 495 intinCurrentRow = row*scale; \496 intinNextRow = (row+1)*scale; \497 for ( intcol = 0; col < outCols; col++) { \498 intinCurrentCol = col*scale; \499 intinNextCol = (col+1)*scale; \500 intn = 0; \501 for ( intinRow = 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++) { \ 502 501 ps##type* inRowData = in->data.type[inRow]; \ 503 502 if (mask != NULL) { \ 504 503 inRowMask = mask->data.PS_TYPE_MASK_DATA[inRow]; \ 505 504 } \ 506 for ( intinCol = inCurrentCol; inCol < inNextCol && inCol < inCols; inCol++) { \505 for (psS32 inCol = inCurrentCol; inCol < inNextCol && inCol < inCols; inCol++) { \ 507 506 if (maskData != NULL) { \ 508 507 maskData[n] = inRowMask[inCol]; \ … … 555 554 psImage* psImageResample(psImage* out, 556 555 const psImage* in, 557 intscale,556 psS32 scale, 558 557 psImageInterpolateMode mode) 559 558 { 560 intoutRows;561 intoutCols;559 psS32 outRows; 560 psS32 outCols; 562 561 float invScale; 563 562 … … 597 596 case PS_TYPE_##TYPE: { \ 598 597 out = psImageRecycle(out,outCols, outRows, PS_TYPE_##TYPE); \ 599 for ( introw=0;row<outRows;row++) { \598 for (psS32 row=0;row<outRows;row++) { \ 600 599 ps##TYPE* rowData = out->data.TYPE[row]; \ 601 600 float inRow = (float)row * invScale; \ 602 for ( intcol=0;col<outCols;col++) { \601 for (psS32 col=0;col<outCols;col++) { \ 603 602 rowData[col] = psImagePixelInterpolate(in,(float)col*invScale,inRow,NULL,0,0,mode); \ 604 603 } \ … … 637 636 psImage* psImageRoll(psImage* out, 638 637 const psImage* in, 639 intdx,640 intdy)638 psS32 dx, 639 psS32 dy) 641 640 { 642 intoutRows;643 intoutCols;644 intelementSize;641 psS32 outRows; 642 psS32 outCols; 643 psS32 elementSize; 645 644 646 645 if (in == NULL) { … … 669 668 } 670 669 671 intsegment1Size = elementSize * (outCols - dx);672 intsegment2Size = elementSize * dx;673 674 for ( introw = 0; row < outRows; row++) {675 intinRowNumber = 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; 676 675 677 676 if (inRowNumber >= outRows) { … … 706 705 if (fabsf(angle - 90.0f) < FLT_EPSILON) { 707 706 // perform 1/4 rotate counter-clockwise 708 intnumRows = in->numCols;709 intnumCols = in->numRows;710 intlastCol = numCols - 1;707 psS32 numRows = in->numCols; 708 psS32 numCols = in->numRows; 709 psS32 lastCol = numCols - 1; 711 710 psElemType type = in->type.type; 712 711 … … 716 715 case PS_TYPE_##TYPE: { \ 717 716 ps##TYPE** inData = in->data.TYPE; \ 718 for ( introw=0;row<numRows;row++) { \717 for (psS32 row=0;row<numRows;row++) { \ 719 718 ps##TYPE* outRow = out->data.TYPE[row]; \ 720 for ( intcol=0;col<numCols;col++) { \719 for (psS32 col=0;col<numCols;col++) { \ 721 720 outRow[col] = inData[lastCol-col][row]; \ 722 721 } \ … … 752 751 } else if (fabsf(angle - 180.0f) < FLT_EPSILON) { 753 752 // perform 1/2 rotate 754 intnumRows = in->numRows;755 intlastRow = numRows - 1;756 intnumCols = in->numCols;757 intlastCol = numCols - 1;753 psS32 numRows = in->numRows; 754 psS32 lastRow = numRows - 1; 755 psS32 numCols = in->numCols; 756 psS32 lastCol = numCols - 1; 758 757 psElemType type = in->type.type; 759 758 … … 762 761 #define PSIMAGE_ROTATE_180_CASE(TYPE) \ 763 762 case PS_TYPE_##TYPE: { \ 764 for ( introw=0;row<numRows;row++) { \763 for (psS32 row=0;row<numRows;row++) { \ 765 764 ps##TYPE* outRow = out->data.TYPE[row]; \ 766 765 ps##TYPE* inRow = in->data.TYPE[lastRow-row]; \ 767 for ( intcol=0;col<numCols;col++) { \766 for (psS32 col=0;col<numCols;col++) { \ 768 767 outRow[col] = inRow[lastCol - col]; \ 769 768 } \ … … 799 798 } else if (fabsf(angle - 270.0f) < FLT_EPSILON) { 800 799 // perform 1/4 rotate clockwise 801 intnumRows = in->numCols;802 intlastRow = numRows - 1;803 intnumCols = in->numRows;800 psS32 numRows = in->numCols; 801 psS32 lastRow = numRows - 1; 802 psS32 numCols = in->numRows; 804 803 psElemType type = in->type.type; 805 804 … … 809 808 case PS_TYPE_##TYPE: { \ 810 809 ps##TYPE** inData = in->data.TYPE; \ 811 for ( introw=0;row<numRows;row++) { \810 for (psS32 row=0;row<numRows;row++) { \ 812 811 ps##TYPE* outRow = out->data.TYPE[row]; \ 813 for ( intcol=0;col<numCols;col++) { \812 for (psS32 col=0;col<numCols;col++) { \ 814 813 outRow[col] = inData[col][lastRow-row]; \ 815 814 } \ … … 847 846 } else { 848 847 psElemType type = in->type.type; 849 intnumRows = in->numRows;850 intnumCols = in->numCols;848 psS32 numRows = in->numRows; 849 psS32 numCols = in->numCols; 851 850 float centerX = (float)(numCols) / 2.0f; 852 851 float centerY = (float)(numRows) / 2.0f; … … 859 858 // y' = y cos(t) - x sin(t); i.e. y' = (y-centerY)*cosT - (x-centerX)*sinT; 860 859 861 intoutCols = ceil(abs(numCols * cosT) + abs(numRows * sinT)) + 1;862 intoutRows = 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; 863 862 float minX = (float)outCols / -2.0f; 864 intintMinY = outRows / -2;863 psS32 intMinY = outRows / -2; 865 864 866 865 out = psImageRecycle(out, outCols, outRows, type); … … 906 905 float inY; \ 907 906 ps##TYPE* outRow; \ 908 for ( inty = 0; y < outRows; y++) { \907 for (psS32 y = 0; y < outRows; y++) { \ 909 908 inX = minXTimesCosTPlusCenterX + (y+intMinY) * sinT; \ 910 909 inY = CenterYMinusminXTimesSinT + (y+intMinY) * cosT; \ 911 910 outRow = out->data.TYPE[y]; \ 912 for ( intx = 0; x < outCols; x++) { \911 for (psS32 x = 0; x < outCols; x++) { \ 913 912 outRow[x] = p_psImagePixelInterpolate##MODE##_##TYPE(in,inX,inY,NULL,0,unexposedValue); \ 914 913 inX += cosT; \ … … 993 992 psImageInterpolateMode mode) 994 993 { 995 intoutRows;996 intoutCols;997 intelementSize;994 psS32 outRows; 995 psS32 outCols; 996 psS32 elementSize; 998 997 psElemType type; 999 998 … … 1030 1029 break; \ 1031 1030 } \ 1032 for ( introw=0;row<outRows;row++) { \1031 for (psS32 row=0;row<outRows;row++) { \ 1033 1032 ps##TYPE* outRow = out->data.TYPE[row]; \ 1034 1033 float y = dy+(float)row; \ 1035 for ( intcol=0;col<outCols;col++) { \1034 for (psS32 col=0;col<outCols;col++) { \ 1036 1035 outRow[col] = p_psImagePixelInterpolate##MODE##_##TYPE( \ 1037 1036 in,dx+(float)col,y,NULL,0,unexposedValue); \ -
trunk/psLib/src/image/psImageManip.h
r1635 r2204 11 11 * @author Ross Harman, MHPCC 12 12 * 13 * @version $Revision: 1.1 3$ $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 $ 15 15 * 16 16 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 30 30 * defined for psU8, psU16, psS8, psS16, psF32, psF64, psC32, and psC64. 31 31 * 32 * @return intThe number of clipped pixels32 * @return psS32 The number of clipped pixels 33 33 */ 34 intpsImageClip(34 psS32 psImageClip( 35 35 psImage* input, ///< the image to clip 36 36 psF64 min, ///< the minimum image value allowed … … 47 47 * This function is defined for psC32, and psC64 imagery only. 48 48 * 49 * @return intThe number of clipped pixels49 * @return psS32 The number of clipped pixels 50 50 */ 51 intpsImageClipComplexRegion(51 psS32 psImageClipComplexRegion( 52 52 psImage* input, ///< the image to clip 53 53 psC64 min, ///< the minimum image value allowed … … 62 62 * function is defined for psF32, psF64, psC32, and psC64. 63 63 * 64 * @return intThe number of clipped pixels64 * @return psS32 The number of clipped pixels 65 65 */ 66 intpsImageClipNaN(66 psS32 psImageClipNaN( 67 67 psImage* input, ///< the image to clip 68 68 psF64 value ///< the value to set all NaN/Inf values to … … 78 78 * function is defined for psU8, psS8, psS16, psF32, psF64, psC32, and psC64. 79 79 * 80 * @return int0 if success, non-zero if failed.80 * @return psS32 0 if success, non-zero if failed. 81 81 */ 82 intpsImageOverlaySection(82 psS32 psImageOverlaySection( 83 83 psImage* image, ///< target image 84 84 const psImage* overlay, ///< the overlay image 85 intcol0, ///< the column to start overlay86 introw0, ///< the row to start overlay85 psS32 col0, ///< the column to start overlay 86 psS32 row0, ///< the row to start overlay 87 87 const char *op ///< the operation to perform for overlay 88 88 ); … … 103 103 const psImage* restrict mask, ///< mask for input image. If NULL, no masking is done. 104 104 psMaskType maskVal, ///< the bits to check in mask. 105 unsigned intscale, ///< the scale to rebin for each dimension105 psU32 scale, ///< the scale to rebin for each dimension 106 106 const psStats* stats 107 107 ///< the statistic to perform when rebinning. Only one method should be set. … … 121 121 psImage* out, ///< an psImage to recycle. If NULL, a new image is created 122 122 const psImage* in, ///< input image 123 intscale, ///< resample scaling factor123 psS32 scale, ///< resample scaling factor 124 124 psImageInterpolateMode mode ///< the interpolation mode used in resampling 125 125 ); … … 176 176 psImage* out, ///< an psImage to recycle. If NULL, a new image is created 177 177 const psImage* in, ///< input image 178 intdx, ///< number of pixels to roll in the x-dimension179 intdy ///< number of pixels to roll in the y-dimension178 psS32 dx, ///< number of pixels to roll in the x-dimension 179 psS32 dy ///< number of pixels to roll in the y-dimension 180 180 ); 181 181 -
trunk/psLib/src/image/psImageStats.c
r2102 r2204 9 9 * @author GLG, MHPCC 10 10 * 11 * @version $Revision: 1.4 3$ $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 $ 13 13 * 14 14 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 40 40 psImage* in, 41 41 psImage* mask, 42 intmaskVal)42 psS32 maskVal) 43 43 { 44 44 psVector* junkData = NULL; … … 106 106 psImage* in, 107 107 psImage* mask, 108 unsigned intmaskVal)108 psU32 maskVal) 109 109 { 110 110 psVector* junkData = NULL; … … 150 150 151 151 // XXX: Why do we have this function? 152 float *p_psCalcScaleFactorsFit( intn)153 { 154 inti = 0;152 float *p_psCalcScaleFactorsFit(psS32 n) 153 { 154 psS32 i = 0; 155 155 float tmp = 0.0; 156 156 float *scalingFactors = (float *)psAlloc(n * sizeof(float)); … … 175 175 output a vector of evenly spaced floating point values between -1.0:1.0. 176 176 *****************************************************************************/ 177 float *p_psCalcScaleFactorsEval( intn)178 { 179 inti = 0;177 float *p_psCalcScaleFactorsEval(psS32 n) 178 { 179 psS32 i = 0; 180 180 float tmp = 0.0; 181 181 … … 196 196 197 197 // XXX: Use a static array of CHebyshev polynomials. 198 psPolynomial1D **p_psCreateChebyshevPolys( intmaxChebyPoly)198 psPolynomial1D **p_psCreateChebyshevPolys(psS32 maxChebyPoly) 199 199 { 200 200 if (maxChebyPoly < 1) { … … 202 202 } 203 203 psPolynomial1D **chebPolys = NULL; 204 inti = 0;205 intj = 0;204 psS32 i = 0; 205 psS32 j = 0; 206 206 207 207 chebPolys = (psPolynomial1D **) psAlloc(maxChebyPoly * sizeof(psPolynomial1D *)); … … 245 245 const psImage* input) 246 246 { 247 intx = 0;248 inty = 0;249 inti = 0;250 intj = 0;247 psS32 x = 0; 248 psS32 y = 0; 249 psS32 i = 0; 250 psS32 j = 0; 251 251 float **sums = NULL; 252 252 psPolynomial1D* *chebPolys = NULL; 253 intmaxChebyPoly = 0;253 psS32 maxChebyPoly = 0; 254 254 float *cScalingFactors = NULL; 255 255 float *rScalingFactors = NULL; … … 365 365 psImage* psImageEvalPolynomial(psImage* input, const psPolynomial2D* coeffs) 366 366 { 367 intx = 0;368 inty = 0;369 inti = 0;370 intj = 0;367 psS32 x = 0; 368 psS32 y = 0; 369 psS32 i = 0; 370 psS32 j = 0; 371 371 // float **sums = NULL; 372 372 psPolynomial1D* *chebPolys = NULL; 373 intmaxChebyPoly = 0;373 psS32 maxChebyPoly = 0; 374 374 float *cScalingFactors = NULL; 375 375 float *rScalingFactors = NULL; -
trunk/psLib/src/image/psImageStats.h
r1951 r2204 9 9 * @author George Gusciora, MHPCC 10 10 * 11 * @version $Revision: 1.1 7$ $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 $ 13 13 * 14 14 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 40 40 psImage* in, ///< image (or subimage) to calculate stats 41 41 psImage* mask, ///< mask data for image (NULL ok) 42 intmaskVal ///< mask Mask for mask42 psS32 maskVal ///< mask Mask for mask 43 43 ); 44 44 … … 55 55 psImage* in, ///< Image data to be histogramed. 56 56 psImage* mask, ///< mask data for image (NULL ok) 57 unsigned intmaskVal ///< mask Mask for mask57 psU32 maskVal ///< mask Mask for mask 58 58 ); 59 59
Note:
See TracChangeset
for help on using the changeset viewer.
