iclass_local_proto.h 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. /*!
  2. \file lib/imagery/iclass_local_proto.h
  3. \brief Imagery library - functions for wx.iclass
  4. Computation based on training areas for supervised classification.
  5. Based on i.class module (GRASS 6).
  6. Copyright (C) 1999-2007, 2011 by the GRASS Development Team
  7. This program is free software under the GNU General Public License
  8. (>=v2). Read the file COPYING that comes with GRASS for details.
  9. \author David Satnik, Central Washington University (original author)
  10. \author Markus Neteler <neteler itc.it> (i.class module)
  11. \author Bernhard Reiter <bernhard intevation.de> (i.class module)
  12. \author Brad Douglas <rez touchofmadness.com>(i.class module)
  13. \author Glynn Clements <glynn gclements.plus.com> (i.class module)
  14. \author Hamish Bowman <hamish_b yahoo.com> (i.class module)
  15. \author Jan-Oliver Wagner <jan intevation.de> (i.class module)
  16. \author Anna Kratochvilova <kratochanna gmail.com> (rewriting for wx.iclass)
  17. \author Vaclav Petras <wenzeslaus gmail.com> (rewriting for wx.iclass)
  18. */
  19. #ifndef ICLASS_LOCAL_PROTO_H
  20. #define ICLASS_LOCAL_PROTO_H
  21. #include <grass/imagery.h>
  22. #include <grass/raster.h>
  23. #include <grass/vector.h>
  24. #define MAX_CATS 256
  25. /*! Point of area perimeter */
  26. typedef struct
  27. {
  28. int x; /*!< column */
  29. int y; /*!< row */
  30. } IClass_point;
  31. /*! Holds perimeter points of one area.
  32. Perimeter is represented by rasterized area outline
  33. (not only vertices).
  34. */
  35. typedef struct
  36. {
  37. int npoints;
  38. IClass_point *points;
  39. } IClass_perimeter;
  40. /*! Holds perimeters of training areas. */
  41. typedef struct
  42. {
  43. int nperimeters;
  44. IClass_perimeter *perimeters;
  45. } IClass_perimeter_list;
  46. /* iclass_statistics.c */
  47. void alloc_statistics(IClass_statistics * statistics, int nbands);
  48. int make_statistics(IClass_statistics * statistics,
  49. IClass_perimeter * perimeter, CELL ** band_buffer,
  50. int *band_fd);
  51. int make_all_statistics(IClass_statistics * statistics,
  52. IClass_perimeter_list * perimeters,
  53. CELL ** band_buffer, int *band_fd);
  54. void create_raster(IClass_statistics * statistics, CELL ** band_buffer,
  55. int *band_fd, const char *raster_name);
  56. void band_range(IClass_statistics *, int);
  57. float mean(IClass_statistics * statistics, int band);
  58. float stddev(IClass_statistics * statistics, int band);
  59. float var(IClass_statistics * statistics, int band1, int band2);
  60. float var_signature(IClass_statistics * statistics, int band1, int band2);
  61. /* iclass_bands.c */
  62. void open_band_files(struct Ref *refer, CELL *** band_buffer, int **band_fd);
  63. void close_band_files(struct Ref *refer, CELL ** band_buffer, int *band_fd);
  64. void read_band_row(CELL ** band_buffer, int *band_fd, int nbands, int row);
  65. /* iclass_perimeter.c */
  66. int vector2perimeters(struct Map_info *, const char *layer_name,
  67. int category, IClass_perimeter_list * perimeters,
  68. struct Cell_head *band_region);
  69. int make_perimeter(struct line_pnts *points, IClass_perimeter * perimeter,
  70. struct Cell_head *band_region);
  71. int edge2perimeter(IClass_perimeter * perimeter, int x0, int y0, int x1,
  72. int y1);
  73. void perimeter_add_point(IClass_perimeter * perimeter, int x, int y);
  74. int edge_order(const void *aa, const void *bb);
  75. void free_perimeters(IClass_perimeter_list * perimeters);
  76. /* iclass.c */
  77. int init_group(const char *group_name, struct Ref *refer);
  78. #endif /* ICLASS_LOCAL_PROTO_H */