isce3  0.1.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Pages
ICU.h
1 #pragma once
2 
3 #include <array> // std::array
4 #include <complex> // std::complex
5 #include <cstddef> // size_t
6 #include <cstdint> // uint8_t
7 
8 #include <isce3/io/Raster.h> // isce3::io::Raster
9 
10 #include "LabelMap.h" // LabelMap
11 
12 namespace isce3::unwrap::icu
13 {
14 
15 // 2-D index type
16 typedef std::array<size_t, 2> idx2_t;
17 
18 // 2-D offset type
19 typedef std::array<int, 2> offset2_t;
20 
21 class ICU
22 {
23 public:
25  ICU() = default;
26 
28  ~ICU() = default;
29 
31  size_t numBufLines() const;
33  void numBufLines(const size_t);
34 
36  size_t numOverlapLines() const;
38  void numOverlapLines(const size_t);
39 
41  bool usePhaseGradNeut() const;
43  void usePhaseGradNeut(const bool);
44 
46  bool useIntensityNeut() const;
48  void useIntensityNeut(const bool);
49 
51  int phaseGradWinSize() const;
53  void phaseGradWinSize(const int);
54 
56  float neutPhaseGradThr() const;
58  void neutPhaseGradThr(const float);
59 
61  float neutIntensityThr() const;
63  void neutIntensityThr(const float);
64 
66  float neutCorrThr() const;
68  void neutCorrThr(const float);
69 
71  int numTrees() const;
73  void numTrees(const int);
74 
76  int maxBranchLen() const;
78  void maxBranchLen(const int);
79 
81  float ratioDxDy() const;
83  void ratioDxDy(const float);
84 
86  float initCorrThr() const;
88  void initCorrThr(const float);
89 
91  float maxCorrThr() const;
93  void maxCorrThr(const float);
94 
96  float corrThrInc() const;
98  void corrThrInc(const float);
99 
101  float minCCAreaFrac() const;
103  void minCCAreaFrac(const float);
104 
106  size_t numBsLines() const;
108  void numBsLines(const size_t);
109 
111  size_t minBsPts() const;
113  void minBsPts(const size_t);
114 
116  float bsPhaseVarThr() const;
118  void bsPhaseVarThr(const float);
119 
129  void unwrap(
130  isce3::io::Raster & unw,
131  isce3::io::Raster & ccl,
132  isce3::io::Raster & intf,
133  isce3::io::Raster & corr,
134  unsigned int seed = 0);
135 
136  // Compute residue charges.
137  void getResidues(
138  signed char * charge,
139  const float * phase,
140  const size_t length,
141  const size_t width);
142 
143  // Generate neutrons to guide the tree growing process.
144  void genNeutrons(
145  bool * neut,
146  const std::complex<float> * intf,
147  const float * corr,
148  const size_t length,
149  const size_t width);
150 
151  // Grow trees (make branch cuts).
152  void growTrees(
153  bool * tree,
154  const signed char * charge,
155  const bool * neut,
156  const size_t length,
157  const size_t width,
158  const unsigned int seed = 0);
159 
160  // Grow grass (find connected components and unwrap phase).
161  template<bool DO_BOOTSTRAP>
162  void growGrass(
163  float * unw,
164  uint8_t * ccl,
165  bool * currcc,
166  float * bsunw,
167  uint8_t * bsccl,
168  LabelMap & labelmap,
169  const float * phase,
170  const bool * tree,
171  const float * corr,
172  float corrthr,
173  const size_t length,
174  const size_t width);
175 
176 private:
177  // Configuration params
178  size_t _NumBufLines = 3700;
179  size_t _NumOverlapLines = 200;
180  bool _UsePhaseGradNeut = false;
181  bool _UseIntensityNeut = false;
182  int _PhaseGradWinSize = 5;
183  float _NeutPhaseGradThr = 3.f;
184  float _NeutIntensityThr = 8.f;
185  float _NeutCorrThr = 0.8f;
186  int _NumTrees = 7;
187  int _MaxBranchLen = 64;
188  float _RatioDxDy = 1.f;
189  float _InitCorrThr = 0.1f;
190  float _MaxCorrThr = 0.9f;
191  float _CorrThrInc = 0.1f;
192  float _MinCCAreaFrac = 0.003125f;
193  size_t _NumBsLines = 16;
194  size_t _MinBsPts = 16;
195  float _BsPhaseVarThr = 8.f;
196 };
197 
198 }
199 
200 // Get inline implementations.
201 #define ISCE_UNWRAP_ICU_ICU_ICC
202 #include "ICU.icc"
203 #undef ISCE_UNWRAP_ICU_ICU_ICC
float neutCorrThr() const
Get correlation threshold for neutron generation.
Definition: ICU.icc:70
bool usePhaseGradNeut() const
Get phase gradient neutrons flag.
Definition: ICU.icc:30
float ratioDxDy() const
Get ratio of x:y pixel spacing (for measuring branch cut length).
Definition: ICU.icc:100
int numTrees() const
Get number of tree growing iterations.
Definition: ICU.icc:80
float minCCAreaFrac() const
Get min connected component size as fraction of tile area.
Definition: ICU.icc:140
void unwrap(isce3::io::Raster &unw, isce3::io::Raster &ccl, isce3::io::Raster &intf, isce3::io::Raster &corr, unsigned int seed=0)
Unwrap the target interferogram.
Definition: Unwrap.cpp:10
~ICU()=default
Destructor.
float bsPhaseVarThr() const
Get bootstrap phase variance threshold.
Definition: ICU.icc:170
size_t numBufLines() const
Get tile buffer length.
Definition: ICU.icc:10
float initCorrThr() const
Get initial correlation threshold.
Definition: ICU.icc:110
Definition: LabelMap.h:14
size_t minBsPts() const
Get bootstrapping min overlap area.
Definition: ICU.icc:160
ICU()=default
Constructor.
bool useIntensityNeut() const
Get intensity neutrons flag.
Definition: ICU.icc:33
int phaseGradWinSize() const
Get window size for phase gradient calculation.
Definition: ICU.icc:36
Definition: ICU.h:21
float neutIntensityThr() const
Get intensity variance threshold for neutron generation (stddevs from mean).
Definition: ICU.icc:60
float neutPhaseGradThr() const
Get range phase gradient threshold for neutron generation (rad/sample).
Definition: ICU.icc:50
float corrThrInc() const
Get correlation threshold increment.
Definition: ICU.icc:130
size_t numOverlapLines() const
Get lines of overlap between tiles.
Definition: ICU.icc:20
float maxCorrThr() const
Get max correlation threshold.
Definition: ICU.icc:120
int maxBranchLen() const
Get max branch cut length.
Definition: ICU.icc:90
size_t numBsLines() const
Get number of bootstrap lines.
Definition: ICU.icc:150
Data structure meant to handle Raster I/O operations.
Definition: Raster.h:34

Generated for ISCE3.0 by doxygen 1.8.5.