ClusterAlgorithm.h 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. /**
  2. * @file ClusterAlgorithm.h
  3. * @brief Interface for Cluster-Algorithms
  4. * @author Erik Rodner, Alexander Freytag
  5. * @date 10/29/2007 (last update on 12-02-2014 ( dd-mm-yyyy ) )
  6. */
  7. #ifndef CLUSTERALGORITHMINCLUDE
  8. #define CLUSTERALGORITHMINCLUDE
  9. // nice-core includes
  10. #include <core/basics/Exception.h>
  11. #include <core/basics/Persistent.h>
  12. #include <core/basics/Config.h>
  13. //
  14. #include <core/vector/VectorT.h>
  15. #include <core/vector/MatrixT.h>
  16. #include <core/vector/VVector.h>
  17. namespace OBJREC {
  18. /** Interface for Cluster-Algorithms */
  19. class ClusterAlgorithm : public NICE::Persistent
  20. {
  21. protected:
  22. public:
  23. ///////////////////// ///////////////////// /////////////////////
  24. // CONSTRUCTORS / DESTRUCTORS
  25. ///////////////////// ///////////////////// /////////////////////
  26. /** simple constructor */
  27. ClusterAlgorithm();
  28. /** simple destructor */
  29. virtual ~ClusterAlgorithm();
  30. /**
  31. * @brief Jobs previously performed in the config-version of the constructor, read settings etc. -- nothing to do here
  32. * @author Alexander Freytag
  33. * @date 12-02-2014 ( dd-mm-yyyy )
  34. */
  35. virtual void initFromConfig ( const NICE::Config * _conf, const std::string & _confSection = "ClusterAlgorithm");
  36. ///////////////////// ///////////////////// /////////////////////
  37. // CLUSTERING STUFF
  38. ///////////////////// ///////////////////// //////////////////
  39. virtual void cluster (
  40. const NICE::VVector & features,
  41. NICE::VVector & prototypes,
  42. std::vector<double> & weights,
  43. std::vector<int> & assignment ) = 0;
  44. ///////////////////// INTERFACE PERSISTENT /////////////////////
  45. // interface specific methods for store and restore
  46. ///////////////////// INTERFACE PERSISTENT /////////////////////
  47. /**
  48. * @brief Load object from external file (stream) -- nothing to do here
  49. * @author Alexander Freytag
  50. * @date 12-02-2014 ( dd-mm-yyyy )
  51. */
  52. void restore ( std::istream & is, int format = 0 );
  53. /**
  54. * @brief Save object to external file (stream) -- nothing to do here
  55. * @author Alexander Freytag
  56. * @date 12-02-2014 ( dd-mm-yyyy )
  57. */
  58. void store ( std::ostream & os, int format = 0 ) const;
  59. /**
  60. * @brief Clear object -- nothing to do here
  61. * @author Alexander Freytag
  62. * @date 12-02-2014 ( dd-mm-yyyy )
  63. */
  64. void clear ();
  65. };
  66. } // namespace
  67. #endif