rasterlib.dox 70 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162
  1. /*! \page rasterlib GRASS Raster Library
  2. <!-- * doxygenized from "GRASS 5 Programmer's Manual"
  3. by M. Neteler 2/2004, 8/2005, 2006
  4. * updated to GRASS 7 by Martin Landa
  5. -->
  6. by GRASS Development Team (http://grass.osgeo.org)
  7. \tableofcontents
  8. <b>TODO: Needs to be cleaned up. The upper GRASS 4.x and the lower
  9. GRASS 5.x/6.x parts need to me merged and updated to GRASS 7</b>
  10. \section gisrastintro GRASS Raster Map Processing
  11. This library provides a suite of routines which process raster map file.
  12. The processing of raster map files consists of determining which
  13. raster map file or files are to be processed (specified on the module
  14. command line), locating the raster map file in the database, opening the
  15. raster files, dynamically allocating i/o buffers, reading or writing
  16. the raster files, closing the raster files, and creating support files
  17. for newly created raster maps.
  18. Raster map data can be of type CELL, FCELL or DCELL, they are defined
  19. in "gis.h". CELL is a 32-bit signed integer, FCELL is an IEEE
  20. single-precision floating-point, and DCELL is an IEEE double-precision
  21. floating-point. 3D rasters (grid3d) is treated as DCELL (see related
  22. library).
  23. \section Finding_Raster_Files_in_the_Database Finding Raster Files in the Database
  24. GRASS allows the user to specify raster map names (or any other
  25. GIS database file) either as a simple <em>unqualified</em> name, such as
  26. "soils", or in case of input raster maps also as a <em>fully qualified</em>
  27. name, such as "soils@mapset", where <i>mapset</i> is the mapset where the raster
  28. map is to be found. Often only the unqualified raster map name is
  29. provided on the command line and searched in all mapsets indicated in
  30. the mapset search path (SEARCH_PATH file in the actual mapset; managed
  31. with <tt>g.mapsets</tt> command).
  32. The following routines search the database for raster map files:
  33. - G_find_raster()
  34. Looks for the raster file in the database. If found, the mapset where
  35. the raster file lives is returned. If not found, the NULL pointer is
  36. returned. If the user specifies a fully qualified raster map name which
  37. exists, then G_find_raster() modifies <i>name</i> by removing
  38. the "@<I>mapset</I>".
  39. For example, to find a raster map in all mapsets listed the mapset search
  40. path:
  41. \code
  42. char name[GNAME_MAX];
  43. char *mapset;
  44. if ((mapset = G_find_raster(name,"")) == NULL)
  45. /* not found */
  46. \endcode
  47. To check that the raster map exists in the current mapset:
  48. \code
  49. char name[GNAME_MAX];
  50. if (G_find_raster(name, G_mapset()) == NULL)
  51. /* not found */
  52. \endcode
  53. \section Opening_an_Existing_Raster_File Opening an Existing Raster File
  54. The following routine opens the raster map file for <em>reading</em>.
  55. - Rast_open_old()
  56. This routine opens the raster map in given mapset for reading. A
  57. nonnegative file descriptor is returned if the open is
  58. successful. Otherwise a diagnostic message is printed and a negative
  59. value is returned. This routine does quite a bit of work. Since GRASS
  60. users expect that all raster maps will be resampled into the current
  61. region (nearest neighbor method), the resampling index for the raster
  62. map is prepared by this routine after the map is opened. The resampling
  63. is based on the active module region. Preparation required for reading
  64. the various raster map formats (CELL, FCELL, DCELL) is also done.
  65. \section Creating_and_Opening_New_Raster_Files Creating and Opening New Raster Files
  66. The following routines create a new raster map in the current
  67. mapset and open it for <em>writing</em>. G_legal_filename() should be
  68. called first to make sure that raster map name is a valid name.
  69. <b>Note:</b> It is not an error for raster map to already exist. New
  70. raster maps are actually created as temporary files and moved into
  71. the cell or fcell directory when closed. This allows an existing raster map
  72. to be read at the same time that it is being rewritten. G_find_raster()
  73. could be used to see if raster map already exists.
  74. <b>Warning:</b> However, there is a subtle trap. The temporary file,
  75. which is created using G_tempfile(), is named using the current
  76. process id. If the new raster file is opened by a parent process which
  77. exits after creating a child process using fork(), the raster file may
  78. never get created since the temporary file would be associated with
  79. the parent process, not the child. GRASS management automatically
  80. removes temporary files associated with processes that are no longer
  81. running. If fork() must be used, the safest course of action is to
  82. create the child first, then open the raster file (see the discussion
  83. under G_tempfile() for more details).
  84. - Rast_open_new()
  85. - Rast_open_c_new()
  86. - Rast_open_fp_new()
  87. Creates and opens the raster map for writing by Rast_put_row() which
  88. writes the file row by row in <b>sequential</b> order. The raster file data
  89. will be compressed as it is written. A nonnegative file descriptor is
  90. returned if the open is successful. Otherwise a diagnostic message is
  91. printed and a negative value is returned.
  92. - Rast_open_new_uncompressed()
  93. - Rast_open_c_new_uncompressed()
  94. - Rast_open_fp_new_uncompressed()
  95. Creates and opens the raster file for writing by Rast_put_row() which
  96. writes the file row by row in sequential order. The raster file will
  97. be in uncompressed format when closed. A nonnegative file descriptor
  98. is returned if the open is successful. Otherwise a warning message is
  99. printed on stderr and a negative value is returned.
  100. General use of this routine is not recommended. This routine is
  101. provided so the <tt>r.compress</tt> module can create uncompressed
  102. raster files.
  103. \section Allocating_Raster_I_O_Buffers Allocating Raster I/O Buffers
  104. Since there is no predefined limit for the number of columns in the
  105. region, buffers which are used for reading and writing raster data
  106. must be dynamically allocated.
  107. - Rast_allocate_buf()
  108. - Rast_allocate_c_buf()
  109. - Rast_allocate_f_buf()
  110. - Rast_allocate_d_buf()
  111. This routine allocates a buffer of type CELL/FCELL/DCELL just large enough
  112. to hold one row of raster data (based on the number of columns in the active
  113. region).
  114. \code
  115. int input_fd;
  116. char inmap;
  117. RASTER_MAP_TYPE data_type;
  118. input_fd = Rast_open_old(inmap, "");
  119. data_type = Rast_get_map_type(input_fd);
  120. cell = Rast_allocate_buf(data_type);
  121. \endcode
  122. <i>FIXME 7/2009: next still true?</i>
  123. If larger buffers are required, the routine G_malloc() can be
  124. used.
  125. If sufficient memory is not available, an error message is printed and
  126. exit() is called.
  127. - G_zero_buf()
  128. This routines assigns each member of the raster buffer array to zero.
  129. It assumes that the buffer has been allocated using
  130. Rast_allocate_c_buf().
  131. \section Reading_Raster_Files Reading Raster Files
  132. Raster data can be thought of as a two-dimensional matrix. The
  133. routines described below read one full row of the matrix. It should be
  134. understood, however, that the number of rows and columns in the matrix
  135. is determined by the region, not the raster file itself. Raster data
  136. is always read resampled (nearest neighbor) into the region. This allows
  137. the user to specify the coverage of the database during analyses. It also
  138. allows databases to consist of raster files which do not cover exactly the
  139. same area, or do not have the same grid cell resolution. When raster
  140. files are resampled into the region, they all "look" the same.
  141. <b>Note:</b> The rows and columns are specified "C style", i.e.,
  142. starting with 0.
  143. - Rast_get_row()
  144. This routine reads the specified <i>row</i> from the raster file open
  145. on file descriptor (as returned by Rast_open_old()) into the
  146. buffer. The buffer must be dynamically allocated large enough to hold
  147. one full row of raster data. It can be allocated using
  148. Rast_allocate_buf(). This routine prints a diagnostic message and
  149. returns -1 if there is an error reading the raster file. Otherwise a
  150. nonnegative value is returned.
  151. - Rast_get_row_nomask()
  152. This routine reads the specified row from the raster file open on file
  153. descriptor into the buffer like Rast_get_row() does. The difference
  154. is that masking is suppressed. If the user has a mask set,
  155. Rast_get_row() will apply the mask but Rast_get_row_nomask() will
  156. ignore it. This routine prints a diagnostic message and returns -1 if
  157. there is an error reading the raster file. Otherwise a nonnegative
  158. value is returned.
  159. <b>Note:</b> Ignoring the mask is not generally acceptable. Users
  160. expect the mask to be applied. However, in some cases ignoring the
  161. mask is justified. For example, the GRASS modules <tt>r.describe</tt>,
  162. which reads the raster file directly to report all data values in a
  163. raster file, and <tt>r.slope.aspect</tt>, which produces slope and
  164. aspect from elevation, ignore both the mask and the region. However,
  165. the number of GRASS modules which do this should be minimal. See \ref
  166. Mask for more information about the mask.
  167. \subsection Writing_Raster_Files Writing Raster Files
  168. - Rast_put_row()
  169. This routine writes one row of raster data from buffer to the raster
  170. file open on file descriptor. The raster file must have been opened
  171. with Rast_open_new(). The buffer must have been allocated large
  172. enough for the region, perhaps using Rast_allocate_buf(). If there
  173. is an error writing the raster file, a warning message is printed and
  174. -1 is returned. Otherwise 1 is returned.
  175. <b>Note:</b> The rows are written in <b>sequential</b> order. The
  176. first call writes row 0, the second writes row 1, etc. The following
  177. example assumes that the raster file is to be created:
  178. \code
  179. int fd, row, nrows, ncols;
  180. CELL *buf;
  181. RASTER_MAP_TYPE data_type;
  182. fd = Rast_open_old(inmap, ""); /*...data for the row */
  183. data_type = Rast_get_map_type(fd);
  184. Rast_put_row(fd, buf, data_type);
  185. \endcode
  186. \subsection Closing_Raster_Files Closing Raster Files
  187. All raster files are closed by one of the following routines, whether
  188. opened for reading or for writing.
  189. - Rast_close()
  190. The raster file opened on file descriptor is closed. Memory allocated
  191. for raster processing is freed. If open for writing, skeletal support
  192. files for the new raster file are created as well.
  193. <b>Note:</b> If a module wants to explicitly write support files
  194. (e.g., a specific color table) for a raster file it creates, it must
  195. do so after the raster file is closed. Otherwise the close will
  196. overwrite the support files. See \ref Raster_Map_Layer_Support_Routines
  197. for routines which write raster support files.
  198. - Rast_unopen()
  199. The raster file opened on file descriptor is closed. Memory allocated
  200. for raster processing is freed. If open for writing, the raster file
  201. is not created and the temporary file created when the raster file was
  202. opened is removed (see \ref Creating_and_Opening_New_Raster_Files).
  203. This routine is useful when errors are detected and it is desired to
  204. not create the new raster file. While it is true that the raster file
  205. will not be created if the module exits without closing the file, the
  206. temporary file will not be removed at module exit. GRASS database
  207. management will eventually remove the temporary file, but the file can
  208. be quite large and will take up disk space until GRASS does remove
  209. it. Use this routine as a courtesy to the user.
  210. \section Raster_Map_Layer_Support_Routines Raster Map Layer Support Routines
  211. GRASS map layers have a number of support files associated with
  212. them. These files are discussed in detail in \ref Raster_Maps. The
  213. support files are the <em>raster header</em>, the <em>category</em>
  214. file, the <em>color</em> table, the <em>history</em> file, and the
  215. <em>range</em> file. Each support file has its own data structure and
  216. associated routines.
  217. \section Raster_Header_File Raster Header File
  218. The raster header file (<tt>cellhd</tt>) contains information
  219. describing the geographic extent of the raster map, the grid cell
  220. resolution, the format used to store the data in the raster file, see
  221. Cell_head structure for details. The routines described below use the
  222. Cell_head structure which is shown in detail in \ref
  223. GIS_Library_Data_Structures.
  224. - Rast_get_cellhd()
  225. The raster header for the raster file in the specified mapset is read
  226. into the Cell_head structure.
  227. <b>Note:</b> If the raster file is a reclassified, the raster header
  228. for the referenced raster file is read instead. See Rast_is_reclass()
  229. for distinguishing reclass files from regular raster files.
  230. <b>Note:</b> It is not necessary to get the raster header for a map
  231. layer in order to read the raster file data. The routines which read
  232. raster file data automatically retrieve the raster header information
  233. and use it for resampling the raster file data into the active
  234. region. If it is necessary to read the raster file directly without
  235. resampling into the active region, then the raster header can be used
  236. to set the active region using G_set_window().
  237. - G_adjust_Cell_head()
  238. This function fills in missing parts of the input cell header (or
  239. region). It also makes projection-specific adjustments.
  240. - Rast_put_cellhd()
  241. This routine writes the information from the Cell_head structure to
  242. the raster header file for the map layer in the current mapset.
  243. <b>Note:</b> Programmers should have no reason to use this routine. It
  244. is used by Rast_close() to give new raster files correct header
  245. files, and by the <tt>r.support</tt> module to give users a means of
  246. creating or modifying raster headers.
  247. - Rast_is_reclass()
  248. This function determines if the raster file is a reclass file. Returns
  249. 1 if raster file is a reclass file, 0 if it is not, and -1 if there
  250. was a problem reading the raster header.
  251. - Rast_is_reclassed_to()
  252. This function generates a child reclass maps list from the
  253. cell_misc/reclassed_to file which stores this list. The
  254. cell_misc/reclassed_to file is written by
  255. Rast_put_reclass(). Rast_is_reclassed_to() is used by <tt>g.rename</tt>,
  256. <tt>g.remove</tt> and <tt>r.reclass</tt> to prevent accidentally
  257. deleting the parent map of a reclassed raster map.
  258. \section Raster_Category_File Raster Category File
  259. GRASS map layers have category labels associated with them. The
  260. category file is structured so that each category in the raster file
  261. can have a one-line description. The format of this file is described
  262. in \ref Raster_Category_File_Format.
  263. The routines described below manage the category file. Some of them
  264. use the <i>Categories</i> structure which is described in \ref
  265. GIS_Library_Data_Structures.
  266. \section Reading_and_Writing_the_Raster_Category_File Reading and Writing the Raster Category File
  267. The following routines read or write the category file itself:
  268. - Rast_read_cats()
  269. The category file for raster file is read into the <i>cats</i>
  270. structure. If there is an error reading the category file, a
  271. diagnostic message is printed and -1 is returned. Otherwise, 0 is
  272. returned.
  273. - Rast_write_cats()
  274. Writes the category file for the raster file in the current mapset
  275. from the <i>cats</i> structure. Returns 1 if successful. Otherwise, -1
  276. is returned (no diagnostic is printed).
  277. - Rast_get_title()
  278. If only the map layer title is needed, it is not necessary to read the
  279. entire category file into memory. This routine gets the title for
  280. raster file directly from the category file, and returns a pointer to
  281. the title. A legal pointer is always returned. If the map layer does
  282. not have a title, then a pointer to the empty string "" is returned.
  283. - Rast_put_title()
  284. If it is only desired to change the title for a map layer, it is not
  285. necessary to read the entire category file into memory, change the
  286. title, and rewrite the category file. This routine changes the title
  287. for the raster file in the current mapset directly in the category
  288. file. It returns a pointer to the title.
  289. \section Querying_and_Changing_the_Categories_Structure Querying and Changing the Categories Structure
  290. The following routines query or modify the information contained in
  291. the category structure:
  292. - Rast_get_cat()
  293. This routine looks up category in the cats structure and returns a
  294. pointer to a string which is the label for the category. A legal
  295. pointer is always returned. If the category does not exist in cats
  296. then a pointer to the empty string "" is returned.
  297. <b>Warning:</b> The pointer that is returned points to a hidden static
  298. buffer. Successive calls to Rast_get_cat() overwrite this buffer.
  299. - Rast_get_cats_title()
  300. Map layers store a one-line title in the category structure as
  301. well. This routine returns a pointer to the title contained in the
  302. cats structure. A legal pointer is always returned. If the map layer
  303. does not have a title, then a pointer to the empty string "" is
  304. returned.
  305. - Rast_init_cats()
  306. To construct a new category file, the structure must first be
  307. initialized. This routine initializes the cats structure, and copies
  308. the title into the structure.
  309. For example:
  310. \code
  311. struct Categories cats;
  312. Rast_init_cats ((CELL) 0, "", &cats);
  313. \endcode
  314. - Rast_set_cat()
  315. Copies the label into the cats structure for category.
  316. - Rast_set_cats_title()
  317. Copies the title is copied into the cats structure.
  318. - Rast_free_cats()
  319. Frees memory allocated by Rast_read_cats(), Rast_init_cats() and
  320. Rast_set_cat().
  321. \section Raster_Color_Table Raster Color Table
  322. GRASS map layers have colors associated with them. The color tables
  323. are structured so that each category in the raster file has its own
  324. color. The format of this file is described in
  325. \ref Raster_Color_Table_Format.
  326. The routines that manipulate the raster color file use the
  327. <i>Colors</i> structure which is described in detail in
  328. \ref GIS_Library_Data_Structures.
  329. \section Reading_and_Writing_the_Raster_Color_File Reading and Writing the Raster Color File
  330. The following routines read, create, modify, and write color tables.
  331. - Rast_read_colors()
  332. The color table for the raster file in the specified mapset is read
  333. into the <em>colors</em> structure. If the data layer has no color
  334. table, a default color table is generated and 0 is returned. If there
  335. is an error reading the color table, a diagnostic message is printed
  336. and -1 is returned. If the color table is read ok, 1 is returned.
  337. - Rast_write_colors()
  338. Write map layer color table. The color table is written for the raster
  339. file in the specified mapset from the <em>colors</em> structure. If
  340. there is an error, -1 is returned. No diagnostic is
  341. printed. Otherwise, 1 is returned.
  342. The <em>colors</em> structure must be created properly, i.e.,
  343. Rast_init_colors() to initialize the structure and Rast_add_color_rule() to
  344. set the category colors.
  345. <b>Note:</b> The calling sequence for this function deserves special
  346. attention. The <em>mapset</em> parameter seems to imply that it is
  347. possible to overwrite the color table for a raster file which is in
  348. another mapset. However, this is not what actually happens. It is very
  349. useful for users to create their own color tables for raster files in
  350. other mapsets, but without overwriting other users' color tables for
  351. the same raster file. If <em>mapset</em> is the current mapset, then
  352. the color file for <em>name</em> will be overwritten by the new color
  353. table. But if <em>mapset</em> is not the current mapset, then the
  354. color table is actually written in the current mapset under the
  355. <tt>colr2</tt> element as: <tt>colr2/mapset/name</tt>.
  356. \section Lookup_Up_Raster_Colors Lookup Up Raster Colors
  357. These routines translates raster values to their respective colors.
  358. - Rast_lookup_colors()
  359. Extracts colors for an array of raster values. The colors from the
  360. raster array are stored in the red, green, and blue arrays.
  361. <b>Note:</b> The red, green, and blue intensities will be in the range
  362. 0-255.
  363. - Rast_get_color()
  364. Get a category color. The red, green, and blue intensities for the
  365. color associated with category are extracted from the colors
  366. structure. The intensities will be in the range 0-255.
  367. \section Creating_and_or_Modifying_the_Color_Table Creating and/or Modifying the Color Table
  368. These routines allow the creation of customized color tables as well as the
  369. modification of existing tables.
  370. - Rast_init_colors()
  371. Initialize <i>colors</i> structure for subsequent calls
  372. Rast_add_color_rule() and Rast_set_color().
  373. - Rast_add_color_rule()
  374. This is the heart and soul of the color logic. It adds a color
  375. rule to the <em>colors</em> structure. The colors defined by the red,
  376. green, and blue values are assigned to the categories
  377. respectively. Colors for data values between two categories are not
  378. stored in the structure but are interpolated when queried by
  379. Rast_lookup_colors() and Rast_get_color(). The color components must be in the
  380. range 0-255.
  381. For example, to create a linear grey scale for the range 200-1000:
  382. \code
  383. struct Colors colr;
  384. Rast_init_colors (&colr) ;
  385. Rast_add_color_rule ((CELL) 200, 0,0,0,(CELL) 1000, 255,255,255) ;
  386. \endcode
  387. The programmer is encouraged to review \ref Raster_Color_Table_Format.
  388. <b>Note:</b> The <em>colors</em> structure must have been initialized
  389. by Rast_init_colors(). See \ref Predefined_Color_Tables for routines to
  390. build some predefined color tables.
  391. - Rast_set_color()
  392. Set a category color. The red, green, and blue intensities for the
  393. color associated with category The intensities must be in the range
  394. 0-255. Values below zero are set as zero, values above 255 are set as
  395. 255.
  396. <b>Warning:</b> Use of this routine is discouraged because it defeats
  397. the new color logic. It is provided only for backward
  398. compatibility. Overuse can create large color
  399. tables. Rast_add_color_rule() should be used whenever possible.
  400. <b>Note:</b> The <em>colors</em> structure must have been initialized
  401. by Rast_init_color().
  402. - Rast_get_color_range()
  403. - Rast_get_d_color_range()
  404. Get color range. Gets the minimum and maximum raster values that have
  405. colors associated with them.
  406. - Rast_free_colors()
  407. Free dynamically allocated memory associated with the <em>colors</em>
  408. structure.
  409. <b>Note:</b> This routine may be used after Rast_read_colors() as well as
  410. after Rast_init_colors().
  411. \section Predefined_Color_Tables Predefined Color Tables
  412. The following routines generate entire color tables. The tables are
  413. loaded into a <i>colors</i> structure based on a range of category
  414. values from minimum to maximum value. The range of values for a raster
  415. map can be obtained, for example, using Rast_read_range().
  416. <b>Note:</b> The color tables are generated without information about
  417. any particular raster file.
  418. These color tables may be created for a raster map, but they may also
  419. be generated for loading graphics colors. These routines return -1 if
  420. minimum value is greater than maximum value, 1 otherwise.
  421. - Rast_make_aspect_colors()
  422. Generates a color table for aspect data.
  423. - Rast_make_ramp_colors()
  424. Generates a color table with 3 sections: red only, green only, and
  425. blue only, each increasing from none to full intensity. This table is
  426. good for continuous data, such as elevation.
  427. - Rast_make_wave_colors()
  428. Generates a color table with 3 sections: red only, green only, and
  429. blue only, each increasing from none to full intensity and back down
  430. to none. This table is good for continuous data like elevation.
  431. - Rast_make_grey_scale_colors()
  432. Generates a grey scale color table. Each color is a level of grey,
  433. increasing from black to white.
  434. - Rast_make_rainbow_colors()
  435. Generates a "shifted" rainbow color table - yellow to green to cyan to
  436. blue to magenta to red. The color table is based on rainbow
  437. colors. (Normal rainbow colors are red, orange, yellow, green, blue,
  438. indigo, and violet.) This table is good for continuous data, such as
  439. elevation.
  440. - Rast_make_random_colors()
  441. Generates random colors. Good as a first pass at a color table for
  442. nominal data.
  443. - Rast_make_ryg_colors()
  444. Generates a color table that goes from red to yellow to green.
  445. - Rast_make_gyr_colors()
  446. Generates a color table that goes from green to yellow to red.
  447. - Rast_make_histogram_eq_colors()
  448. Generates a histogram contrast-stretched grey scale color table that goes
  449. from the, histogram information.
  450. \section Raster_History_File Raster History File
  451. The history file contains documentary information about the raster
  452. file: who created it, when it was created, what was the original data
  453. source, what information is contained in the raster file, etc.
  454. The following routines manage this file. They use the History
  455. structure which is described in \ref GIS_Library_Data_Structures.
  456. <b>Note:</b> This structure has existed relatively unmodified since
  457. the inception of GRASS. It is in need of overhaul. Programmers should
  458. be aware that future versions of GRASS may no longer support either
  459. the routines or the data structure which support the history file.
  460. - Rast_read_history()
  461. Reads raster history file. This routine reads the history file for the
  462. raster map into the History structure.
  463. - Rast_write_history()
  464. Writes raster history file. This routine writes the history file for
  465. the raster map in the current mapset from the History structure.
  466. <b>Note:</b> The History structure should first be
  467. initialized using Rast_short_history().
  468. - Rast_short_history()
  469. This routine initializes History structure, recording the date, user,
  470. module name and the raster map.
  471. <b>Note:</b> This routine only initializes the data structure. It does
  472. not write the history file.
  473. \section Raster_Range_File Raster Range File
  474. The following routines manage the raster range file. This file
  475. contains the minimum and maximum values found in the raster file. The
  476. format of this file is described in \ref Raster_Range_File_Format.
  477. The routines below use the <i>Range</i> data structure which is
  478. described in \ref GIS_Library_Data_Structures.
  479. - Rast_read_range()
  480. Reads raster range. This routine reads the range information for the
  481. raster map into the <i>range</i> structure. A diagnostic message is
  482. printed and -1 is returned if there is an error reading the range
  483. file. Otherwise, 0 is returned.
  484. - Rast_write_range()
  485. Write raster range file. This routine writes the range information for
  486. the raster map in the current mapset from the <i>range</i>
  487. structure. A diagnostic message is printed and -1 is returned if there
  488. is an error writing the range file. Otherwise, 0 is returned.
  489. The range structure must be initialized and updated using the following
  490. routines:
  491. - Rast_init_range()
  492. Initializes the <i>range</i> structure for updates by Rast_update_range()
  493. and Rast_row_update_range().
  494. - Rast_update_range()
  495. Compares the category value with the minimum and maximum values in the
  496. <i>range</i> structure, modifying the range if the value extends the
  497. range.
  498. - Rast_row_update_range()
  499. This routine updates the range data just like Rast_update_range().
  500. The range structure is queried using the following routine:
  501. - Rast_get_range_min_max()
  502. Get range minimum and maximum value.
  503. \section Raster_Histograms Raster Histograms
  504. The following routines provide a relatively efficient mechanism for
  505. computing and querying a histogram of raster data. They use the
  506. <b>Cell_stats</b> structure to hold the histogram information. The
  507. histogram is a count associated with each unique raster value
  508. representing the number of times each value was inserted into the
  509. structure.
  510. These next two routines are used to manage the Cell_stats structure:
  511. - Rast_init_cell_stats()
  512. Initialize cell stats, This routine, which must be called first,
  513. initializes the Cell_stats structure.
  514. - Rast_free_cell_stats()
  515. Free cell stats. The memory associated with structure is freed. This
  516. routine may be called any time after calling Rast_init_cell_stats().
  517. This next routine stores values in the histogram:
  518. - Rast_update_cell_stats()
  519. Adds data to cell stats. Once all values are stored, the structure may
  520. be queried either randomly (i.e., search for a specific raster value) or
  521. sequentially (retrieve all raster values, in ascending order, and
  522. their related count):
  523. - Rast_find_cell_stat()
  524. Random query of cell stats. This routine allows a random query of the
  525. Cell_stats structure. The routine returns 1 if <B>cat</B> was found in
  526. the structure, 0 otherwise.
  527. Sequential retrieval is accomplished using these next 2 routines:
  528. - Rast_rewind_cell_stats()
  529. Reset/rewind cell stats. The structure is rewound (i.e., positioned at
  530. the first raster category) so that sorted sequential retrieval can
  531. begin.
  532. - Rast_next_cell_stat()
  533. Retrieve sorted cell stats. Retrieves the next <i>cat, count</i>
  534. combination from the structure. Returns 0 if there are no more items,
  535. non-zero if there are more.
  536. For example:
  537. \code
  538. struct Cell_stats s;
  539. CELL cat;
  540. long count;
  541. /* updating s occurs here */
  542. Rast_rewind_cell_stats(&s);
  543. while(Rast_next_cell_stat(&cat, &count, &s))
  544. fprintf(stdout, "%ld %ld\n", (long) cat, count);
  545. \endcode
  546. \section GRASS_5_raster_API GRASS 5 raster API
  547. <em>Needs to be merged into above sections.</em>
  548. \subsection The_CELL_Data_Type The CELL Data Type
  549. GRASS integer raster map data is defined to be of type CELL. This data
  550. type is defined in the "gis.h" header file. Programmers must declare
  551. all variables and buffers which will hold raster data or category
  552. codes as type CELL. Under GRASS the CELL data type is declared to be
  553. "int", but the programmer should not assume this. What should be
  554. assumed is that CELL is a signed integer type. It may be changed
  555. sometime to short or long. This implies that use of CELL data with
  556. routines which do not know about this data type (e.g.,
  557. <tt>fprintf(stdout, ...), sscanf()</tt>, etc.) must use an
  558. intermediate variable of type long. To print a CELL value, it must be
  559. cast to long. For example:
  560. \code
  561. CELL c; /* raster value to be printed */
  562. /* some code to get a value for c */
  563. fprintf(stdout, "%ld\n", (long) c); /* cast c to long to print */
  564. \endcode
  565. To read a CELL value, for example from user typed input, it is
  566. necessary to read into a long variable, and then assign it to the CELL
  567. variable. For example (this example does not check for valid inputs,
  568. EOF, etc., which good code must do):
  569. \code
  570. char userbuf[128];
  571. CELL c;
  572. long x;
  573. fprintf (stdout, "Which category? "); /* prompt user */
  574. gets(userbuf); /* get user response * /
  575. sscanf (userbuf,"%ld", &x); /* scan category into long variable */
  576. c = (CELL) x; /* assign long value to CELL value */
  577. \endcode
  578. Of course, with GRASS library routines that are designed to handle the
  579. CELL type, this problem does not arise. It is only when CELL data must
  580. be used in routines which do not know about the CELL type, that the
  581. values must be cast to or from long.
  582. \subsection GRASS_5_raster_API_gish Changes to gis.h
  583. The "gis.h" contains 5 new items:
  584. \code
  585. typedef float FCELL;
  586. typedef double DCELL;
  587. typedef int RASTER_MAP_TYPE;
  588. #define CELL_TYPE 0
  589. #define FCELL_TYPE 1
  590. #define DCELL_TYPE 2
  591. \endcode
  592. Also "gis.h" contains the definitions for new structures:
  593. \code
  594. struct FPReclass;
  595. struct FPRange;
  596. struct Quant;
  597. \endcode
  598. Some of the old structures such as
  599. \code
  600. struct Categories
  601. struct Cell_stats;
  602. struct Range;
  603. struct _Color_Rule_;
  604. struct _Color_Info_;
  605. struct Colors;
  606. \endcode
  607. were modified, so it is very important to use functional interface to
  608. access and set elements of these structures instead of accessing
  609. elements of the structures directly. Because some former elements such
  610. as for example <tt>(struct Range range.pmin)</tt> do not exist
  611. anymore. It was made sure non of the former elements have different
  612. meaning, so that the programs which do access the old elements
  613. directly either do not compile or work exactly the same way as prior
  614. to change.
  615. \subsection NULL_value_functions NULL-value functions
  616. - Rast_set_null_value()
  617. Set NULL value. For raster type <tt>CELL_TYPE</tt> use
  618. Rast_set_c_null_value(), for <tt>FCELL_TYPE</tt> Rast_set_f_null_value(),
  619. and for <tt>DCELL_TYPE</tt> Rast_set_d_null_value().
  620. - Rast_insert_null_values()
  621. Insert NULL value. If raster type is <tt>CELL_TYPE</tt> calls
  622. Rast_insert_c_null_values(), <tt>FCELL_TYPE</tt> calls
  623. Rast_insert_f_null_values(), and <tt>DCELL_TYPE</tt> calls
  624. Rast_insert_d_null_values().
  625. - Rast_is_null_value()
  626. Check NULL value. If raster type is <tt>CELL_TYPE</tt>, calls
  627. Rast_is_c_null_value(), <tt>FCELL_TYPE</tt> calls
  628. Rast_is_f_null_value(), and <tt>DCELL_TYPE</tt> calls
  629. Rast_is_d_null_value().
  630. It isn't good enough to test for a particular NaN bit pattern since
  631. the machine code may change this bit pattern to a different NaN. The
  632. test will be
  633. \code
  634. if(fcell == 0.0) return 0;
  635. if(fcell > 0.0) return 0;
  636. if(fcell < 0.0) return 0;
  637. return 1;
  638. \endcode
  639. or (as suggested by Mark Line)
  640. \code
  641. return(FCELL != fcell) ;
  642. \endcode
  643. - Rast_allocate_null_buf()
  644. Allocates an array of char based on the number of columns in the
  645. current region.
  646. - Rast_get_null_value_row()
  647. Reads a row from NULL value bitmap file for the raster map open for
  648. read. If there is no bitmap file, then this routine simulates the read
  649. as follows: non-zero values in the raster map correspond to non-NULL;
  650. zero values correspond to NULL. When MASK exists, masked cells are set
  651. to null.
  652. \subsection Floating_point_and_type_independent_functions Floating-point and type-independent functions
  653. - Rast_maskfd()
  654. Test for current maskreturns file descriptor number if MASK is in use
  655. and -1 if no MASK is in use.
  656. - Rast_map_is_fp()
  657. Returns true(1) if raster map is a floating-point dataset; false(0)
  658. otherwise.
  659. - Rast_map_type()
  660. Returns the storage type for raster map:
  661. - <tt>CELL_TYPE</tt> for integer raster map
  662. - <tt>FCELL_TYPE</tt> for floating-point raster map
  663. - <tt>DCELL_TYPE</tt> for floating-point raster map (double precision)
  664. - Rast_open_new()
  665. Creates new raster map in the current mapset. Calls G_open_map_new()
  666. for raster type <tt>CELL_TYPE</tt>, G_open_fp_map_new() for
  667. floating-point raster map. The use of this routine by applications is
  668. discouraged since its use would override user preferences (what
  669. precision to use).
  670. - Rast_set_fp_type()
  671. This controls the storage type for floating-point raster maps. It
  672. affects subsequent calls to Rast_open_fp_new(). The <em>type</em>
  673. must be one of <tt>FCELL_TYPE</tt> (float) or <tt>DCELL_TYPE</tt>
  674. (double). The use of this routine by applications is discouraged since
  675. its use would override user preferences.
  676. - Rast_open_fp_new()
  677. Creates a new floating-point raster map (in <tt>.tmp</tt>) and returns
  678. a file descriptor. The storage type (float or double) is determined by
  679. the last call to Rast_set_fp_type() or the default (float - unless the
  680. GRASS environmental variable GRASS_FP_DOUBLE is set).
  681. - Rast_allocate_buf()
  682. - Rast_allocate_c_buf()
  683. - Rast_allocate_f_buf()
  684. - Rast_allocate_d_buf()
  685. Allocate an arrays of CELL, FCELL, or DCELL (depending on raster type)
  686. based on the number of columns in the current region.
  687. - Rast_incr_void_ptr()
  688. Advances void pointer by n bytes. Returns new pointer value. Usefull
  689. in raster row processing loops, substitutes
  690. \code
  691. CELL *cell;
  692. cell += n;
  693. \endcode
  694. Now
  695. \code
  696. rast = Rast_incr_void_ptr(rast, Rast_raster_size(data_type));
  697. \endcode
  698. Where <i>rast</i> is void* and data_type is RASTER_MAP_TYPE can be
  699. used instead of rast++.) Very usefull to generalize the row processing
  700. - loop (i.e. void * buf_ptr += Rast_raster_size(data_type))
  701. - Rast_raster_size()
  702. If <i>data_type</i> is CELL_TYPE, returns sizeof(CELL), for FCELL_TYPE
  703. returns sizeof(FCELL), and for <EM>data_type</EM> is DCELL_TYPE,
  704. returns sizeof(DCELL).
  705. - Rast_raster_cmp()
  706. Compares raster values.
  707. - Rast_raster_cpy()
  708. Copies raster values.
  709. - Rast_set_value_c()
  710. If Rast_is_c_null_value() is true, sets value to null value. Converts
  711. CELL value to raster data type value and stores the result. Used for
  712. assigning CELL values to raster cells of any type.
  713. - Rast_set_value_f()
  714. If Rast_is_f_null_value() is true, sets value to null value. Converts
  715. FCELL val to raster data type and stores the result. Used for
  716. assigning FCELL values to raster cells of any type.
  717. - Rast_set_value_d()
  718. If Rast_is_d_null_value() is true, sets value to null value. Converts
  719. DCELL val to raster data type and stores the result. Used for
  720. assigning DCELL values to raster cells of any type.
  721. - Rast_get_value_c()
  722. Retrieves the value of raster type, converts it to CELL type and
  723. returns the result. If null value is stored, returns CELL null
  724. value. Used for retreiving CELL values from raster cells of any type.
  725. Note: when data_type != CELL_TYPE, no quantization is used, only type conversion.
  726. - Rast_get_value_f()
  727. Retrieves the value of raster type, converts it to FCELL type and
  728. returns the result. If null value is stored, returns FCELL null
  729. value. Used for retreiving FCELL values from raster cells of any type.
  730. - Rast_get_value_d()
  731. Retrieves the value of raster type, converts it to DCELL type and
  732. returns the result. If null value is stored, returns DCELL null
  733. value. Used for retreiving DCELL values from raster cells of any type.
  734. - Rast_get_row ()
  735. For CELL_TYPE raster type calls Rast_get_c_row(), FCELL_TYPE calls
  736. Rast_get_f_row(), and DCELL_TYPE Rast_get_d_row().
  737. - Rast_get_row_nomask().
  738. Same as Rast_get_f_row() except no masking occurs.
  739. - Rast_get_f_row()
  740. Read a row from the raster map performing type conversions as
  741. necessary based on the actual storage type of the map. Masking,
  742. resampling into the current region. NULL-values are always embedded
  743. (never converted to a value).
  744. - Rast_get_f_row_nomask()
  745. Same as Rast_get_f_row() except no masking occurs.
  746. - Rast_get_d_row()
  747. Same as Rast_get_f_row() except that the array double.
  748. - Rast_get_d_row_nomask()
  749. Same as Rast_get_d_row() except no masking occurs.
  750. - Rast_get_c_row()
  751. Reads a row of raster data and leaves the NULL values intact. (As
  752. opposed to the deprecated function Rast_get_row() which converts NULL
  753. values to zero.)
  754. <b>Note:</b> When the raster map is old and null file doesn't exist,
  755. it is assumed that all 0-cells are no-data. When map is floating
  756. point, uses quant rules set explicitly by Rast_set_quant_rules or stored
  757. in map's quant file to convert floats to integers.
  758. - Rast_get_c_row_nomask()
  759. Same as Rast_get_c_row() except no masking occurs.
  760. - Rast_put_row()
  761. If raster type is CELL_TYPE, calls Rast_put_c_row(), if FCELL_TYPE, then calls Rast_put_f_row(), and for DCELL_TYPE, calls Rast_put_d_row().
  762. - Rast_put_f_row()
  763. Write the next row of the raster map performing type conversion to the
  764. actual storage type of the resultant map. Keep track of the range of
  765. floating-point values. Also writes the NULL-value bitmap from the
  766. NULL-values embedded in the data array.
  767. - Rast_put_d_row()
  768. Same as Rast_put_f_row() except that the array is double.
  769. - Rast_put_c_row()
  770. Writes a row of raster data and a row of the null-value bitmap, only
  771. treating NULL as NULL. (As opposed to the deprecated function
  772. Rast_put_row() which treats zero values also as NULL.)
  773. - Rast_zero_row()
  774. Depending on raster type zeroes out Rast_window_cols() CELLs, FCELLs, or
  775. DCELLs stored in cell buffer.
  776. - Rast_get_sample()
  777. Extracts a cell value from raster map at given position with nearest neighbor interpolation, bilinear interpolation or cubic interpolation.
  778. \section Upgrades_to_Raster_Functions Upgrades to Raster Functions (comparing to GRASS 4.x)
  779. These routines will be modified (internally) to work with
  780. floating-point and NULL-values.
  781. - Rast_close()
  782. If the map is a new floating point, move the <TT>.tmp</TT> file into
  783. the <TT>fcell</TT> element, create an empty file in the <TT>cell</TT>
  784. directory; write the floating-point range file; write a default
  785. quantization file quantization file is set here to round fp numbers
  786. (this is a default for now). Create an empty category file, with max
  787. cat = max value (for backwards compatibility). Move the <TT>.tmp</TT>
  788. NULL-value bitmap file to the <TT>cell_misc</TT> directory.
  789. - Rast_open_old()
  790. Arrange for the NULL-value bitmap to be read as well as the raster
  791. map. If no NULL-value bitmap exists, arrange for the production of
  792. NULL-values based on zeros in the raster map.
  793. If the map is floating-point, arrange for quantization to integer for
  794. Rast_get_c_row(), et. al., by reading the quantization rules for
  795. the map using Rast_read_quant().
  796. If the programmer wants to read the floating point map using uing
  797. quant rules other than the ones stored in map's quant file, he/she
  798. should call Rast_set_quant_rules() after the call to Rast_open_old().
  799. - Rast_get_row()
  800. If the map is floating-point, quantize the floating-point values to
  801. integer using the quantization rules established for the map when the
  802. map was opened for reading (this quantization is read from
  803. cell_misc/name/f_quant file, but can be reset after opening raster map
  804. by Rast_set_quant_rules()). NULL values are converted to zeros. <b>This
  805. routine is deprecated!!</b>
  806. - Rast_put_row()
  807. Zero values are converted to NULLs. Write a row of the NULL value bit
  808. map. <b>This routine is deprecated!!</b>
  809. \section Null_no_data NULL (no data) handling
  810. The <tt>null</tt> file is stored in <tt>cell_misc/name/null file</tt>.
  811. -2^31 (= 0x80000000 = -2147483648) is the null value for the CELL
  812. type, so you'll never see that value in a map.
  813. The FP nulls are the all-ones bit patterns. These corresponds to NaN
  814. according to the IEEE-754 formats, although it isn't the "default" NaN
  815. pattern generated by most architectures (which is usually 7fc00000 or
  816. ffc00000 for float and 7ff8000000000000 or fff8000000000000 for
  817. double, i.e. an all-ones exponent, the top-bit of the mantissa set,
  818. and either sign).
  819. So far as arithmetic is concerned, any value with an all-ones exponent
  820. and a non-zero mantissa is treated as NaN. But the GRASS
  821. Rast_is_[fd]_null_value() functions only consider the all-ones bit
  822. pattern to be null. I intend to change this in 7.x so that all FP NaN
  823. values are treated as null. This will mean that code which can
  824. generate NaNs doesn't have to explicitly convert them to the GRASS
  825. null value.
  826. <b>Presence or absence of <tt>null</tt> file:</b>
  827. For an integer map, any cells which were null will become zero, but
  828. any zeroes (cells which were previously either null or zero) will be
  829. treated as nulls (this is for compatibility with GRASS 4.x, which
  830. didn't have a <tt>null</tt> file, but typically used zero to indicate
  831. a null value).
  832. For a floating-point map, any cells which were null will become zero
  833. (when writing FP data, a null has a zero written to the fcell/\<map\>
  834. file, and the corresponding bit is set in the <tt>null</tt> file).
  835. \section Color_Functions Color Functions (new and upgraded)
  836. \subsection Upgraded_Colors_structures Upgraded Colors structures
  837. \code
  838. struct _Color_Rule_
  839. {
  840. struct
  841. {
  842. int version; /* set by read_colors: -1=old,1=new */
  843. DCELL shift;
  844. int invert;
  845. int is_float; /* defined on floating point raster data? */
  846. int null_set; /* the colors for null are set? */
  847. unsigned char null_red, null_grn, null_blu;
  848. int undef_set; /* the colors for cells not in range are set? */
  849. unsigned char undef_red, undef_grn, undef_blu;
  850. struct _Color_Info_ fixed, modular;
  851. DCELL cmin, cmax;
  852. };
  853. \endcode
  854. \section New_functions_to_support_colors_for_floating_point New functions to support colors for floating-point
  855. - Rast_lookup_colors()
  856. If raster type is CELL_TYPE, calls Rast_lookup_colors(), if FCELL_TYPE,
  857. calls Rast_lookup_f_colors(), and for DCELL_TYPE
  858. Rast_lookup_d_colors().
  859. - Rast_lookup_c_colors()
  860. - Rast_lookup_f_colors()
  861. Converts the floating-point values in the float data array to their
  862. <em>r,g,b</em> color components. Embedded NULL-values are handled
  863. properly as well.
  864. - Rast_lookup_d_colors()
  865. Converts the floating-point values in the double data array to their
  866. <em>r,g,b</em> color components. Embedded NULL-values are handled
  867. properly as well.
  868. - Rast_add_color_rule()
  869. If raster type is CELL_TYPE, calls Rast_add_c_color_rule(), if
  870. FCELL_TYPE, calls Rast_add_f_color_rule(), and for DCELL_TYPE
  871. calls Rast_add_d_color_rule().
  872. - Rast_get_color()
  873. Looks up the rgb colors for the value in the color table.
  874. - Rast_mark_colors_as_fp()
  875. Sets a flag in the <em>colors</em> structure that indicates that these
  876. colors should only be looked up using floating-point raster data (not
  877. integer data).
  878. \section New_functions_to_support_a_colors_for_the_NULL_value New functions to support a color for the NULL-value
  879. - Rast_set_null_value_color()
  880. Sets the color (in <em>colors</em>) for the NULL-value to <em>r,g,b</em>.
  881. - Rast_get_null_value_color()
  882. Puts the red, green, and blue components of the color for the
  883. NULL-value into <em>r,g,b</em>.
  884. \section New_functions_to_support_a_default_color New functions to support a default color
  885. - Rast_set_default_color()
  886. Sets the default color (in <em>colors</em>) to <em>r,g,b</em>. This is
  887. the color for values which do not have an explicit rule.
  888. - Rast_get_default_color()
  889. Puts the red, green, and blue components of the <tt>"default"</tt>
  890. color into <em>r,g,b</em>.
  891. \section New_functions_to_support_treating_a_raster_layer_as_a_color_image New functions to support treating a raster layer as a color image
  892. - Rast_get_row_colors()
  893. Reads a row of raster data and converts it to red, green and blue
  894. components according to the colors.
  895. This provides a convenient way to treat a raster layer as a color
  896. image without having to explicitly cater for each of CELL, FCELL and
  897. DCELL types.
  898. \section Upgraded_color_functions Upgraded color functions
  899. - Rast_read_colors()
  900. This routine reads the rules from the color file. If the input raster
  901. map is is a floating-point map (FCELL or DCELL) it calls
  902. Rast_mark_colors_as_fp().
  903. - Rast_write_colors()
  904. The rules are written out using floating-point format, removing
  905. trailing zeros (possibly producing integers). The flag marking the
  906. colors as floating-point is <b>not</b> written.
  907. - Rast_get_colors_min_max()
  908. If the color table is marked as <tt>"float"</tt>, then return the
  909. minimum as -(255&#94;3 * 128) and the maximum as (255&#94;3 *
  910. 128). This is to simulate a very <em>large</em> range so that GRASS
  911. doesn't attempt to use <em>colormode float</em> to allow interactive
  912. toggling of colors.
  913. - Rast_lookup_colors()
  914. Modified to return a color for NULL-values.
  915. - Rast_get_color()
  916. Modified to return a color for the NULL-value.
  917. \section Changes_to_the_Colors_structure Changes to the Colors structure
  918. Modifications to the Colors structure to support colors for
  919. floating-point data and the NULL-value consist of
  920. - the _Color_Rule_ struct was changed to have DCELL value (instead of
  921. CELL cat) to have the range be floating-point values instead of
  922. integer cats.
  923. - a color for NULL was added
  924. - the special color for zero was eliminated
  925. - a default color for values which have no assigned color was added
  926. - a flag was added to the Colors structure to indicate if either the
  927. map itself is floating-point (If the map is integer and the floating
  928. point functions are used to lookup colors, the values are checked to
  929. see if they are integer, and if they are, the integer mechanism is
  930. used)
  931. - fp_lookup - a lookup table for floating point numbers is added. It
  932. orders the end points of fp intervals into array with a pointer to a
  933. color rule for each inteval, and the binary search is then used when
  934. looking up colors instead of linearly searching through all color
  935. rules.
  936. \section Changes_to_the_colr_file Changes to the \c colr file
  937. - The rules are written out using floating-point format, removing trailing zeros (possibly producing integers) . For example, to ramp from red to green for the range [1.3,5.0]:
  938. \verbatim
  939. 1.3:255:0:0 5:0:255:0
  940. \endverbatim
  941. - The NULL-value color is written as:
  942. \verbatim
  943. nv:red:grn:blu
  944. \endverbatim
  945. - The default color (for values that don't have an explicit rule) is written
  946. as:
  947. \verbatim
  948. *:red:grn:blu
  949. \endverbatim
  950. \section Range_functions Range functions (new and upgraded)
  951. \subsection Modified_range_functions Modified range functions
  952. - Rast_read_range()
  953. Old range file (those with 4 numbers) should treat zeros in this file
  954. as NULL-values. New range files (those with just 2 numbers) should
  955. treat these numbers as real data (zeros are real data in this case).
  956. An empty range file indicates that the min, max are undefined. This is
  957. a valid case, and the result should be an initialized range struct
  958. with no defined min/max.
  959. If the range file is missing and the map is a floating-point map, this
  960. function will create a default range by calling
  961. Rast_construct_default_range().
  962. - Rast_init_range()
  963. Must set a flag in the range structure that indicates that no min/max
  964. have been defined - probably a "first" boolean flag.
  965. - Rast_update_range()
  966. NULL-values must be detected and ignored.
  967. - Rast_get_range_min_max()
  968. If the range structure has no defined min/max (first!=0) there will
  969. not be a valid range. In this case the min and max returned must be
  970. the NULL-value.
  971. - Rast_write_range()
  972. This routine only writes 2 numbers (min,max) to the range file,
  973. instead of the 4 (pmin,pmax,nmin,nmax) previously written. If there is
  974. no defined min,max, an empty file is written.
  975. \section New_range_functions New range functions
  976. - Rast_construct_default_range()
  977. Sets the integer range to [1,255].
  978. - Rast_read_range()
  979. If raster type is CELL_TYPE, calls Rast_read_range(), otherwise calls
  980. Rast_read_fp_range().
  981. - Rast_read_fp_range()
  982. Read the floating point range file <tt>f_range</tt>. This file is
  983. written in binary using XDR format. If there is no defined min/max in
  984. FPRange structure, an empty <tt>f_range</tt> file is created.
  985. An empty range file indicates that the min, max are undefined. This is
  986. a valid case, and the result should be an initialized range struct
  987. with no defined min/max.
  988. If the range file is missing and the map is a floating-point map, this
  989. function will create a default range by calling
  990. Rast_construct_default_range().
  991. - Rast_init_range()
  992. If raster type is CELL_TYPE, calls Rast_init_range(), otherwise calls
  993. Rast_init_fp_range().
  994. - Rast_init_fp_range()
  995. Must set a flag in the range structure that indicates that no min/max
  996. have been defined - probably a "first" boolean flag.
  997. - Rast_update_f_range()
  998. - Rast_update_d_range()
  999. Updates the floating-point range from the values in NULL-values must
  1000. be detected and ignored.
  1001. - Rast_get_fp_range_min_max()
  1002. Extract the min/max from the FPRange structure. If the range structure
  1003. has no defined min/max (first!=0) there will not be a valid range. In
  1004. this case the min and max returned must be the NULL-value.
  1005. - Rast_write_fp_range()
  1006. Write the floating point range file <tt>f_range</tt>. This file is
  1007. written in binary using XDR format. If there is no defined min/max in
  1008. <EM>r</EM>, an empty <tt>f_range</tt> file is created.
  1009. \section New_and_Upgraded_Cell_stats_functions New and Upgraded Cell_stats functions
  1010. Modified Cell_stats functions to handle NULL-values:
  1011. - Rast_init_cell_stats()
  1012. Set the count for NULL-values to zero.
  1013. - Rast_update_cell_stats()
  1014. Look for NULLs and update the NULL-value count.
  1015. - Rast_next_cell_stat()
  1016. Do not return a record for the NULL-value.
  1017. - Rast_find_cell_stat()
  1018. Allow finding the count for the NULL-value.
  1019. - Rast_get_stats_for_null_value()
  1020. Get a number of null values from stats structure. Note: when reporting
  1021. values which appear in a map using Rast_next_cell_stats() , to get stats
  1022. for null, call Rast_get_stats_for_null_value() first, since
  1023. Rast_next_cell_stats() does not report stats for null.
  1024. \section New_Quantization_Functions New Quantization Functions
  1025. New functions to support quantization of floating-point to integer:
  1026. - Rast_write_quant()
  1027. Writes the <tt>f_quant</tt> file for the raster map. If
  1028. mapset==Rast_mapset() i.e. the map is in current mapset, then the
  1029. original quant file in <tt>cell_misc/map/f_quant</tt> is
  1030. written. Othewise is written into <tt>quant2/mapset/name</tt> (much
  1031. like colr2 element). This results in map&#64;mapset being read using
  1032. quant rules stored Rast_mapset(). See Rast_read_quant() for detailes.
  1033. - Rast_set_quant_rules()
  1034. Sets quant translation rules for raster map opened for reading. After
  1035. calling this function, Rast_get_c_row() and Rast_get_row() will
  1036. use defined rules (instead of using rules defined in map's quant file)
  1037. to convert floats to ints.
  1038. - Rast_read_quant()
  1039. Reads quantization rules for raster map and stores them in the
  1040. quantization structure. If the map is in another mapset, first checks
  1041. for quant2 table for this map in current mapset.
  1042. - Rast_quant_init()
  1043. Initializes the Quant struct.
  1044. - Rast_quant_free()
  1045. Frees any memory allocated in Quant structure and re-initializes the
  1046. structure by calling Rast_quant_init().
  1047. - Rast_quant_truncate()
  1048. Sets the quant rules to perform simple truncation on floats.
  1049. - Rast_quant_truncate()
  1050. Sets the quant rules to perform simple rounding on floats.
  1051. - Rast_quant_organize_fp_lookup()
  1052. Organizes fp_lookup table for faster (logarithmic) lookup time
  1053. Rast_quant_organize_fp_lookup() creates a list of min and max for each
  1054. quant rule, sorts this list, and stores the pointer to quant rule that
  1055. should be used inbetween any 2 numbers in this list Also it stores
  1056. extreme points for 2 infinite rules, if exist After the call to
  1057. Rast_quant_organize_fp_lookup() instead of linearly searching through
  1058. list of rules to find a rule to apply, quant lookup will perform a
  1059. binary search to find an interval containing floating point value, and
  1060. then use the rule associated with this interval. When the value
  1061. doesn't fall within any interval, check for the infinite rules.
  1062. - Rast_quant_add_rule()
  1063. Add the rule that the floating-point range produces an integer in the
  1064. range by linear interpolation. Rules that are added later have higher
  1065. precedence when searching. If any of of the values is the NULL-value,
  1066. this rule is not added and 0 is returned. Otherwise return 1. if the
  1067. fp_lookup is organized, destroy it.
  1068. - Rast_quant_set_positive_infinite_rule()
  1069. - Rast_quant_get_positive_infinite_rule()
  1070. This rule has lower precedence than rules added with Rast_quant_add_rule().
  1071. - Rast_quant_set_negative_infinite_rule()
  1072. This rule has lower precedence than rules added with Rast_quant_add_rule().
  1073. - Rast_quant_get_negative_infinite_rule()
  1074. - Rast_quant_get_limits()
  1075. Extracts the minimum and maximum floating-point and integer values
  1076. from all the rules.
  1077. - Rast_quant_nrules()
  1078. Returns the number of rules, excluding the negative and positive
  1079. "infinite" rules.
  1080. - Rast_quant_get_rule()
  1081. The order of the rules returned by increasing <i>n</i> is the order
  1082. in which the rules are applied when quantizing a value - the first
  1083. rule applicable is used.
  1084. - Rast_quant_get_cell_value()
  1085. - Rast_quant_perform_d()
  1086. - Rast_quant_perform_f()
  1087. These next two functions are convenience functions to allow applications to
  1088. easily create quantization rules other than the defaults:
  1089. - Rast_quantize_fp_map()
  1090. Writes the <tt>f_quant</tt> file for the raster map.
  1091. - Rast_quantize_fp_map_range()
  1092. Writes the <tt>f_quant</TT> file for the raster map with one rule.
  1093. \section Categories_Labeling_Functions Categories Labeling Functions (new and upgraded)
  1094. \subsection Upgraded_Categories_structure Upgraded Categories structure
  1095. All the new programs which are using Categories structure directly
  1096. have to be modified to use API functions to update and retrieve info
  1097. from Categories structure. Both new and old API function can be used,
  1098. since old functions still have exact same functionality (even though
  1099. internally they are implemented very differently). New function names
  1100. end with raster_cats(); old function names end with _cats().
  1101. We made sure that all old fields in Categories structure are either
  1102. missing in new Categories structure or have exactly the same
  1103. meaning. We did it so that the modules using Categories structure
  1104. directly either do not compile with new gis library or work exactly
  1105. the same as bnefore. A programmer might want to read the data in a
  1106. floating point map in a way that each cell value stores index of it's
  1107. category label and data range. The way to do it is to call
  1108. Rast_set_quant_rules() after openning the map.
  1109. This is helpful when trying to collect statistics (how many cells of
  1110. each category are in the map. (although there is another new mechanism
  1111. to collect such stats - see Rast_mark_cats()) . Another reason to
  1112. get a category index instead of fp values is that this index will be
  1113. the FID into GRASS-DBMS link. Also he can use Rast_get_ith_cat()
  1114. to get the category information for each cell using this index.
  1115. Here is the new Categories structure defined in gis.h:
  1116. \code
  1117. struct Categories
  1118. {
  1119. CELL ncats ; /* total number of categories */
  1120. CELL num ; /* the highest cell values. Only exists
  1121. for backwards compatibility = (CELL)
  1122. max_fp_values in quant rules */
  1123. char *title ; /* name of data layer */
  1124. char *fmt ; /* printf-like format to generate labels */
  1125. float m1 ; /* Multiplication coefficient 1 */
  1126. float a1 ; /* Addition coefficient 1 */
  1127. float m2 ; /* Multiplication coefficient 2 */
  1128. float a2 ; /* Addition coefficient 2 */
  1129. struct Quant q ; /* rules mapping cell values to index in
  1130. list of labels */
  1131. char **labels ; /* array of labels of size num */
  1132. int * marks ; /* was the value with this label was used? */
  1133. int nalloc;
  1134. int last_marked_rule ;
  1135. } ;
  1136. \endcode
  1137. \section Changes_to_the_cats_file Changes to the \c cats file
  1138. The format of explicit label entries is the same for integer maps.
  1139. \verbatim
  1140. cat:description
  1141. \endverbatim
  1142. In addition label entries of new format is supported for floating point maps.
  1143. \verbatim
  1144. val:descr (where val is a floating point number)
  1145. \endverbatim
  1146. or
  1147. \verbatim
  1148. val1:val2:descr (where val1, val2 is a floating point range)
  1149. \endverbatim
  1150. Internally the labels are stored for fp ranges of data. However when
  1151. the cats file is written, all the decimal zeros are stripped so that
  1152. integer values appear as integers in the file. Also if values are the
  1153. same, only 1 value is written (i.e. first format).
  1154. This way even though the old cats files will be processed differently
  1155. internally, the user or application programmer will not notice this
  1156. difference as long as the proper api is used and the elements of
  1157. Categories structure are not accessed directly without API calls.
  1158. \section Range_functions Range functions (new and upgraded)
  1159. \section New_Functions_to_read_write_access_and_modify_Categories_structure New Functions to read/write access and modify Categories structure
  1160. - Rast_read_cats()
  1161. Is the same as existing Rast_read_cats().
  1162. - Rast_copy_cats()
  1163. - Rast_get_cat()
  1164. - Rast_get_c_cat()
  1165. - Rast_get_f_cat()
  1166. - Rast_get_d_cat()
  1167. Returns pointer to a string describing category.
  1168. - Rast_set_cat()
  1169. - Rast_set_c_cat()
  1170. - Rast_set_f_cat()
  1171. - Rast_set_d_cat()
  1172. Adds the label for range in category structure.
  1173. - Rast_number_of_cats()
  1174. Returns the number of labels. DO NOT use Rast_number_of_cats() (it
  1175. returns max cat number).
  1176. - Rast_get_ith_cat()
  1177. - Rast_get_ith_c_cat()
  1178. - Rast_get_ith_f_cat()
  1179. - Rast_get_ith_d_cat()
  1180. Returns i-th description and i-th data range from the list of category
  1181. descriptions with corresponding data ranges.
  1182. - Rast_get_cats_title()
  1183. Returns pointer to a string with title.
  1184. - Rast_unmark_cats()
  1185. Sets marks for all categories to 0. This initializes Categories
  1186. structure for subsequest calls to Rast_mark_cats () for each row
  1187. of data, where non-zero mark for i-th label means that some of the
  1188. cells in rast_row are labeled with i-th label and fall into i-th data
  1189. range.
  1190. These marks help determine from the Categories structure which labels
  1191. were used and which weren't.
  1192. - Rast_get_next_marked_cat()
  1193. - Rast_get_next_marked_c_cat()
  1194. - Rast_get_next_marked_f_cat()
  1195. - Rast_get_next_marked_d_cat()
  1196. Finds the next label and corresponding data range in the list of
  1197. marked categories. The category (label + data range) is marked by
  1198. Rast_mark_cats(). End points of the data range are converted to
  1199. raster type and returned. The number of times value from i-th
  1200. cat. data range appeared so far is returned in stats. See
  1201. Rast_unmark_cats(), Rast_rewind_cats() and Rast_mark_cats
  1202. ().
  1203. - Rast_mark_cats()
  1204. - Rast_mark_c_cats()
  1205. - Rast_mark_f_cats()
  1206. - Rast_mark_d_cats()
  1207. Looks up the category label for each raster value in the raster row
  1208. (row of raster cell value) and updates the marks for labels found.
  1209. Note: non-zero mark for i-th label stores the number of of raster
  1210. cells read so far which are labeled with i-th label and fall into i-th
  1211. data range.
  1212. - Rast_rewind_cats()
  1213. After call to this function Rast_get_next_marked_cat() returns the
  1214. first marked cat label.
  1215. - Rast_init_cats()
  1216. Same as existing Rast_init_cats() only ncats argument is
  1217. missign. ncats has no meaning in new Categories structure and only
  1218. stores (int) largets data value for backwards compatibility.
  1219. - Rast_set_cats_fmt()
  1220. Same as existing Rast_set_cats_fmt().
  1221. - Rast_set_cats_title()
  1222. Same as existing Rast_set_cats_title().
  1223. - Rast_write_cats()
  1224. Same as existing Rast_write_cats().
  1225. - Rast_free_cats()
  1226. Same as existing Rast_free_cats().
  1227. \section Library_Functions_that_are_Deprecated Library Functions that are Deprecated
  1228. These functions are deprecated, since they imply that the application
  1229. that uses them has not been upgraded to handle NULL-values and should
  1230. be eliminated from GRASS code.
  1231. - Rast_get_row()
  1232. To be replaced by Rast_get_c_row().
  1233. - Rast_get_row_nomask()
  1234. To be replaced by Rast_get_c_row_nomask().
  1235. - Rast_put_row()
  1236. To be replaced by Rast_put_c_row().
  1237. These functions are deprecated, since they can not be upgraded to
  1238. support NULL-values, and should be eliminated from GRASS code.
  1239. - Rast_open_map_new_random()
  1240. - Rast_put_row_random()
  1241. <b>Also, no support for random writing of floating-point rasters will be provided.</b>
  1242. \section Guidelines_for_upgrading_GRASS_4_x_Modules Guidelines for upgrading GRASS 4.x Modules
  1243. - Modules that process raster maps as <em>continuous</em> data should
  1244. read raster maps as floating-point. Modules that process raster maps
  1245. as <em>nominal</em> data should read raster maps as integer.
  1246. <em>Exception:</em> Modules that process raster colors or the modules
  1247. which report on raster categories labels should either always read the
  1248. maps as floating-point, or read the maps as integer if the map is
  1249. integer and floating-point if the map is floating-point.
  1250. - The quantization of floating-point to integer should NOT change the
  1251. color table. The color lookup should have its own separate
  1252. quantization.
  1253. - The quantization of floating-point to integer should NOT change the
  1254. Categories table. The Categories structure should have its own
  1255. separate quantization.
  1256. - Modules that read or write floating-point raster maps should use
  1257. <tt>double</tt> (<tt>DCELL</tt>) arrays instead of <tt>float</tt>
  1258. (<tt>FCELL</tt>) arrays.
  1259. - Modues should process NULL values in a well defined (consistent)
  1260. manner. Modules that processed zero as the pseudo NULL-value should
  1261. be changed to use the true NULL-value for this and process zero as
  1262. normal value.
  1263. - Modules should process non-NULL values as normal numbers and not
  1264. treat any particular numbers (e.g. zero) as special.
  1265. \section Important_hints_for_upgrades_to_modules Important hints for upgrades to raster modules
  1266. In general modules that use Rast_get_row(). Should use
  1267. Rast_get_c_row() instead.
  1268. Modules that use Rast_put_row(). Should use Rast_put_c_row()
  1269. instead.
  1270. \section Loading_the_Raster_Library Loading the Raster Library
  1271. The library is loaded by specifying
  1272. \verbatim
  1273. $(RASTERLIB)
  1274. \endverbatim
  1275. in the <tt>Makefile</tt>.
  1276. \section listOfFunctios List of functions
  1277. <b>TODO: Reorder functions</b>
  1278. \subsection MemoryAllocation Memory allocation
  1279. - Rast_allocate_c_buf()
  1280. - Rast_allocate_f_buf()
  1281. - Rast_allocate_d_buf()
  1282. - Rast_allocate_null_buf()
  1283. TODO: used in r.null and r.support, why Rast__ and not Rast_?
  1284. - Rast__allocate_null_bits()
  1285. - Rast__null_bitstream_size()
  1286. \subsection RasterMask Raster Mask
  1287. - Rast_suppress_masking()
  1288. - Rast_unsuppress_masking()
  1289. \subsection RasterStatistics Raster statistics
  1290. - Rast_cell_size()
  1291. - Rast_init_cell_stats()
  1292. - Rast_update_cell_stats()
  1293. - Rast_find_cell_stat()
  1294. - Rast_rewind_cell_stats()
  1295. - Rast_next_cell_stat()
  1296. - Rast_get_stats_for_null_value()
  1297. - Rast_free_cell_stats()
  1298. - Rast_cell_stats_histo_eq()
  1299. - Rast_get_cell_title()
  1300. - Rast_cell_stats_histo_eq()
  1301. \subsection RasterCategories Raster category management
  1302. - Rast_read_cats()
  1303. - Rast_get_max_cat()
  1304. - Rast_get_cats_title()
  1305. - Rast_get_c_cat()
  1306. - Rast_get_f_cat()
  1307. - Rast_get_d_cat()
  1308. - Rast_get_cat()
  1309. - Rast_unmark_cats()
  1310. - Rast_mark_c_cats()
  1311. - Rast_mark_f_cats()
  1312. - Rast_mark_d_cats()
  1313. - Rast_mark_cats()
  1314. - Rast_rewind_cats()
  1315. - Rast_get_next_marked_d_cat()
  1316. - Rast_get_next_marked_f_cat()
  1317. - Rast_get_next_marked_c_cat()
  1318. - Rast_get_next_marked_cat()
  1319. - Rast_set_c_cat()
  1320. - Rast_set_f_cat()
  1321. - Rast_set_d_cat()
  1322. - Rast_write_cats()
  1323. - Rast_get_ith_d_cat()
  1324. - Rast_get_ith_f_cat()
  1325. - Rast_get_ith_c_cat()
  1326. - Rast_get_ith_cat()
  1327. - Rast_init_cats()
  1328. - Rast_set_cats_title()
  1329. - Rast_set_cats_fmt()
  1330. - Rast_free_cats()
  1331. - Rast_copy_cats()
  1332. - Rast_number_of_cats()
  1333. - Rast_sort_cats()
  1334. \subsection RasterFileManagement Raster file management
  1335. - Rast_close()
  1336. - Rast_unopen()
  1337. \subsection ColorFunctions Color functions
  1338. - Rast_make_ryg_colors()
  1339. - Rast_make_ryg_fp_colors()
  1340. - Rast_make_aspect_colors()
  1341. - Rast_make_aspect_fp_colors()
  1342. - Rast_make_byr_colors()
  1343. - Rast_make_byr_fp_colors()
  1344. - Rast_make_bgyr_colors()
  1345. - Rast_make_bgyr_fp_colors()
  1346. - Rast_make_byg_colors()
  1347. - Rast_make_byg_fp_colors()
  1348. - Rast_make_grey_scale_colors()
  1349. - Rast_make_grey_scale_fp_colors()
  1350. - Rast_make_gyr_colors()
  1351. - Rast_make_gyr_fp_colors()
  1352. - Rast_make_rainbow_colors()
  1353. - Rast_make_rainbow_fp_colors()
  1354. - Rast_make_ramp_colors()
  1355. - Rast_make_ramp_fp_colors()
  1356. - Rast_make_wave_colors()
  1357. - Rast_make_wave_fp_colors()
  1358. - Rast_free_colors()
  1359. - Rast_get_color()
  1360. - Rast_get_c_color()
  1361. - Rast_get_f_color()
  1362. - Rast_get_d_color()
  1363. - Rast_get_null_value_color()
  1364. - Rast_get_default_color()
  1365. - Rast_make_histogram_eq_colors()
  1366. - Rast_make_histogram_log_colors()
  1367. - Rast_init_colors()
  1368. - Rast_invert_colors()
  1369. - Rast_lookup_c_colors()
  1370. - Rast_lookup_f_colors()
  1371. - Rast_lookup_d_colors()
  1372. - Rast_lookup_colors()
  1373. - Rast_make_random_colors()
  1374. - Rast_set_c_color_range()
  1375. - Rast_set_d_color_range()
  1376. - Rast_get_c_color_range()
  1377. - Rast_get_d_color_range()
  1378. - Rast_read_colors()
  1379. - Rast_mark_colors_as_fp()
  1380. - Rast_remove_colors()
  1381. - Rast_add_d_color_rule()
  1382. - Rast_add_f_color_rule()
  1383. - Rast_add_c_color_rule()
  1384. - Rast_add_color_rule()
  1385. - Rast_add_modular_d_color_rule()
  1386. - Rast_add_modular_f_color_rule()
  1387. - Rast_add_modular_c_color_rule()
  1388. - Rast_add_modular_color_rule()
  1389. - Rast_colors_count()
  1390. - Rast_get_fp_color_rule()
  1391. - Rast_parse_color_rule()
  1392. - Rast_parse_color_rule_error()
  1393. - Rast_read_color_rule()
  1394. - Rast_read_color_rules()
  1395. - Rast_load_colors()
  1396. - Rast_load_fp_colors()
  1397. - Rast_make_colors()
  1398. - Rast_make_fp_colors()
  1399. - Rast_set_c_color()
  1400. - Rast_set_d_color()
  1401. - Rast_set_null_value_color()
  1402. - Rast_set_default_color()
  1403. - Rast_shift_c_colors()
  1404. - Rast_shift_d_colors()
  1405. - Rast_write_colors()
  1406. \subsection RasterFloatingPointManagement Raster floating point management
  1407. - Rast_fpreclass_clear()
  1408. - Rast_fpreclass_reset()
  1409. - Rast_fpreclass_init()
  1410. - Rast_fpreclass_set_domain()
  1411. - Rast_fpreclass_set_range()
  1412. - Rast_fpreclass_get_limits()
  1413. - Rast_fpreclass_nof_rules()
  1414. - Rast_fpreclass_get_ith_rule()
  1415. - Rast_fpreclass_set_neg_infinite_rule()
  1416. - Rast_fpreclass_get_neg_infinite_rule()
  1417. - Rast_fpreclass_set_pos_infinite_rule()
  1418. - Rast_fpreclass_get_pos_infinite_rule()
  1419. - Rast_fpreclass_add_rule()
  1420. - Rast_fpreclass_reverse_rule_order()
  1421. - Rast_fpreclass_get_cell_value()
  1422. - Rast_fpreclass_perform_di()
  1423. - Rast_fpreclass_perform_df()
  1424. - Rast_fpreclass_perform_dd()
  1425. - Rast_fpreclass_perform_fi()
  1426. - Rast_fpreclass_perform_ff()
  1427. - Rast_fpreclass_perform_fd()
  1428. - Rast_fpreclass_perform_ii()
  1429. - Rast_fpreclass_perform_if()
  1430. - Rast_fpreclass_perform_id()
  1431. \subsection RasterMapReading Raster map reading
  1432. - Rast_get_cellhd()
  1433. - Rast_get_row_nomask()
  1434. - Rast_get_c_row_nomask()
  1435. - Rast_get_f_row_nomask()
  1436. - Rast_get_d_row_nomask()
  1437. - Rast_get_row()
  1438. - Rast_get_c_row()
  1439. - Rast_get_f_row()
  1440. - Rast_get_d_row()
  1441. - Rast_get_null_value_row()
  1442. - Rast_get_row_colors()
  1443. \subsection RasterMapHistogram Raster map histogram
  1444. - Rast_histogram_eq()
  1445. - Rast_init_histogram()
  1446. - Rast_read_histogram()
  1447. - Rast_write_histogram()
  1448. - Rast_write_histogram_cs()
  1449. - Rast_make_histogram_cs()
  1450. - Rast_get_histogram_num()
  1451. - Rast_get_histogram_cat()
  1452. - Rast_get_histogram_count()
  1453. - Rast_free_histogram()
  1454. - Rast_sort_histogram()
  1455. - Rast_sort_histogram_by_count()
  1456. - Rast_remove_histogram()
  1457. - Rast_add_histogram()
  1458. - Rast_set_histogram()
  1459. - Rast_extend_histogram()
  1460. - Rast_zero_histogram()
  1461. - Rast_want_histogram()
  1462. \subsection RasterMapHistory Raster map history
  1463. - Rast_read_history()
  1464. - Rast_write_history()
  1465. - Rast_short_history()
  1466. - Rast_command_history()
  1467. \subsection RasterMapInterpolation Raster map interpolation
  1468. - Rast_interp_linear()
  1469. - Rast_interp_bilinear()
  1470. - Rast_interp_cubic()
  1471. - Rast_interp_bicubic()
  1472. \subsection RasterMapQuantization Raster map quantization
  1473. - Rast_quant_clear()
  1474. - Rast_quant_free()
  1475. - Rast_quant_init()
  1476. - Rast_quant_is_truncate()
  1477. - Rast_quant_is_round()
  1478. - Rast_quant_truncate()
  1479. - Rast_quant_round()
  1480. - Rast_quant_get_limits()
  1481. - Rast_quant_nof_rules()
  1482. - Rast_quant_get_ith_rule()
  1483. - Rast_quant_set_neg_infinite_rule()
  1484. - Rast_quant_get_neg_infinite_rule()
  1485. - Rast_quant_set_pos_infinite_rule()
  1486. - Rast_quant_get_pos_infinite_rule()
  1487. - Rast_quant_add_rule()
  1488. - Rast_quant_reverse_rule_order()
  1489. - Rast_quant_get_cell_value()
  1490. - Rast_quant_perform_d()
  1491. - Rast_quant_perform_f()
  1492. - Rast_quantize_fp_map()
  1493. - Rast_quantize_fp_map_range()
  1494. - Rast_write_quant()
  1495. - Rast_read_quant()
  1496. \subsection ToDo yet unsorted functions
  1497. - Rast_maskfd()
  1498. - Rast_mask_info()
  1499. - Rast_set_null_value()
  1500. - Rast_set_c_null_value()
  1501. - Rast_set_f_null_value()
  1502. - Rast_set_d_null_value()
  1503. - Rast_is_null_value()
  1504. - Rast_is_c_null_value()
  1505. - Rast_is_f_null_value()
  1506. - Rast_is_d_null_value()
  1507. - Rast_insert_null_values()
  1508. - Rast_insert_c_null_values()
  1509. - Rast_insert_f_null_values()
  1510. - Rast_insert_d_null_values()
  1511. - Rast_open_old()
  1512. - Rast_open_c_new()
  1513. - Rast_open_c_new_uncompressed()
  1514. - Rast_set_cell_format()
  1515. - Rast_get_cell_format()
  1516. - Rast_open_fp_new()
  1517. - Rast_open_fp_new_uncompressed()
  1518. - Rast_set_fp_type()
  1519. - Rast_map_is_fp()
  1520. - Rast_map_type()
  1521. - Rast_get_map_type()
  1522. - Rast_open_new()
  1523. - Rast_open_new_uncompressed()
  1524. - Rast_set_quant_rules()
  1525. - Rast_put_cellhd()
  1526. - Rast_put_row()
  1527. - Rast_put_c_row()
  1528. - Rast_put_f_row()
  1529. - Rast_put_d_row()
  1530. - Rast_put_cell_title()
  1531. - Rast_truncate_fp_map()
  1532. - Rast_round_fp_map()
  1533. - Rast_construct_default_range()
  1534. - Rast_read_fp_range()
  1535. - Rast_read_range()
  1536. - Rast_write_range()
  1537. - Rast_write_fp_range()
  1538. - Rast_update_range()
  1539. - Rast_update_fp_range()
  1540. - Rast_row_update_range()
  1541. - Rast_row_update_fp_range()
  1542. - Rast_init_range()
  1543. - Rast_get_range_min_max()
  1544. - Rast_init_fp_range()
  1545. - Rast_get_fp_range_min_max()
  1546. - Rast_raster_cmp()
  1547. - Rast_raster_cpy()
  1548. - Rast_set_c_value()
  1549. - Rast_set_f_value()
  1550. - Rast_set_d_value()
  1551. - Rast_get_c_value()
  1552. - Rast_get_f_value()
  1553. - Rast_get_d_value()
  1554. - Rast_read_units()
  1555. - Rast_read_vdatum()
  1556. - Rast_write_units()
  1557. - Rast_write_vdatum()
  1558. - Rast_is_reclass()
  1559. - Rast_is_reclassed_to()
  1560. - Rast_get_reclass()
  1561. - Rast_free_reclass()
  1562. - Rast_put_reclass()
  1563. - Rast_get_sample_nearest()
  1564. - Rast_get_sample_bilinear()
  1565. - Rast_get_sample_cubic()
  1566. - Rast_get_sample()
  1567. - Rast_zero_c_buf()
  1568. - Rast_zero_buf()
  1569. */