00001 /** @file psImagePixelManip.h 00002 * 00003 * @brief Contains basic image pixel manipulation operations, as 00004 * specified in the PSLIB SDRS sections "Image Pixel Manipulations" 00005 * 00006 * @ingroup Image 00007 * 00008 * @author Robert DeSonia, MHPCC 00009 * 00010 * @version $Revision: 1.1.1.1 $ $Name: $ 00011 * @date $Date: 2005/09/14 20:42:48 $ 00012 * 00013 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii 00014 */ 00015 #ifndef PS_IMAGE_PIXEL_MANIP_H 00016 #define PS_IMAGE_PIXEL_MANIP_H 00017 00018 #include "psImage.h" 00019 #include "psCoord.h" 00020 #include "psStats.h" 00021 #include "psPixels.h" 00022 00023 /// @addtogroup Image 00024 /// @{ 00025 00026 /** Clip image values outside of range to given values 00027 * 00028 * All pixels with values less than min are set to the value vmin. all pixels 00029 * with values greater than max are set to the value vmax. This function is 00030 * defined for psU8, psU16, psS8, psS16, psF32, psF64, psC32, and psC64. 00031 * 00032 * @return int The number of clipped pixels 00033 */ 00034 int psImageClip( 00035 psImage* input, ///< the image to clip 00036 double min, ///< the minimum image value allowed 00037 double vmin, ///< the value pixels < min are set to 00038 double max, ///< the maximum image value allowed 00039 double vmax ///< the value pixels > max are set to 00040 ); 00041 00042 /** Clip image values outside of a specified complex region 00043 * 00044 * All pixels outside of the rectangular region in complex space formed by 00045 * the min and max input parameters are set to the value vmax (if either 00046 * the real or imaginary portion exceeds the respective max values), or vmin. 00047 * This function is defined for psC32, and psC64 imagery only. 00048 * 00049 * @return int The number of clipped pixels 00050 */ 00051 int psImageClipComplexRegion( 00052 psImage* input, ///< the image to clip 00053 complex min, ///< the minimum image value allowed 00054 complex vmin, ///< the value pixels < min are set to 00055 complex max, ///< the maximum image value allowed 00056 complex vmax ///< the value pixels > max are set to 00057 ); 00058 00059 /** Clip NaN image pixels to given value. 00060 * 00061 * Pixels with NaN, +Inf, or -Inf values are set to the specified value. This 00062 * function is defined for psF32, psF64, psC32, and psC64. 00063 * 00064 * @return int The number of clipped pixels 00065 */ 00066 int psImageClipNaN( 00067 psImage* input, ///< the image to clip 00068 float value ///< the value to set all NaN/Inf values to 00069 ); 00070 00071 /** Overlay subregion of image with another image 00072 * 00073 * Replace the pixels in the image which correspond to the pixels in OVERLAY 00074 * with values derived from the IMAGE and OVERLAY based on the given operator 00075 * OP. Valid operators are "=" (set image value to OVERLAY value), "+" (add 00076 * OVERLAY value to image value), "-" (subtract OVERLAY from image), "*" 00077 * (multiply OVERLAY times image), "/" (divide image by OVERLAY). This 00078 * function is defined for psU8, psS8, psS16, psF32, psF64, psC32, and psC64. 00079 * 00080 * @return int 0 if success, non-zero if failed. 00081 */ 00082 int psImageOverlaySection( 00083 psImage* image, ///< target image 00084 const psImage* overlay, ///< the overlay image 00085 int x0, ///< the column to start overlay 00086 int y0, ///< the row to start overlay 00087 const char *op ///< the operation to perform for overlay 00088 ); 00089 /** Sets the bits inside the region, ignoring pixels outside. 00090 * 00091 * The pixels are set by combining the existing pixel value and the given maskValue 00092 * with a logical operation. The allowed operations are =, AND, OR, and XOR. 00093 */ 00094 void psImageMaskRegion( 00095 psImage *image, ///< the image to set 00096 psRegion *region, ///< the specified region 00097 const char *op, ///< the logical operation 00098 psMaskType maskValue ///< the specified bits 00099 ); 00100 00101 /** Sets the bits outside the region, ignoring pixels inside. 00102 * 00103 * The pixels are set by combining the existing pixel value and the given maskValue 00104 * with a logical operation. The allowed operations are =, AND, OR, and XOR. 00105 */ 00106 void psImageKeepRegion( 00107 psImage *image, ///< the image to set 00108 psRegion *region, ///< the specified region 00109 const char *op, ///< the logical operation 00110 psMaskType maskValue ///< the specified bits 00111 ); 00112 00113 /** Sets the bits inside the circle, ignoring the pixels outside. 00114 * 00115 * The pixel values are set by combining the existing pixel value and the given maskValue 00116 * with a logical operation. The allowed operations are =, AND, OR, and XOR. 00117 */ 00118 void psImageMaskCircle( 00119 psImage *image, ///< the image to set 00120 double x, ///< the x coordinate of the circle's center 00121 double y, ///< the y coordinate of the circle's center 00122 double radius, ///< the radius of the specified circle 00123 const char *op, ///< the logical operation 00124 psMaskType maskValue ///< the specified bits 00125 ); 00126 00127 /** Sets the bits outside the circle, ignoring the pixels inside. 00128 * 00129 * The pixel values are set by combining the existing pixel value and the given maskValue 00130 * with a logical operation. The allowed operations are =, AND, OR, and XOR. 00131 */ 00132 void psImageKeepCircle( 00133 psImage *image, ///< the image to set 00134 double x, ///< the x coordinate of the circle's center 00135 double y, ///< the y coordinate of the circle's center 00136 double radius, ///< the radius of the specified circle 00137 const char *op, ///< the logical operation 00138 psMaskType maskValue ///< the specified bits 00139 ); 00140 00141 #endif // #ifndef PS_IMAGE_PIXEL_MANIP_H
1.4.2