00001 /* @file psRegion.h 00002 * @brief image regions and related functions 00003 * 00004 * $Revision: 1.8 $ $Name: $ 00005 * $Date: 2007/01/23 22:47:23 $ 00006 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii 00007 */ 00008 00009 #ifndef PS_REGION_H 00010 #define PS_REGION_H 00011 00012 /// @addtogroup MathOps Mathematical Operations 00013 /// @{ 00014 00015 #include "psString.h" 00016 00017 /** Basic image region structure. 00018 * 00019 * Struct for specifying a rectangular area in an image. 00020 * 00021 */ 00022 typedef struct 00023 { 00024 float x0; ///< the first column of the region. 00025 float x1; ///< the last column of the region. 00026 float y0; ///< the first row of the region. 00027 float y1; ///< the last row of the region. 00028 } 00029 psRegion; 00030 00031 /** Create a pointer to a psRegion, with associated psMemBlock. 00032 * 00033 * @return psRegion* : a new psRegion. 00034 */ 00035 psRegion *psRegionAlloc( 00036 float x0, ///< the first column of the region. 00037 float x1, ///< the last column of the region + 1. 00038 float y0, ///< the first row of the region. 00039 float y1 ///< the last row of the region + 1. 00040 ); 00041 00042 /** Checks the type of a particular pointer. 00043 * 00044 * Uses the appropriate deallocation function in psMemBlock to check the ptr datatype. 00045 * 00046 * @return bool: True if the pointer matches a psRegion structure, false otherwise. 00047 */ 00048 bool psMemCheckRegion( 00049 psPtr ptr ///< the pointer whose type to check 00050 ); 00051 00052 /** Create a psRegion with the specified attributes. 00053 * 00054 * @return psRegion : a corresponding psRegion. 00055 */ 00056 psRegion psRegionSet( 00057 float x0, ///< the first column of the region. 00058 float x1, ///< the last column of the region + 1. 00059 float y0, ///< the first row of the region. 00060 float y1 ///< the last row of the region + 1. 00061 ); 00062 00063 /** Create a psRegion with the attribute values given as a string. 00064 * 00065 * Create a psRegion with the attribute values given as a string. The format 00066 * shall be of the standard IRAF form '[x0:x1,y0:y1]' 00067 * 00068 * @return psRegion: A new psRegion struct, or NULL is not successful. 00069 */ 00070 psRegion psRegionFromString( 00071 const char* region ///< image rectangular region in the form '[x0:x1,y0:y1]' 00072 ); 00073 00074 /** Create a string of the standard IRAF form '[x0:x1,y0:y1]' from a psRegion. 00075 * 00076 * @return psString: A new string representing the psRegion as text, or NULL 00077 * is not successful. 00078 */ 00079 psString psRegionToString( 00080 const psRegion region ///< the psRegion to convert to a string 00081 ); 00082 00083 /** Defines a region corresponding to the square with center at coordinate x,y 00084 * and with coderadius. The width of the square is 2radius + 1. 00085 * 00086 * @return psRegion: the newly defined psRegion. 00087 */ 00088 psRegion psRegionForSquare( 00089 double x, ///< x coordinate at square-center 00090 double y, ///< y coordinate at square-center 00091 double radius ///< radius of square 00092 ); 00093 00094 /** Test if any element of the region is NaN 00095 * 00096 * @return bool: True if an element is NaN, otherwise false. 00097 */ 00098 bool psRegionIsNaN( 00099 psRegion region ///< Region to check 00100 ); 00101 00102 /// @} 00103 #endif
1.5.1