OpendTect  6.3
conncomponents.h
Go to the documentation of this file.
1 #pragma once
2 
3 /*+
4 ________________________________________________________________________
5 
6  (C) dGB Beheer B.V.; (LICENSE) http://opendtect.org/OpendTect_license.txt
7  Author: Bo Zhang/Yuancheng Liu
8  Date: July 2012
9 ________________________________________________________________________
10 
11 
12 -*/
13 
14 
15 #include "algomod.h"
16 #include "factory.h"
17 
18 
19 template <class T> class Array2D;
20 template <class T> class Array2DSlice;
21 template <class T> class Array3D;
22 
23 class TaskRunner;
24 
32 {
33 public:
34 
35  ConnComponents(const Array2D<bool>&);
36  ~ConnComponents();
37 
38  void compute(TaskRunner* tskr=0);
39 
40  int nrComponents() const;
41  const TypeSet<int>* getComponent(int compidx);
42  const Array2D<int>* getLabel() const { return label_; }
43  void trimCompBranches(TypeSet<int>& comp);
44  static void trimCompBranches(TypeSet<int>& comp,int sz1);
45  static void getCompSticks(TypeSet<int>& comp,int sz1,
46  int allowgapsz, int minsticksz,
47  TypeSet<TypeSet<int> >& sticks);
48  /*Will change comp, make copy before call this*/
49 
50  float overLapRate(int componentidx);
51  /*Minimum rate of all dimensions.*/
52 
53 protected:
54 
55  void classifyMarks(Array2D<int>& mark);
56  void setMark(Array2D<int>& r,int source,int newval);
57 
62 };
63 
64 
71 {
72 public:
73 
74  ConnComponents3D(const Array3D<bool>&);
75  ~ConnComponents3D();
76 
77  void compute(TaskRunner* tskr=0);
78 
79  struct VPos {
80  VPos() : i(-1),j(-1),k(-1) {}
81  int i;int j;int k;
82  };
83  int nrComponents() const;
84  const ObjectSet<VPos>* getComponent(int compidx);
85  /*<Comp size is sorted descending. */
86 
87 protected:
88 
89  void addToComponent(
90  const TypeSet<TypeSet<TypeSet<int> > >& comps,
91  int sliceidx,int compidx,
92  TypeSet<TypeSet<unsigned char> >& usedcomps,
93  ObjectSet<VPos>& rescomp);
94 
98 };
const Array2D< bool > & input_
Definition: conncomponents.h:58
#define mExpClass(module)
Definition: commondefs.h:157
TypeSet< int > sortedindex_
Definition: conncomponents.h:97
ObjectSet< ObjectSet< VPos > > components_
Definition: conncomponents.h:96
Classify connected components of a binarized array 3D, components are sorted in size.
Definition: conncomponents.h:70
const Array3D< bool > & input_
Definition: conncomponents.h:95
Set of pointers to objects.
Definition: commontypes.h:28
TypeSet< int > sortedindex_
Definition: conncomponents.h:61
Array2D ( Subclass of ArrayND ) is a two dimensional array.
Definition: arraynd.h:127
Class that can execute a task.
Definition: task.h:193
Subclass of Array2D and ArrayNDSliceBase.
Definition: arrayndslice.h:90
TypeSet< TypeSet< int > > components_
Definition: conncomponents.h:60
Definition: conncomponents.h:79
Array2D< int > * label_
Definition: conncomponents.h:59
Classify connected components of a binarized array 2D, components are sorted in size. User could get the best quadratic fit for the component if needed.
Definition: conncomponents.h:31
int k
Definition: conncomponents.h:81
Array3D ( Subclass of ArrayND ) is a three dimensional array.
Definition: arraynd.h:149
VPos()
Definition: conncomponents.h:80
const Array2D< int > * getLabel() const
Definition: conncomponents.h:42

Generated at for the OpendTect seismic interpretation project. Copyright (C): dGB Beheer B. V. 2017