Changeset 7380
- Timestamp:
- Jun 6, 2006, 5:22:07 PM (20 years ago)
- Location:
- trunk/psLib
- Files:
-
- 24 added
- 15 edited
-
configure.ac (modified) (5 diffs)
-
src/imageops/Makefile.am (modified) (4 diffs)
-
src/imageops/psImageBackground.c (added)
-
src/imageops/psImageBackground.h (added)
-
src/imageops/psImageGeomManip.c (modified) (3 diffs)
-
src/imageops/psImageGeomManip.h (modified) (2 diffs)
-
src/imageops/psImagePixelManip.c (modified) (2 diffs)
-
src/jpeg (added)
-
src/jpeg/.cvsignore (added)
-
src/jpeg/Makefile.am (added)
-
src/jpeg/psImageJpeg.c (added)
-
src/jpeg/psImageJpeg.h (added)
-
src/math/Makefile.am (modified) (2 diffs)
-
src/math/psEllipse.c (added)
-
src/math/psEllipse.h (added)
-
src/math/psPolynomialUtils.c (added)
-
src/math/psPolynomialUtils.h (added)
-
src/math/psRegion.c (modified) (1 diff)
-
src/math/psRegion.h (modified) (1 diff)
-
src/math/psSparse.c (added)
-
src/math/psSparse.h (added)
-
src/math/psVectorSmooth.c (added)
-
src/math/psVectorSmooth.h (added)
-
src/pslib_strict.h (modified) (5 diffs)
-
src/sys/Makefile.am (modified) (2 diffs)
-
src/sys/psLine.c (added)
-
src/sys/psLine.h (added)
-
src/sys/psString.c (modified) (5 diffs)
-
src/sys/psString.h (modified) (2 diffs)
-
src/types/Makefile.am (modified) (2 diffs)
-
src/types/psMetadata.c (modified) (2 diffs)
-
src/types/psMetadata.h (modified) (2 diffs)
-
src/types/psMetadataItemCompare.c (added)
-
src/types/psMetadataItemCompare.h (added)
-
src/types/psMetadataItemParse.c (added)
-
src/types/psMetadataItemParse.h (added)
-
test/jpeg (added)
-
test/jpeg/Makefile.am (added)
-
test/math/tst_psSparse.c (added)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/configure.ac
r7300 r7380 26 26 27 27 SRCPATH='${top_srcdir}/src' 28 SRCDIRS="sys astro db fft fits imageops math mathtypes types xml"28 SRCDIRS="sys astro db fft fits imageops jpeg math mathtypes types xml" 29 29 # escape two escapes at this level so \\ gets passed to the shell and \ to perl 30 30 SRCINC=`echo "${SRCDIRS=}" | ${PERL} -pe "s|(\w+)|-I\\\\${SRCPATH=}/\1|g"` … … 241 241 AC_SUBST([GSL_CFLAGS]) 242 242 243 dnl libjpeg ------------------------------------------------------------------- 244 245 AC_CHECK_LIB(jpeg,jpeg_CreateCompress,[],[AC_MSG_ERROR([jpeg library not found.])]) 246 243 247 dnl ------------------- XML2 options --------------------- 244 248 AC_ARG_WITH(xml2-config, … … 316 320 AM_CONDITIONAL(DOXYGEN, test x$doxygen = xtrue) 317 321 318 319 322 dnl ------- restore CFLAGS / LDFLAGS (tests done) -------- 320 323 CFLAGS="${CFLAGS} -Wall -Werror" … … 338 341 src/fits/Makefile 339 342 src/imageops/Makefile 343 src/jpeg/Makefile 340 344 src/math/Makefile 341 345 src/mathtypes/Makefile … … 349 353 test/fits/Makefile 350 354 test/imageops/Makefile 355 test/jpeg/Makefile 351 356 test/math/Makefile 352 357 test/mathtypes/Makefile -
trunk/psLib/src/imageops/Makefile.am
r7210 r7380 5 5 libpslibimageops_la_CPPFLAGS = $(SRCINC) 6 6 libpslibimageops_la_SOURCES = \ 7 psImageBackground.c \ 7 8 psImageConvolve.c \ 8 9 psImageGeomManip.c \ … … 11 12 psImageStats.c \ 12 13 psImageStructManip.c \ 13 psImageMaskOps.c 14 psImageMaskOps.c \ 15 psImageUnbin.c 14 16 15 17 EXTRA_DIST = imageops.i … … 17 19 pslibincludedir = $(includedir) 18 20 pslibinclude_HEADERS = \ 21 psImageBackground.h \ 19 22 psImageConvolve.h \ 20 23 psImageGeomManip.h \ … … 23 26 psImageStats.h \ 24 27 psImageStructManip.h \ 25 psImageMaskOps.h 28 psImageMaskOps.h \ 29 psImageUnbin.h 26 30 27 31 CLEANFILES = *~ -
trunk/psLib/src/imageops/psImageGeomManip.c
r6806 r7380 10 10 * @author Ross Harman, MHPCC 11 11 * 12 * @version $Revision: 1.2 3$ $Name: not supported by cvs2svn $13 * @date $Date: 2006-0 4-06 22:55:18$12 * @version $Revision: 1.24 $ $Name: not supported by cvs2svn $ 13 * @date $Date: 2006-06-07 03:22:06 $ 14 14 * 15 15 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 23 23 #include "psImageGeomManip.h" 24 24 25 #include "psAbort.h" 25 26 #include "psError.h" 26 27 #include "psImage.h" … … 878 879 } 879 880 881 882 #define FLIP_X_CASE(TYPENAME,TYPE) \ 883 case TYPENAME: { \ 884 long numRows = input->numRows; \ 885 long numCols = input->numCols; \ 886 for (long i = 0; i < numRows; i++) { \ 887 for (long j = 0; j < numCols; j++) { \ 888 output->data.TYPE[i][j] = input->data.TYPE[i][numCols - j - 1]; \ 889 } \ 890 } \ 891 break; \ 892 } 893 894 #define FLIP_Y_CASE(TYPENAME,TYPE) \ 895 case TYPENAME: { \ 896 long numRows = input->numRows; \ 897 long numCols = input->numCols; \ 898 for (long i = 0; i < numRows; i++) { \ 899 for (long j = 0; j < numCols; j++) { \ 900 output->data.TYPE[i][j] = input->data.TYPE[numRows - i - 1][j]; \ 901 } \ 902 } \ 903 break; \ 904 } 905 906 psImage *psImageFlip(psImage *output, const psImage *input, bool xFlip, bool yFlip) 907 { 908 PS_ASSERT_IMAGE_NON_NULL(input, NULL); 909 910 if (xFlip && yFlip) { 911 // This is equivalent to a 180 degree rotation; 912 return psImageRotate(output, input, M_PI, NAN, PS_INTERPOLATE_BILINEAR); 913 } 914 915 if (!xFlip && !yFlip) { 916 // They want something, so let's give it to them 917 return psImageCopy(output, input, input->type.type); 918 } 919 920 output = psImageRecycle(output, input->numCols, input->numRows, input->type.type); 921 922 if (xFlip) { 923 switch (input->type.type) { 924 FLIP_X_CASE(PS_TYPE_U8, U8); 925 FLIP_X_CASE(PS_TYPE_U16, U16); 926 FLIP_X_CASE(PS_TYPE_U32, U32); 927 FLIP_X_CASE(PS_TYPE_U64, U64); 928 FLIP_X_CASE(PS_TYPE_S8, S8); 929 FLIP_X_CASE(PS_TYPE_S16, S16); 930 FLIP_X_CASE(PS_TYPE_S32, S32); 931 FLIP_X_CASE(PS_TYPE_S64, S64); 932 FLIP_X_CASE(PS_TYPE_F32, F32); 933 FLIP_X_CASE(PS_TYPE_F64, F64); 934 FLIP_X_CASE(PS_TYPE_C32, C32); 935 FLIP_X_CASE(PS_TYPE_C64, C64); 936 default: 937 psFree(output); 938 psError(PS_ERR_BAD_PARAMETER_TYPE, true, "Unknown type for input image: %x\n", input->type.type); 939 return NULL; 940 } 941 return output; 942 } 943 if (yFlip) { 944 switch (input->type.type) { 945 FLIP_Y_CASE(PS_TYPE_U8, U8); 946 FLIP_Y_CASE(PS_TYPE_U16, U16); 947 FLIP_Y_CASE(PS_TYPE_U32, U32); 948 FLIP_Y_CASE(PS_TYPE_U64, U64); 949 FLIP_Y_CASE(PS_TYPE_S8, S8); 950 FLIP_Y_CASE(PS_TYPE_S16, S16); 951 FLIP_Y_CASE(PS_TYPE_S32, S32); 952 FLIP_Y_CASE(PS_TYPE_S64, S64); 953 FLIP_Y_CASE(PS_TYPE_F32, F32); 954 FLIP_Y_CASE(PS_TYPE_F64, F64); 955 FLIP_Y_CASE(PS_TYPE_C32, C32); 956 FLIP_Y_CASE(PS_TYPE_C64, C64); 957 default: 958 psFree(output); 959 psError(PS_ERR_BAD_PARAMETER_TYPE, true, "Unknown type for input image: %x\n", input->type.type); 960 return NULL; 961 } 962 return output; 963 } 964 965 psAbort(__func__, "Should never get here.\n"); 966 return NULL; 967 } -
trunk/psLib/src/imageops/psImageGeomManip.h
r6750 r7380 8 8 * @author Robert DeSonia, MHPCC 9 9 * 10 * @version $Revision: 1.1 5$ $Name: not supported by cvs2svn $11 * @date $Date: 2006-0 4-01 02:43:57$10 * @version $Revision: 1.16 $ $Name: not supported by cvs2svn $ 11 * @date $Date: 2006-06-07 03:22:06 $ 12 12 * 13 13 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 151 151 psRegion region, ///< the size of the transformed image 152 152 const psPixels* pixels, /**< if not NULL, consists of psPixelCoords and specifies 153 * which pixels in output image shall be transformed;154 * otherwise, entire image generated*/153 * which pixels in output image shall be transformed; 154 * otherwise, entire image generated*/ 155 155 psImageInterpolateMode mode, ///< the interpolation scheme to be used 156 156 double exposedValue ///< Exposed value to which non-corresponding pixels are set 157 157 ); 158 158 159 // Flip the input image 160 psImage *psImageFlip(psImage *output, // Output image, or NULL 161 const psImage *input, // Input image 162 bool xFlip, // Flip x axis? 163 bool yFlip // Flip y axis? 164 ); 165 159 166 #endif // #ifndef PS_IMAGE_GEOM_MANIP_H -
trunk/psLib/src/imageops/psImagePixelManip.c
r7123 r7380 10 10 * @author Ross Harman, MHPCC 11 11 * 12 * @version $Revision: 1.1 7$ $Name: not supported by cvs2svn $13 * @date $Date: 2006-0 5-16 03:27:13$12 * @version $Revision: 1.18 $ $Name: not supported by cvs2svn $ 13 * @date $Date: 2006-06-07 03:22:06 $ 14 14 * 15 15 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 413 413 return numClipped; 414 414 } 415 -
trunk/psLib/src/math/Makefile.am
r7210 r7380 8 8 psBinaryOp.c \ 9 9 psCompare.c \ 10 psEllipse.c \ 10 11 psMatrix.c \ 11 12 psMinimizeLMM.c \ 12 13 psMinimizePowell.c \ 13 14 psMinimizePolyFit.c \ 15 psPolynomial.c \ 16 psPolynomialUtils.c \ 14 17 psRandom.c \ 15 18 psRegion.c \ 16 19 psRegionForImage.c \ 17 ps Polynomial.c \20 psSparse.c \ 18 21 psSpline.c \ 19 22 psStats.c \ 20 psMathUtils.c 23 psMathUtils.c \ 24 psVectorSmooth.c 21 25 22 26 EXTRA_DIST = math.i … … 28 32 psCompare.h \ 29 33 psConstants.h \ 34 psEllipse.h \ 30 35 psMatrix.h \ 31 36 psMinimizeLMM.h \ 32 37 psMinimizePowell.h \ 33 38 psMinimizePolyFit.h \ 39 psPolynomial.h \ 40 psPolynomialUtils.h \ 34 41 psRandom.h \ 35 42 psRegion.h \ 36 43 psRegionForImage.h \ 37 ps Polynomial.h \44 psSparse.h \ 38 45 psSpline.h \ 39 46 psStats.h \ 40 psMathUtils.h 47 psMathUtils.h \ 48 psVectorSmooth.h 41 49 42 50 CLEANFILES = *~ -
trunk/psLib/src/math/psRegion.c
r6874 r7380 84 84 } 85 85 86 bool inline psRegionIsNaN(const psRegion region) 87 { 88 return isnan(region.x0) || isnan(region.x1) || isnan(region.y0) || isnan(region.y1); 89 } 90 -
trunk/psLib/src/math/psRegion.h
r6874 r7380 70 70 ); 71 71 72 // Test if any element of the region is NaN 73 bool inline psRegionIsNaN(const psRegion region// Region to check 74 ); 72 75 73 76 #endif -
trunk/psLib/src/pslib_strict.h
r7211 r7380 9 9 * @author Eric Van Alst, MHPCC 10 10 * 11 * @version $Revision: 1.1 8$ $Name: not supported by cvs2svn $12 * @date $Date: 2006-0 5-25 21:19:45$11 * @version $Revision: 1.19 $ $Name: not supported by cvs2svn $ 12 * @date $Date: 2006-06-07 03:22:06 $ 13 13 * 14 14 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 42 42 43 43 #include "psXML.h" 44 44 45 #include "psImageConvolve.h" 45 46 #include "psImageGeomManip.h" … … 49 50 #include "psImageStructManip.h" 50 51 #include "psImageMaskOps.h" 52 #include "psImageUnbin.h" 53 54 #include "psImageJpeg.h" 51 55 52 56 #include "psBinaryOp.h" … … 61 65 #include "psRegionForImage.h" 62 66 #include "psPolynomial.h" 67 #include "psPolynomialUtils.h" 63 68 #include "psSpline.h" 64 69 #include "psStats.h" … … 84 89 #include "psMetadata.h" 85 90 #include "psMetadataConfig.h" 91 #include "psMetadataItemParse.h" 92 #include "psMetadataItemCompare.h" 86 93 #include "psPixels.h" 87 94 #include "psArguments.h" 95 #include "psVectorSmooth.h" 96 #include "psImageBackground.h" 97 #include "psEllipse.h" 98 #include "psSparse.h" 88 99 89 100 #endif // #ifndef PS_LIB_STRICT_H -
trunk/psLib/src/sys/Makefile.am
r7210 r7380 9 9 psError.c \ 10 10 psErrorCodes.c \ 11 psLine.c \ 11 12 psLogMsg.c \ 12 13 psMemory.c \ … … 32 33 psError.h \ 33 34 psErrorCodes.h \ 35 psLine.h \ 34 36 psLogMsg.h \ 35 37 psMemory.h \ -
trunk/psLib/src/sys/psString.c
r7251 r7380 13 13 * @author David Robbins, MHPCC 14 14 * 15 * @version $Revision: 1.3 0$ $Name: not supported by cvs2svn $16 * @date $Date: 2006-0 5-31 20:56:37$15 * @version $Revision: 1.31 $ $Name: not supported by cvs2svn $ 16 * @date $Date: 2006-06-07 03:22:06 $ 17 17 * 18 18 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 31 31 psString psStringCopy(const char *string) 32 32 { 33 PS_ASSERT_PTR_NON_NULL(string, NULL); 33 // Pass through NULL values! 34 34 35 // Allocate memory using psAlloc function 35 36 // Copy input string to memory just allocated 36 37 // Return the copy 37 // Pass through NULL values38 38 return string ? strcpy(psAlloc(strlen(string) + 1), string) : NULL; 39 39 } … … 218 218 // given the input string, search for all copies of the key, and replace with the replacement value 219 219 // the input string may be freed if not needed 220 char *psStringSubstitute (char *input, char *replace, char *key) 221 { 222 223 char *p; 224 225 if (key == NULL) 220 char *psStringSubstitute(char *input, const char *replace, const char *key) 221 { 222 if (key == NULL || strlen(key) == 0) { 226 223 return input; 227 if (strlen(key) == 0) 228 return input; 224 } 229 225 230 226 while (true) { 231 p = strstr (input, key);232 if ( p == NULL)227 char *p = strstr (input, key); 228 if (!p) { 233 229 return input; 230 } 234 231 235 232 // we have input = xxxkeyxxx … … 241 238 242 239 // copy the first segement into 'output' 243 strncpy (output, input, Nc);240 strncpy(output, input, Nc); 244 241 245 242 // copy the key replacement to the start of the key 246 247 strcpy (&output[Nc], replace); 243 strcpy(&output[Nc], replace); 248 244 Nc += strlen (replace); 249 245 250 246 // copy the remainder to the end of the replacement 251 strcpy (&output[Nc], p + strlen(key));252 253 psFree (input);247 strcpy(&output[Nc], p + strlen(key)); 248 249 psFree(input); 254 250 input = output; 255 251 } … … 257 253 } 258 254 255 psArray *psStringSplitArray(const char *string, const char *splitters, bool multi) 256 { 257 258 psList *list = psStringSplit(string, splitters, multi); 259 psArray *array = psListToArray(list); 260 psFree (list); 261 return array; 262 } 263 264 #ifndef whitespace 265 #define whitespace(c) (((c) == ' ') || ((c) == '\t')) 266 #endif 267 268 /* Strip whitespace from the start and end of STRING. */ 269 size_t psStringStrip(char *string) 270 { 271 long i; 272 273 if (!string || strlen(string) == 0) { 274 return 0; 275 } 276 277 for (i = 0; i < strlen(string) && whitespace(string[i]); i++) 278 ; // No action 279 if (i) { 280 memmove (string, string + i, strlen(string+i)+1); 281 } 282 for (i = strlen (string) - 1; (i > 0) && whitespace(string[i]); i--) 283 ; // No action 284 string[++i] = 0; 285 286 return i; 287 } -
trunk/psLib/src/sys/psString.h
r7300 r7380 14 14 * @author David Robbins, MHPCC 15 15 * 16 * @version $Revision: 1.2 1$ $Name: not supported by cvs2svn $17 * @date $Date: 2006-06-0 2 21:33:34$16 * @version $Revision: 1.22 $ $Name: not supported by cvs2svn $ 17 * @date $Date: 2006-06-07 03:22:06 $ 18 18 * 19 19 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 107 107 ); 108 108 109 // given the input string, search for all copies of the key, and replace with the replacement value 109 // Same as psStringSplit, but return result as an array 110 psArray *psStringSplitArray(const char *string, // String to split 111 const char *splitters, // Characters on which to split 112 bool multipleAreSignificant // Are multiple occurences significant? 113 ); 114 115 // Given the input string, search for all copies of the key, and replace with the replacement value 110 116 // the input string may be freed if not needed 111 char *psStringSubstitute ( 112 char *input, ///< input string to be modified 113 char *replace, ///< replacement value 114 char *key ///< string to be replaced in input 115 ); 117 char *psStringSubstitute (char *input, ///< input string to be modified 118 const char *replace, ///< replacement value 119 const char *key ///< string to be replaced in input 120 ); 121 122 // strip whitespace from head and tail of string 123 size_t psStringStrip(char *string); 124 116 125 117 126 /** @} */// Doxygen - End of SystemGroup Functions -
trunk/psLib/src/types/Makefile.am
r7210 r7380 12 12 psMetadata.c \ 13 13 psMetadataConfig.c \ 14 psMetadataItemParse.c \ 15 psMetadataItemCompare.c \ 14 16 psPixels.c \ 15 17 psArguments.c … … 26 28 psMetadata.h \ 27 29 psMetadataConfig.h \ 30 psMetadataItemParse.h \ 31 psMetadataItemCompare.h \ 28 32 psPixels.h \ 29 33 psArguments.h -
trunk/psLib/src/types/psMetadata.c
r7368 r7380 12 12 * @author Ross Harman, MHPCC 13 13 * 14 * @version $Revision: 1.10 7$ $Name: not supported by cvs2svn $15 * @date $Date: 2006-06-0 6 22:54:22$14 * @version $Revision: 1.108 $ $Name: not supported by cvs2svn $ 15 * @date $Date: 2006-06-07 03:22:06 $ 16 16 * 17 17 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 445 445 return out; 446 446 } 447 448 449 // may need to extend this to change the keyname in the copy 450 bool psMetadataItemTransfer(psMetadata *out, const psMetadata *in, const char *key) 451 { 452 453 psMetadataItem *item = psMetadataLookup(in, key); 454 if (!item) { 455 return false; 456 } 457 458 return psMetadataAddItem(out, item, PS_LIST_TAIL, PS_META_REPLACE); 459 } 460 447 461 448 462 bool psMetadataAddItem(psMetadata *md, -
trunk/psLib/src/types/psMetadata.h
r7368 r7380 11 11 * @author Ross Harman, MHPCC 12 12 * 13 * @version $Revision: 1.7 6$ $Name: not supported by cvs2svn $14 * @date $Date: 2006-06-0 6 22:54:22$13 * @version $Revision: 1.77 $ $Name: not supported by cvs2svn $ 14 * @date $Date: 2006-06-07 03:22:06 $ 15 15 * 16 16 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 361 361 ); 362 362 363 // Copy a metadata item from one psMetadata to another 364 bool psMetadataItemTransfer(psMetadata *out, // Destination: copy is placed here 365 const psMetadata *in, // Source: item comes from here 366 const char *key // key to identify the metadata item 367 ); 368 363 369 /** Add existing metadata item to metadata collection. 364 370 *
Note:
See TracChangeset
for help on using the changeset viewer.
