00001 /* 00002 * The information in this file is 00003 * Copyright(c) 2007 Ball Aerospace & Technologies Corporation 00004 * and is subject to the terms and conditions of the 00005 * GNU Lesser General Public License Version 2.1 00006 * The license text is available from 00007 * http://www.gnu.org/licenses/lgpl.html 00008 */ 00009 00010 #ifndef SIMPLEAOI_H__ 00011 #define SIMPLEAOI_H__ 00012 00013 #include "AppConfig.h" 00014 00015 #ifdef __cplusplus 00016 extern "C" 00017 { 00018 #endif 00019 /** \addtogroup simple_api */ 00020 /*@{*/ 00021 00022 /** 00023 * @file SimpleAoi.h 00024 * This file contains API utilities for accessing AOI data as a bitmask. 00025 */ 00026 00027 /** 00028 * Get the value at a particular location in an AOI. 00029 * 00030 * The indices are relative to the origin of the AOI. Negative indices are possible and will 00031 * always return the value of BitMask::isOutsideSelected(). 00032 * 00033 * @param pElement 00034 * The AoiElement to access. 00035 * @param x 00036 * The column requested. 00037 * @param y 00038 * The row requested. 00039 * @return A zero if the requested location is not active in the AOI or a non-zero if the requested location 00040 * is active in the AOI. 00041 */ 00042 EXPORT_SYMBOL int getAoiValue(DataElement* pElement, int32_t x, int32_t y); 00043 00044 /** 00045 * Set the value at a particular location in an AOI. 00046 * 00047 * The indices are relative to the origin of the AOI. 00048 * 00049 * @param pElement 00050 * The AoiElement to access. 00051 * @param x 00052 * The column to set. 00053 * @param y 00054 * The row to set. 00055 * @param value 00056 * The new value. A zero clears the point from the AOI and a non-zero adds the point to the AOI. 00057 * @return A zero if successful, a non-zero if an error occurs. 00058 */ 00059 EXPORT_SYMBOL int setAoiValue(DataElement* pElement, uint32_t x, uint32_t y, int value); 00060 00061 /** 00062 * Access the minimal bounding box required to contain the AOI's unique data. 00063 * 00064 * @param pElement 00065 * The AoiElement to access. 00066 * @param pX1 00067 * The start column. 00068 * @param pY1 00069 * The start row. 00070 * @param pX2 00071 * The end column. 00072 * @param pY2 00073 * The end row. 00074 * @return Non-zero if an error occurred or zero otherwise. 00075 */ 00076 EXPORT_SYMBOL int getAoiMinimalBoundingBox(DataElement* pElement, 00077 int32_t* pX1, int32_t* pY1, int32_t* pX2, int32_t* pY2); 00078 00079 /** 00080 * Get an iterator over an AOI. 00081 * 00082 * @param pElement 00083 * The AoiElement to access. If this is \c NULL, create an iterator over the entire raster element. 00084 * @param pRaster 00085 * A raster element whose size will determine the bounding box. 00086 * @return A BitMaskIterator. 00087 */ 00088 EXPORT_SYMBOL BitMaskIterator* createAoiIteratorOverRaster(DataElement* pElement, DataElement* pRaster); 00089 00090 /** 00091 * Get an iterator over an AOI. 00092 * 00093 * @param pElement 00094 * The AoiElement to access. If this is \c NULL, create an iterator over the entire bounding box. 00095 * @param x1 00096 * The starting X value for the bounding box. 00097 * @param y1 00098 * The starting Y value for the bounding box. 00099 * @param x2 00100 * The ending X value for the bounding box. 00101 * @param y2 00102 * The ending Y value for the bounding box. 00103 * @return A BitMaskIterator. 00104 */ 00105 EXPORT_SYMBOL BitMaskIterator* createAoiIteratorOverBoundingBox(DataElement* pElement, 00106 int32_t x1, int32_t y1, int32_t x2, int32_t y2); 00107 00108 /** 00109 * Free an AOI iterator. 00110 * 00111 * Suitable for use as a cleanup callback. 00112 * 00113 * @param pIter 00114 * The BitMaskIterator to free. No error checking is performed on this value 00115 * and a \c NULL will cause a NOOP. 00116 */ 00117 EXPORT_SYMBOL void freeAoiIterator(BitMaskIterator* pIter); 00118 00119 /** 00120 * Advance an AOI iterator to the next selected pixel. 00121 * 00122 * @param pIter 00123 * The BitMaskIterator to advance. 00124 * @return Zero if the end of the iterator has been reached or an error occurred. 00125 * Non-zero if the new iterator position is valid. 00126 */ 00127 EXPORT_SYMBOL int nextAoiIterator(BitMaskIterator* pIter); 00128 00129 /** 00130 * Access the current AOI iterator position. 00131 * 00132 * @param pIter 00133 * The BitMaskIterator to query. 00134 * @param pX 00135 * Output parameter which will contain the current X location. 00136 * @param pY 00137 * Output parameter which will contain the current Y location. 00138 * @return Non-zero if an error occurred or zero otherwise. 00139 */ 00140 EXPORT_SYMBOL int getAoiIteratorLocation(BitMaskIterator* pIter, int32_t* pX, int32_t* pY); 00141 00142 /*@}*/ 00143 #ifdef __cplusplus 00144 } 00145 #endif 00146 00147 #endif