Changeset 4540 for trunk/psLib/src/imageops
- Timestamp:
- Jul 12, 2005, 9:12:01 AM (21 years ago)
- Location:
- trunk/psLib/src/imageops
- Files:
-
- 1 added
- 8 edited
-
Makefile.am (modified) (1 diff)
-
imageops.i (added)
-
psImageConvolve.c (modified) (9 diffs)
-
psImageConvolve.h (modified) (3 diffs)
-
psImageGeomManip.c (modified) (2 diffs)
-
psImagePixelExtract.c (modified) (2 diffs)
-
psImagePixelManip.c (modified) (2 diffs)
-
psImagePixelManip.h (modified) (2 diffs)
-
psImageStructManip.c (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/src/imageops/Makefile.am
r4446 r4540 1 #Makefile for image functions of psLib1 #Makefile for image operation functions of psLib 2 2 # 3 INCLUDES = \ 4 -I$(top_srcdir)/src/astro \ 5 -I$(top_srcdir)/src/db \ 6 -I$(top_srcdir)/src/fft \ 7 -I$(top_srcdir)/src/fits \ 8 -I$(top_srcdir)/src/imageops \ 9 -I$(top_srcdir)/src/math \ 10 -I$(top_srcdir)/src/mathtypes \ 11 -I$(top_srcdir)/src/sys \ 12 -I$(top_srcdir)/src/types \ 13 -I$(top_srcdir)/src/xml \ 14 $(all_includes) 3 noinst_LTLIBRARIES = libpslibimageops.la 15 4 16 noinst_LTLIBRARIES = libpslibimage.la 17 18 libpslibimage_la_SOURCES = \ 19 psImage.c \ 5 libpslibimageops_la_SOURCES = \ 6 psImageConvolve.c \ 7 psImageGeomManip.c \ 20 8 psImagePixelExtract.c \ 21 psImageStructManip.c \22 psImageGeomManip.c \23 9 psImagePixelManip.c \ 24 10 psImageStats.c \ 25 psImageFFT.c \ 26 psImageConvolve.c 11 psImageStructManip.c 27 12 28 BUILT_SOURCES = psImageErrors.h 29 EXTRA_DIST = psImageErrors.dat psImageErrors.h image.i 30 31 psImageErrors.h: psImageErrors.dat 32 $(top_srcdir)/src/psParseErrorCodes --data=$? $@ 13 EXTRA_DIST = imageops.i 33 14 34 15 pslibincludedir = $(includedir) 35 16 pslibinclude_HEADERS = \ 36 psImage.h \ 17 psImageConvolve.h \ 18 psImageGeomManip.h \ 37 19 psImagePixelExtract.h \ 38 psImageStructManip.h \39 psImageGeomManip.h \40 20 psImagePixelManip.h \ 41 21 psImageStats.h \ 42 psImageFFT.h \ 43 psImageConvolve.h 22 psImageStructManip.h -
trunk/psLib/src/imageops/psImageConvolve.c
r4392 r4540 5 5 * @author Robert DeSonia, MHPCC 6 6 * 7 * @version $Revision: 1.2 0$ $Name: not supported by cvs2svn $8 * @date $Date: 2005-0 6-25 02:02:05$7 * @version $Revision: 1.21 $ $Name: not supported by cvs2svn $ 8 * @date $Date: 2005-07-12 19:12:01 $ 9 9 * 10 10 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 65 65 result->image = psImageAlloc(numCols,numRows,PS_TYPE_KERNEL); 66 66 memset(result->image->rawDataBuffer,0,numCols*numRows*PSELEMTYPE_SIZEOF(PS_TYPE_KERNEL)); 67 result->p_kernelRows = psAlloc(sizeof( psKernelType*)*numRows);68 69 psKernelType** kernelRows = result->p_kernelRows;70 psKernelType** imageRows = result->image->data.PS_TYPE_KERNEL_DATA;67 result->p_kernelRows = psAlloc(sizeof(float*)*numRows); 68 69 float** kernelRows = result->p_kernelRows; 70 float** imageRows = result->image->data.PS_TYPE_KERNEL_DATA; 71 71 for (psS32 i = 0; i < numRows; i++) { 72 72 kernelRows[i] = imageRows[i] - xMin; … … 103 103 psS32 yMax = 0; 104 104 psS32 length = 0; 105 psKernelTypenormalizeTime = 1.0; // fraction of total time for each shift clock105 float normalizeTime = 1.0; // fraction of total time for each shift clock 106 106 psKernel* result = NULL; 107 psKernelType** kernel = NULL;107 float** kernel = NULL; 108 108 109 109 // got non-NULL vectors? … … 170 170 } \ 171 171 \ 172 normalizeTime = 1.0 / ( psKernelType)(tShiftData[length-1]); \172 normalizeTime = 1.0 / (float)(tShiftData[length-1]); \ 173 173 result = psKernelAlloc(xMin,xMax,yMin,yMax); \ 174 174 kernel = result->kernel; \ … … 180 180 y = lastY - yShiftData[i]; \ 181 181 \ 182 kernel[y][x] += ( psKernelType)t / (psKernelType)lastT; \182 kernel[y][x] += (float)t / (float)lastT; \ 183 183 prevT = tShiftData[i]; \ 184 184 } \ … … 216 216 kernel = result->kernel; \ 217 217 \ 218 normalizeTime = 1.0 / ( psKernelType)t; \218 normalizeTime = 1.0 / (float)t; \ 219 219 x = 0; \ 220 220 y = 0; \ 221 221 for (psS32 i = length-1; i >= 0; i--) { \ 222 kernel[y][x] += ( psKernelType)(tShiftData[i]) * normalizeTime; \222 kernel[y][x] += (float)(tShiftData[i]) * normalizeTime; \ 223 223 x -= xShiftData[i]; \ 224 224 y -= yShiftData[i]; \ … … 296 296 psS32 yMin = kernel->yMin; 297 297 psS32 yMax = kernel->yMax; 298 psKernelType** kData = kernel->kernel;298 float** kData = kernel->kernel; 299 299 300 300 // make the output image to the proper size and type … … 399 399 // pad the kernel to the same size of paddedImage 400 400 psImage* paddedKernel = psImageAlloc(paddedCols,paddedRows,PS_TYPE_KERNEL); 401 memset(paddedKernel->data.U8[0],0,sizeof( psKernelType)*numCols*numRows); // zero-out image401 memset(paddedKernel->data.U8[0],0,sizeof(float)*numCols*numRows); // zero-out image 402 402 psS32 yMax = kernel->yMax; 403 403 psS32 xMax = kernel->xMax; … … 407 407 padRow += paddedRows; 408 408 } 409 psKernelType* padData = paddedKernel->data.PS_TYPE_KERNEL_DATA[padRow];410 psKernelType* kernelRow = kernel->kernel[row];409 float* padData = paddedKernel->data.PS_TYPE_KERNEL_DATA[padRow]; 410 float* kernelRow = kernel->kernel[row]; 411 411 for (psS32 col = kernel->xMin; col <= xMax; col++) { 412 412 if (col < 0) { -
trunk/psLib/src/imageops/psImageConvolve.h
r4316 r4540 7 7 * @author Robert DeSonia, MHPCC 8 8 * 9 * @version $Revision: 1. 8$ $Name: not supported by cvs2svn $10 * @date $Date: 2005-0 6-18 03:13:02$9 * @version $Revision: 1.9 $ $Name: not supported by cvs2svn $ 10 * @date $Date: 2005-07-12 19:12:01 $ 11 11 * 12 12 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 25 25 26 26 /** Kernel Type 27 * 27 * 28 28 * A floating-point data type used for storing kernel data. 29 * 29 * 30 30 */ 31 typedef psF32psKernelType;31 //typedef float psKernelType; 32 32 33 33 /** A convolution kernel */ … … 35 35 { 36 36 psImage* image; ///< Kernel data, in the form of an image 37 psS32xMin; ///< Most negative x index38 psS32yMin; ///< Most negative y index39 psS32xMax; ///< Most positive x index40 psS32yMax; ///< Most positive y index41 psKernelType** kernel;///< Pointer to the kernel data42 psKernelType** p_kernelRows;///< Pointer to the rows of the kernel data; not intended for user use.37 int xMin; ///< Most negative x index 38 int yMin; ///< Most negative y index 39 int xMax; ///< Most positive x index 40 int yMax; ///< Most positive y index 41 float** kernel; ///< Pointer to the kernel data 42 float** p_kernelRows; ///< Pointer to the rows of the kernel data; not intended for user use. 43 43 } 44 44 psKernel; -
trunk/psLib/src/imageops/psImageGeomManip.c
r4385 r4540 10 10 * @author Ross Harman, MHPCC 11 11 * 12 * @version $Revision: 1.1 1$ $Name: not supported by cvs2svn $13 * @date $Date: 2005-0 6-25 00:51:28$12 * @version $Revision: 1.12 $ $Name: not supported by cvs2svn $ 13 * @date $Date: 2005-07-12 19:12:01 $ 14 14 * 15 15 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 196 196 } 197 197 198 if (mode < PS_INTERPOLATE_FLAT || mode >= PS_INTERPOLATE_NUM_MODES) {198 if (mode > PS_INTERPOLATE_LANCZOS4_VARIANCE ) { 199 199 psError(PS_ERR_BAD_PARAMETER_VALUE, true, 200 200 PS_ERRORTEXT_psImageManip_INTERPOLATION_MODE_UNSUPPORTED, -
trunk/psLib/src/imageops/psImagePixelExtract.c
r4385 r4540 8 8 * @author Robert DeSonia, MHPCC 9 9 * 10 * @version $Revision: 1. 4$ $Name: not supported by cvs2svn $11 * @date $Date: 2005-0 6-25 00:51:28$10 * @version $Revision: 1.5 $ $Name: not supported by cvs2svn $ 11 * @date $Date: 2005-07-12 19:12:01 $ 12 12 * 13 13 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 312 312 } 313 313 314 if (mode < PS_INTERPOLATE_FLAT || mode >= PS_INTERPOLATE_NUM_MODES) {314 if (mode < PS_INTERPOLATE_FLAT ) { 315 315 psError(PS_ERR_BAD_PARAMETER_VALUE, true, 316 316 PS_ERRORTEXT_psImageManip_INTERPOLATION_MODE_UNSUPPORTED, -
trunk/psLib/src/imageops/psImagePixelManip.c
r4385 r4540 10 10 * @author Ross Harman, MHPCC 11 11 * 12 * @version $Revision: 1. 4$ $Name: not supported by cvs2svn $13 * @date $Date: 2005-0 6-25 00:51:28$12 * @version $Revision: 1.5 $ $Name: not supported by cvs2svn $ 13 * @date $Date: 2005-07-12 19:12:01 $ 14 14 * 15 15 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 185 185 } 186 186 187 psS32psImageOverlaySection(psImage* image,188 const psImage* overlay,189 psS32col0,190 psS32row0,191 const char *op)187 int psImageOverlaySection(psImage* image, 188 const psImage* overlay, 189 int col0, 190 int row0, 191 const char *op) 192 192 { 193 193 psU32 imageNumRows; -
trunk/psLib/src/imageops/psImagePixelManip.h
r4385 r4540 8 8 * @author Robert DeSonia, MHPCC 9 9 * 10 * @version $Revision: 1. 6$ $Name: not supported by cvs2svn $11 * @date $Date: 2005-0 6-25 00:51:28$10 * @version $Revision: 1.7 $ $Name: not supported by cvs2svn $ 11 * @date $Date: 2005-07-12 19:12:01 $ 12 12 * 13 13 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 78 78 * function is defined for psU8, psS8, psS16, psF32, psF64, psC32, and psC64. 79 79 * 80 * @return psS320 if success, non-zero if failed.80 * @return int 0 if success, non-zero if failed. 81 81 */ 82 psS32psImageOverlaySection(82 int psImageOverlaySection( 83 83 psImage* image, ///< target image 84 84 const psImage* overlay, ///< the overlay image 85 psS32 col0,///< the column to start overlay86 psS32 row0,///< the row to start overlay85 int col0, ///< the column to start overlay 86 int row0, ///< the row to start overlay 87 87 const char *op ///< the operation to perform for overlay 88 88 ); -
trunk/psLib/src/imageops/psImageStructManip.c
r3977 r4540 8 8 * @author Robert DeSonia, MHPCC 9 9 * 10 * @version $Revision: 1. 2$ $Name: not supported by cvs2svn $11 * @date $Date: 2005-0 5-19 05:18:20$10 * @version $Revision: 1.3 $ $Name: not supported by cvs2svn $ 11 * @date $Date: 2005-07-12 19:12:01 $ 12 12 * 13 13 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 31 31 { 32 32 psU32 elementSize; // size of image element in bytes 33 psU32 inputColOffset; // offset in bytes to first subset pixel in input row 33 psS32 inputColOffset; // offset in bytes to first subset pixel in input row 34 35 if ( col0 < 0 || row0 < 0 ) { 36 // psError(PS_ERR_BAD_PARAMETER_VALUE, true, 37 // PS_ERRORTEXT_psImage_SUBSET_RANGE_INVALID); 38 psError(PS_ERR_BAD_PARAMETER_VALUE, true, 39 PS_ERRORTEXT_psImage_SUBSET_RANGE_INVALID, 40 col0, col1-1, row0, row1-1, 41 image->numCols-1, image->numRows-1); 42 return NULL; 43 } 34 44 35 45 if (image == NULL || image->data.V == NULL) { … … 64 74 return NULL; 65 75 } 76 77 78 66 79 psS32 numRows = row1-row0; 67 80 psS32 numCols = col1-col0; … … 94 107 95 108 out->data.V = psRealloc(out->data.V,sizeof(psPtr)*numRows); // resize row pointer array 96 *(psType*)&out->type = image->type; 97 *(psU32*)&out->numCols = numCols; 98 *(psU32*)&out->numRows = numRows; 109 *(psMathType*)&out->type = image->type; 110 // *(psU32*)&out->numCols = numCols; 111 // *(psU32*)&out->numRows = numRows; 112 *(psS32*)&out->numCols = numCols; 113 *(psS32*)&out->numRows = numRows; 99 114 *(psS32*)&out->row0 = row0; 100 115 *(psS32*)&out->col0 = col0;
Note:
See TracChangeset
for help on using the changeset viewer.
