GRMSegmenterTemplate.h 1.88 KB
Newer Older
Pierre Lassalle's avatar
Pierre Lassalle committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62
/*=========================================================================

  Program: Generic Region Merging Library
  Language: C++
  author: Lassalle Pierre
  contact: lassallepierre34@gmail.com



  Copyright (c) Centre National d'Etudes Spatiales. All rights reserved


     This software is distributed WITHOUT ANY WARRANTY; without even
     the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
     PURPOSE.  See the above copyright notices for more information.

     Template Model to help the developper to add a new criterion
     This file as well as his corresponding txx file has to be added
     src folder.

=========================================================================*/
#ifndef __GRM_MYSEGMENTER_H
#define __GRM_MYSEGMENTER_H
#include "grmSegmenter.h"

namespace grm
{
	struct MySpecificNode : Node<MySpecificNode>
	{
		// Specific Attributes for your criterion.
	};

	struct MySpecificParams
	{
		// Specific user-defined parameters for your criterion.
	};
	
	template<class TImage>
	class MySegmenter : public Segmenter< TImage, MySpecificNode, MySpecificParams>
	{
	public:

		/* Some convenient typedefs (put them all) */
		typedef Segmenter<TImage, MySpecificNode, MySpecificParams> Superclass;
		typedef TImage ImageType;
		typedef MySpecificParams ParameterType;
		typedef typename Superclass::GraphType GraphType;
		typedef MySpecificNode NodeType;
		typedef typename Superclass::EdgeType EdgeType;
		typedef typename Superclass::NodePointerType NodePointerType;
		typedef typename Superclass::GraphOperatorType GraphOperatorType;
		typedef GraphToOtbImage<GraphType> IOType;

		// Mandatory functions to be defined by the developer.
		void InitFromImage();
		float ComputeMergingCost(NodePointerType n1, NodePointerType n2);
		void UpdateSpecificAttributes(NodePointerType n1, NodePointerType n2);
	};
	
} // end of namespace grm
#include "GRMSegmenterTemplate.txx"
#endif