00001 #ifndef PS_REGION_H 00002 #define PS_REGION_H 00003 00004 #include "psString.h" 00005 00006 /** Basic image region structure. 00007 * 00008 * Struct for specifying a rectangular area in an image. 00009 * 00010 */ 00011 typedef struct 00012 { 00013 float x0; ///< the first column of the region. 00014 float x1; ///< the last column of the region. 00015 float y0; ///< the first row of the region. 00016 float y1; ///< the last row of the region. 00017 } 00018 psRegion; 00019 00020 /** Create a pointer to a psRegion, with associated psMemBlock. 00021 * 00022 * @return psRegion* : a new psRegion. 00023 */ 00024 psRegion *psRegionAlloc(float x0, ///< the first column of the region. 00025 float x1, ///< the last column of the region + 1. 00026 float y0, ///< the first row of the region. 00027 float y1 ///< the last row of the region + 1. 00028 ); 00029 00030 /** Create a psRegion with the specified attributes. 00031 * 00032 * @return psRegion : a cooresponding psRegion. 00033 */ 00034 psRegion psRegionSet( 00035 float x0, ///< the first column of the region. 00036 float x1, ///< the last column of the region + 1. 00037 float y0, ///< the first row of the region. 00038 float y1 ///< the last row of the region + 1. 00039 ); 00040 00041 /** Create a psRegion with the attribute values given as a string. 00042 * 00043 * Create a psRegion with the attribute values given as a string. The format 00044 * shall be of the standard IRAF form '[x0:x1,y0:y1]' 00045 * 00046 * @return psRegion: A new psRegion struct, or NULL is not successful. 00047 */ 00048 psRegion psRegionFromString( 00049 const char* region ///< image rectangular region in the form '[x0:x1,y0:y1]' 00050 ); 00051 00052 /** Create a string of the standard IRAF form '[x0:x1,y0:y1]' from a psRegion. 00053 * 00054 * @return psString: A new string representing the psRegion as text, or NULL 00055 * is not successful. 00056 */ 00057 psString psRegionToString( 00058 const psRegion region ///< the psRegion to convert to a string 00059 ); 00060 00061 /** Defines a region corresponding to the square with center at coordinate x,y 00062 * and with coderadius. The width of the square is 2radius + 1. 00063 * 00064 * @return psRegion: the newly defined psRegion. 00065 */ 00066 psRegion psRegionForSquare( 00067 double x, ///< x coordinate at square-center 00068 double y, ///< y coordinate at square-center 00069 double radius ///< radius of square 00070 ); 00071 00072 // Test if any element of the region is NaN 00073 bool psRegionIsNaN(psRegion region// Region to check 00074 ); 00075 00076 #endif
1.4.4