Changeset 12431 for trunk/psLib/src/imageops
- Timestamp:
- Mar 13, 2007, 2:39:51 PM (19 years ago)
- Location:
- trunk/psLib/src/imageops
- Files:
-
- 9 edited
-
psImageGeomManip.c (modified) (15 diffs)
-
psImageGeomManip.h (modified) (9 diffs)
-
psImageMaskOps.c (modified) (2 diffs)
-
psImagePixelExtract.c (modified) (5 diffs)
-
psImagePixelManip.c (modified) (7 diffs)
-
psImagePixelManip.h (modified) (4 diffs)
-
psImageStats.c (modified) (2 diffs)
-
psImageStructManip.c (modified) (3 diffs)
-
psImageStructManip.h (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/src/imageops/psImageGeomManip.c
r12330 r12431 10 10 * @author Ross Harman, MHPCC 11 11 * 12 * @version $Revision: 1.3 7$ $Name: not supported by cvs2svn $13 * @date $Date: 2007-03- 08 22:12:56$12 * @version $Revision: 1.38 $ $Name: not supported by cvs2svn $ 13 * @date $Date: 2007-03-14 00:39:50 $ 14 14 * 15 15 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 20 20 #endif 21 21 22 #include <complex.h>23 22 #include <math.h> // for isfinite(), etc. 24 23 #include <stdlib.h> … … 158 157 PS_IMAGE_REBIN_CASE(F32); 159 158 PS_IMAGE_REBIN_CASE(F64); 160 // PS_IMAGE_REBIN_CASE(C32); Not valid since psVectorStats doesn't allow161 // PS_IMAGE_REBIN_CASE(C64); Not valid since psVectorStats doesn't allow162 159 163 160 default: { … … 241 238 PSIMAGE_RESAMPLE_CASE(F32) 242 239 PSIMAGE_RESAMPLE_CASE(F64) 243 PSIMAGE_RESAMPLE_CASE(C32)244 PSIMAGE_RESAMPLE_CASE(C64)245 240 default: { 246 241 char* typeStr; … … 312 307 const psImage* input, 313 308 float angle, 314 double complexexposed,309 double exposed, 315 310 psImageInterpolateMode mode) 316 311 { … … 356 351 PSIMAGE_ROTATE_LEFT_90(F32); 357 352 PSIMAGE_ROTATE_LEFT_90(F64); 358 PSIMAGE_ROTATE_LEFT_90(C32);359 PSIMAGE_ROTATE_LEFT_90(C64);360 353 361 354 default: { … … 402 395 PSIMAGE_ROTATE_180_CASE(F32); 403 396 PSIMAGE_ROTATE_180_CASE(F64); 404 PSIMAGE_ROTATE_180_CASE(C32);405 PSIMAGE_ROTATE_180_CASE(C64);406 397 407 398 default: { … … 447 438 PSIMAGE_ROTATE_RIGHT_90(F32); 448 439 PSIMAGE_ROTATE_RIGHT_90(F64); 449 PSIMAGE_ROTATE_RIGHT_90(C32);450 PSIMAGE_ROTATE_RIGHT_90(C64);451 440 452 441 default: { … … 504 493 505 494 #define PSIMAGE_ROTATE_ARBITRARY_LOOP(TYPE,MODE) { \ 506 if ( creal(exposed)< PS_MIN_##TYPE || \507 creal(exposed)> PS_MAX_##TYPE || \508 cimag(exposed)< PS_MIN_##TYPE || \509 cimag(exposed)> PS_MAX_##TYPE) { \495 if (exposed < PS_MIN_##TYPE || \ 496 exposed > PS_MAX_##TYPE || \ 497 exposed < PS_MIN_##TYPE || \ 498 exposed > PS_MAX_##TYPE) { \ 510 499 psError(PS_ERR_BAD_PARAMETER_VALUE, true, \ 511 500 _("Specified %s value, %g%+gi, is not the the range of input psImage's valid pixel values (%s), i.e. [%g:%g]."), \ 512 501 "exposed", \ 513 creal(exposed),cimag(exposed), \502 exposed, exposed, \ 514 503 PS_TYPE_##TYPE##_NAME, \ 515 504 (double)PS_MIN_##TYPE,(double)PS_MAX_##TYPE); \ … … 566 555 PSIMAGE_ROTATE_ARBITRARY_LOOP(F64,MODE); \ 567 556 break; \ 568 case PS_TYPE_C32: \569 PSIMAGE_ROTATE_ARBITRARY_LOOP(C32,MODE); \570 break; \571 case PS_TYPE_C64: \572 PSIMAGE_ROTATE_ARBITRARY_LOOP(C64,MODE); \573 break; \574 557 default: { \ 575 558 char* typeStr; \ … … 690 673 float dx, 691 674 float dy, 692 double complexexposed,675 double exposed, 693 676 psImageInterpolateMode mode) 694 677 { … … 714 697 #define PSIMAGE_SHIFT_CASE(MODE,TYPE) \ 715 698 case PS_TYPE_##TYPE: \ 716 if ( creal(exposed)< PS_MIN_##TYPE || \717 creal(exposed)> PS_MAX_##TYPE || \718 cimag(exposed)< PS_MIN_##TYPE || \719 cimag(exposed)> PS_MAX_##TYPE) { \699 if (exposed < PS_MIN_##TYPE || \ 700 exposed > PS_MAX_##TYPE || \ 701 exposed < PS_MIN_##TYPE || \ 702 exposed > PS_MAX_##TYPE) { \ 720 703 psError(PS_ERR_BAD_PARAMETER_VALUE, true, \ 721 704 _("Specified %s value, %g%+gi, is not the the range of input psImage's valid pixel values (%s), i.e. [%g:%g]."), \ 722 705 "exposed", \ 723 creal(exposed),cimag(exposed), \706 exposed,exposed, \ 724 707 PS_TYPE_##TYPE##_NAME, \ 725 708 (double)PS_MIN_##TYPE,(double)PS_MAX_##TYPE); \ … … 755 738 PSIMAGE_SHIFT_CASE(MODE,F32); \ 756 739 PSIMAGE_SHIFT_CASE(MODE,F64); \ 757 PSIMAGE_SHIFT_CASE(MODE,C32); \ 758 PSIMAGE_SHIFT_CASE(MODE,C64); \ 759 \ 740 \ 760 741 default: { \ 761 742 char* typeStr; \ … … 1029 1010 FLIP_X_CASE(PS_TYPE_F32, F32); 1030 1011 FLIP_X_CASE(PS_TYPE_F64, F64); 1031 FLIP_X_CASE(PS_TYPE_C32, C32);1032 FLIP_X_CASE(PS_TYPE_C64, C64);1033 1012 default: 1034 1013 psFree(output); … … 1050 1029 FLIP_Y_CASE(PS_TYPE_F32, F32); 1051 1030 FLIP_Y_CASE(PS_TYPE_F64, F64); 1052 FLIP_Y_CASE(PS_TYPE_C32, C32);1053 FLIP_Y_CASE(PS_TYPE_C64, C64);1054 1031 default: 1055 1032 psFree(output); -
trunk/psLib/src/imageops/psImageGeomManip.h
r11248 r12431 6 6 * @author Robert DeSonia, MHPCC 7 7 * 8 * @version $Revision: 1.1 8$ $Name: not supported by cvs2svn $9 * @date $Date: 2007-0 1-23 22:47:23$8 * @version $Revision: 1.19 $ $Name: not supported by cvs2svn $ 9 * @date $Date: 2007-03-14 00:39:50 $ 10 10 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii 11 11 */ … … 27 27 * specified the number of pixels used to define a new pixel in the output image. 28 28 * The output image is generated from all input image pixels. This function is 29 * defined for psU8, psS8, psS16, psF32, psF64 , psC32, and psC64.29 * defined for psU8, psS8, psS16, psF32, psF64. 30 30 * 31 31 * @return psImage new image formed by rebinning input image. … … 65 65 * center pixel of the image. The rotation is specified in the sense that a 66 66 * positive angle is an anti-clockwise rotation. This function must be 67 * defined for the following types: psU8, psU16, psS8, psS16, psF32, psF64, 68 * psC32, psC64. 67 * defined for the following types: psU8, psU16, psS8, psS16, psF32, psF64. 69 68 * 70 69 * @return psImage* the rotated image result. … … 74 73 const psImage* input, ///< input image 75 74 float angle, ///< the rotation angle in radians. 76 double complex exposed,///< the output image pixel values for non-imagery areas75 double exposed, ///< the output image pixel values for non-imagery areas 77 76 psImageInterpolateMode mode ///< the interpolation mode used 78 77 ); … … 85 84 * output image are lost. Newly exposed pixels are set to the value given by 86 85 * exposed. This function must be defined for the following types: psU8, 87 * psU16, psS8, psS16, psF32, psF64 , psC32, psC64.86 * psU16, psS8, psS16, psF32, psF64. 88 87 * 89 88 * @return psImage* the shifted image result. … … 94 93 float dx, ///< the shift in x direction. 95 94 float dy, ///< the shift in y direction. 96 double complex exposed,///< the output image pixel values for non-imagery areas95 double exposed, ///< the output image pixel values for non-imagery areas 97 96 psImageInterpolateMode mode ///< the interpolation mode to use 98 97 ); … … 105 104 * output image are lost. Newly exposed pixels are set to the value given by 106 105 * exposed. This function must be defined for the following types: psU8, 107 * psU16, psS8, psS16, psF32, psF64 , psC32, psC64.106 * psU16, psS8, psS16, psF32, psF64. 108 107 * 109 108 * This implementation uses a NxN kernel generated based on the interpolation method 110 109 * the image is first shifted by a fractional amount with the kernel, then 111 * shifted in place by an integer amount. 110 * shifted in place by an integer amount. 112 111 * 113 112 * XXX the integer shift portion is not implemented … … 136 135 * The output image is the same dimensions as the input image. Edge pixels 137 136 * wrap to the other side (no values are lost). This function is 138 * defined for psU8, psS8, psS16, psF32, psF64 , psC32, and psC64.137 * defined for psU8, psS8, psS16, psF32, psF64. 139 138 * 140 139 * @return psImage* the rolled version of the input image. … … 169 168 * return to the user. This function must be capable of handling the following 170 169 * types for the input (with corresponding types for the output): psF32, psF64. 171 170 172 171 * 173 172 * @return psImage* The transformed image. -
trunk/psLib/src/imageops/psImageMaskOps.c
r10999 r12431 8 8 * @author David Robbins, MHPCC 9 9 * 10 * @version $Revision: 1. 4$ $Name: not supported by cvs2svn $11 * @date $Date: 2007-0 1-09 22:38:52$10 * @version $Revision: 1.5 $ $Name: not supported by cvs2svn $ 11 * @date $Date: 2007-03-14 00:39:50 $ 12 12 * 13 13 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 18 18 #endif 19 19 20 #include <complex.h>21 20 #include <math.h> // for isfinite(), etc. 22 21 #include <stdlib.h> -
trunk/psLib/src/imageops/psImagePixelExtract.c
r10999 r12431 8 8 * @author Robert DeSonia, MHPCC 9 9 * 10 * @version $Revision: 1.3 0$ $Name: not supported by cvs2svn $11 * @date $Date: 2007-0 1-09 22:38:52$10 * @version $Revision: 1.31 $ $Name: not supported by cvs2svn $ 11 * @date $Date: 2007-03-14 00:39:50 $ 12 12 * 13 13 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 103 103 VECTOR_STORE_ROW_CASE(F32); 104 104 VECTOR_STORE_ROW_CASE(F64); 105 VECTOR_STORE_ROW_CASE(C32);106 VECTOR_STORE_ROW_CASE(C64);107 105 default: 108 106 psError(PS_ERR_BAD_PARAMETER_TYPE, true, … … 193 191 VECTOR_STORE_COL_CASE(F32); 194 192 VECTOR_STORE_COL_CASE(F64); 195 VECTOR_STORE_COL_CASE(C32);196 VECTOR_STORE_COL_CASE(C64);197 193 default: 198 194 psError(PS_ERR_BAD_PARAMETER_TYPE, true, … … 463 459 PSIMAGE_CUT_VERTICAL(F32); 464 460 PSIMAGE_CUT_VERTICAL(F64); 465 PSIMAGE_CUT_VERTICAL(C32); // Not a requirement466 PSIMAGE_CUT_VERTICAL(C64); // Not a requirement467 461 default: { 468 462 char* typeStr; … … 715 709 LINEAR_CUT_CASE(F32); 716 710 LINEAR_CUT_CASE(F64); 717 LINEAR_CUT_CASE(C32);718 LINEAR_CUT_CASE(C64);719 711 720 712 default: { -
trunk/psLib/src/imageops/psImagePixelManip.c
r12256 r12431 10 10 * @author Ross Harman, MHPCC 11 11 * 12 * @version $Revision: 1.2 2$ $Name: not supported by cvs2svn $13 * @date $Date: 2007-03- 06 03:09:58$12 * @version $Revision: 1.23 $ $Name: not supported by cvs2svn $ 13 * @date $Date: 2007-03-14 00:39:50 $ 14 14 * 15 15 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 20 20 #endif 21 21 22 #include <complex.h>23 22 #include <math.h> // for isfinite(), etc. 24 23 #include <stdlib.h> … … 90 89 break; 91 90 92 #define psImageClipCaseComplex(type,absfcn)\93 case PS_TYPE_##type: { \94 if (vmin < PS_MIN_##type || vmin > PS_MAX_##type) { \95 psError(PS_ERR_BAD_PARAMETER_VALUE, true, \96 _("Specified %s value, %g, is outside of psImage type's range (%s: %g to %g)."), \97 "vmin",vmin, PS_TYPE_##type##_NAME, \98 (psF64)PS_MIN_##type,(psF64)PS_MAX_##type); \99 } \100 if (vmax > PS_MAX_##type || vmax < PS_MIN_##type) { \101 psError(PS_ERR_BAD_PARAMETER_VALUE, true, \102 _("Specified %s value, %g, is outside of psImage type's range (%s: %g to %g)."), \103 "vmax",vmax, PS_TYPE_##type##_NAME, \104 (psF64)PS_MIN_##type,(psF64)PS_MAX_##type); \105 } \106 for (psU32 row = 0;row<numRows;row++) { \107 ps##type* inputRow = input->data.type[row]; \108 for (psU32 col = 0; col < numCols; col++) { \109 if (absfcn(inputRow[col]) < min) { \110 inputRow[col] = (ps##type)vmin; \111 numClipped++; \112 } else if (absfcn(inputRow[col]) > max) { \113 inputRow[col] = (ps##type)vmax; \114 numClipped++; \115 } \116 } \117 } \118 } \119 break;120 121 91 psImageClipCase(S8) 122 92 psImageClipCase(S16) … … 129 99 psImageClipCase(F32) 130 100 psImageClipCase(F64) 131 psImageClipCaseComplex(C32, cabsf)132 psImageClipCaseComplex(C64, cabs)133 101 134 102 default: { … … 174 142 psImageClipNaNCase(F32) 175 143 psImageClipNaNCase(F64) 176 psImageClipNaNCase(C32)177 psImageClipNaNCase(C64)178 144 179 145 default: { … … 331 297 psImageOverlayCase(F32,NAN); 332 298 psImageOverlayCase(F64,NAN); 333 psImageOverlayCase(C32,NAN);334 psImageOverlayCase(C64,NAN);335 299 336 300 default: { … … 347 311 } 348 312 349 int psImageClipComplexRegion(psImage* input,350 double complex min,351 double complex vmin,352 double complex max,353 double complex vmax)354 {355 psS32 numClipped = 0;356 psU32 numRows;357 psU32 numCols;358 psF64 realMin = creal(min);359 psF64 imagMin = cimag(min);360 psF64 realMax = creal(max);361 psF64 imagMax = cimag(max);362 363 if (input == NULL) {364 psError(PS_ERR_BAD_PARAMETER_NULL, true,365 _("Can not operate on a NULL psImage."));366 return 0;367 }368 369 if (realMax < realMin) {370 psError(PS_ERR_BAD_PARAMETER_VALUE, true,371 _("Specified real-portion of min value, %g, can not be greater than the real-portion of max value, %g."),372 (double)realMin, (double)realMax);373 return 0;374 }375 if (imagMax < imagMin) {376 psError(PS_ERR_BAD_PARAMETER_VALUE, true,377 _("Specified imaginary-portion of min value, %g, can not be greater than the imaginary-portion of max value, %g."),378 (double)imagMin, (double)imagMax);379 return 0;380 }381 382 numRows = input->numRows;383 numCols = input->numCols;384 385 #define psImageClipComplexRegionCase(type,realfcn,imagfcn) \386 case PS_TYPE_##type: { \387 if (realfcn(vmin) < PS_MIN_##type || imagfcn(vmin) < PS_MIN_##type || \388 realfcn(vmin) > PS_MAX_##type || imagfcn(vmin) > PS_MAX_##type ) { \389 psError(PS_ERR_BAD_PARAMETER_VALUE, true, \390 _("Specified %s value, %g%+gi, is not the the range of input psImage's valid pixel values (%s), i.e. [%g:%g]."), \391 "vmin", creal(vmin), cimag(vmin), \392 PS_TYPE_##type##_NAME, PS_MIN_##type, PS_MAX_##type); \393 break; \394 } \395 if (realfcn(vmax) > PS_MAX_##type || imagfcn(vmax) > PS_MAX_##type || \396 realfcn(vmax) < PS_MIN_##type || imagfcn(vmax) < PS_MIN_##type ) { \397 psError(PS_ERR_BAD_PARAMETER_VALUE, true, \398 _("Specified %s value, %g%+gi, is not the the range of input psImage's valid pixel values (%s), i.e. [%g:%g]."), \399 "vmax", creal(vmax), cimag(vmax), \400 PS_TYPE_##type##_NAME, PS_MIN_##type, PS_MAX_##type); \401 break; \402 } \403 for (psU32 row = 0;row<numRows;row++) { \404 ps##type* inputRow = input->data.type[row]; \405 for (psU32 col = 0; col < numCols; col++) { \406 if ( (realfcn(inputRow[col]) > realMax) || (imagfcn(inputRow[col]) > imagMax) ) { \407 inputRow[col] = (ps##type)vmax; \408 numClipped++; \409 } else if ( (realfcn(inputRow[col]) < realMin) || (imagfcn(inputRow[col]) < imagMin) ){ \410 inputRow[col] = (ps##type)vmin; \411 numClipped++; \412 } \413 } \414 } \415 } \416 break;417 418 switch (input->type.type) {419 420 psImageClipComplexRegionCase(C32, crealf, cimagf)421 psImageClipComplexRegionCase(C64, creal, cimag)422 423 default: {424 char* typeStr;425 PS_TYPE_NAME(typeStr,input->type.type);426 psError(PS_ERR_BAD_PARAMETER_TYPE, true,427 _("Specified psImage type, %s, is not supported."),428 typeStr);429 }430 }431 432 return numClipped;433 } -
trunk/psLib/src/imageops/psImagePixelManip.h
r11248 r12431 5 5 * @author Robert DeSonia, MHPCC 6 6 * 7 * @version $Revision: 1.1 6$ $Name: not supported by cvs2svn $8 * @date $Date: 2007-0 1-23 22:47:23$7 * @version $Revision: 1.17 $ $Name: not supported by cvs2svn $ 8 * @date $Date: 2007-03-14 00:39:50 $ 9 9 * 10 10 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 26 26 * All pixels with values less than min are set to the value vmin. all pixels 27 27 * with values greater than max are set to the value vmax. This function is 28 * defined for psU8, psU16, psS8, psS16, psF32, psF64 , psC32, and psC64.28 * defined for psU8, psU16, psS8, psS16, psF32, psF64. 29 29 * 30 30 * @return int The number of clipped pixels … … 38 38 ); 39 39 40 /** Clip image values outside of a specified complex region41 *42 * All pixels outside of the rectangular region in complex space formed by43 * the min and max input parameters are set to the value vmax (if either44 * the real or imaginary portion exceeds the respective max values), or vmin.45 * This function is defined for psC32, and psC64 imagery only.46 *47 * @return int The number of clipped pixels48 */49 int psImageClipComplexRegion(50 psImage* input, ///< the image to clip51 double complex min, ///< the minimum image value allowed52 double complex vmin, ///< the value pixels < min are set to53 double complex max, ///< the maximum image value allowed54 double complex vmax ///< the value pixels > max are set to55 );56 57 40 /** Clip NaN image pixels to given value. 58 41 * 59 42 * Pixels with NaN, +Inf, or -Inf values are set to the specified value. This 60 * function is defined for psF32, psF64 , psC32, and psC64.43 * function is defined for psF32, psF64. 61 44 * 62 45 * @return int The number of clipped pixels … … 74 57 * OVERLAY value to image value), "-" (subtract OVERLAY from image), "*" 75 58 * (multiply OVERLAY times image), "/" (divide image by OVERLAY). This 76 * function is defined for psU8, psS8, psS16, psF32, psF64 , psC32, and psC64.59 * function is defined for psU8, psS8, psS16, psF32, psF64. 77 60 * 78 61 * @return int 0 if success, non-zero if failed. -
trunk/psLib/src/imageops/psImageStats.c
r11760 r12431 9 9 * @author GLG, MHPCC 10 10 * 11 * @version $Revision: 1.10 5$ $Name: not supported by cvs2svn $12 * @date $Date: 2007-0 2-13 03:08:17$11 * @version $Revision: 1.106 $ $Name: not supported by cvs2svn $ 12 * @date $Date: 2007-03-14 00:39:50 $ 13 13 * 14 14 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 634 634 case PS_TYPE_F32: 635 635 case PS_TYPE_F64: 636 case PS_TYPE_C32:637 case PS_TYPE_C64:638 636 default: 639 637 // XXX this should include the mask type (as a string) -
trunk/psLib/src/imageops/psImageStructManip.c
r10999 r12431 8 8 * @author Robert DeSonia, MHPCC 9 9 * 10 * @version $Revision: 1.1 3$ $Name: not supported by cvs2svn $11 * @date $Date: 2007-0 1-09 22:38:52$10 * @version $Revision: 1.14 $ $Name: not supported by cvs2svn $ 11 * @date $Date: 2007-03-14 00:39:50 $ 12 12 * 13 13 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 239 239 PSIMAGE_ELEMENT_COPY(input,F64,OUT,OUTTYPE,elements); \ 240 240 break; \ 241 case PS_TYPE_C32: \242 PSIMAGE_ELEMENT_COPY(input,C32,OUT,OUTTYPE,elements); \243 break; \244 case PS_TYPE_C64: \245 PSIMAGE_ELEMENT_COPY(input,C64,OUT,OUTTYPE,elements); \246 break; \247 241 default: \ 248 242 break; \ … … 280 274 case PS_TYPE_F64: 281 275 PSIMAGE_COPY_CASE(output, F64); 282 break;283 case PS_TYPE_C32:284 PSIMAGE_COPY_CASE(output, C32);285 break;286 case PS_TYPE_C64:287 PSIMAGE_COPY_CASE(output, C64);288 276 break; 289 277 default: { -
trunk/psLib/src/imageops/psImageStructManip.h
r11248 r12431 5 5 * @author Robert DeSonia, MHPCC 6 6 * 7 * @version $Revision: 1. 5$ $Name: not supported by cvs2svn $8 * @date $Date: 2007-0 1-23 22:47:23$7 * @version $Revision: 1.6 $ $Name: not supported by cvs2svn $ 8 * @date $Date: 2007-03-14 00:39:50 $ 9 9 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii 10 10 */ … … 29 29 * parent image in that dimension. The entire subraster must be contained within the raster of 30 30 * the parent image. Note that the refCounter for the parent should be incremented. This 31 * function must be defined for the following types: psU8, psU16, psS8, psS16, psF32, psF64, 32 * psC32, psC64. 31 * function must be defined for the following types: psU8, psU16, psS8, psS16, psF32, psF64. 33 32 * 34 33 * @return psImage* : Pointer to psImage.
Note:
See TracChangeset
for help on using the changeset viewer.
