isce3 0.25.0
Loading...
Searching...
No Matches
Sequential.h
1// -*- C++ -*-
2// -*- coding: utf-8 -*-
3//
4// michael a.g. aïvázis <michael.aivazis@para-sim.com>
5// parasim
6// (c) 1998-2019 all rights reserved
7//
8
9// code guard
10#if !defined(ampcor_libampcor_correlators_Sequential_h)
11#define ampcor_libampcor_correlators_Sequential_h
12
13#include <isce3/signal/Signal.h>
14
15
16// resource management and orchestration of the execution of the correlation plan
17template <typename raster_t>
19 // types
20public:
21 // my client raster type
22 using raster_type = raster_t;
23 // views over it
24 using view_type = typename raster_type::view_type;
25 using constview_type = typename raster_type::constview_type;
26 // the underlying pixel complex type
27 using cell_type = typename raster_type::cell_type;
28 // the support of the pixel complex type
29 using value_type = typename cell_type::value_type;
30 // for describing slices of rasters
31 using slice_type = typename raster_type::slice_type;
32 // for describing the shapes of tiles
33 using shape_type = typename raster_type::shape_type;
34 // for describing the layouts of tiles
35 using layout_type = typename raster_type::layout_type;
36 // for index arithmetic
37 using index_type = typename raster_type::index_type;
38 // for sizing things
39 using size_type = typename raster_type::size_type;
40
41 // adapter for tiles within my arena
42 using tile_type = pyre::grid::grid_t<cell_type,
43 layout_type,
44 pyre::memory::view_t<cell_type>>;
45
46 // interface
47public:
48 // add a reference tile to the pile
49 inline void addReferenceTile(size_type pid, const constview_type & ref);
50 // add a target search window to the pile
51 inline void addTargetTile(size_type pid, const constview_type & tgt);
52
53 // compute adjustments to the offset map
54 inline auto adjust() -> const value_type *;
55
56 // accessors
57 inline auto pairs() const -> size_type;
58 //inline auto arena() const -> const cell_type *;
59 inline auto arena() const -> cell_type *;
60
61 // debugging support
62 inline void dump() const;
63
64 // meta-methods
65public:
66 inline ~Sequential();
67 inline Sequential(size_type pairs,
68 const layout_type & refLayout, const layout_type & tgtLayout,
69 size_type refineFactor=2, size_type refineMargin=8,
70 size_type zoomFactor=4);
71
72 // implementation details: methods
73public:
74
75 // compute the magnitude of the complex signal pixel-by-pixel
76 inline auto _detect(const cell_type * cArena,
77 size_type refDim, size_type tgtDim) const -> value_type *;
78 // subtract the mean from reference tiles and compute the square root of their variance
79 inline auto _refStats(value_type * rArena,
80 size_type refDim, size_type tgtDim) const -> value_type *;
81 // compute the sum area tables for the target tiles
82 inline auto _sat(const value_type * rArena,
83 size_type refDim, size_type tgtDim) const -> value_type *;
84 // compute the mean of all possible placements of a tile the same size as the reference
85 // tile within the target
86 inline auto _tgtStats(const value_type * sat,
87 size_type refDim, size_type tgtDim, size_type corDim
88 ) const -> value_type *;
89 // correlate
90 inline auto _correlate(const value_type * rArena,
91 const value_type * refStats, const value_type * tgtStats,
92 size_type refDim, size_type tgtDim, size_type corDim
93 ) const -> value_type *;
94 // find the locations of the maxima of the correlation matrix
95 inline auto _maxcor(const value_type * gamma, size_type corDim) const -> int *;
96 // adjust the locations of the maxima so that the refined tile sources fit with the target
97 inline void _nudge(int * locations, size_type refDim, size_type tgtDim) const;
98 // allocate memory for a new arena big enough to hold the refined tiles
99 inline auto _refinedArena() const -> cell_type *;
100 // refine the reference tiles
101 inline void _refRefine(cell_type * coarseArena, cell_type * refinedArena) const;
102 // migrate the expanded unrefined target tiles into the {refinedArena}
103 inline void _tgtMigrate(cell_type * coarseArena, int * locations,
104 cell_type * refinedArena) const;
105 // refine the target tiles
106 inline void _tgtRefine(cell_type * refinedArena) const;
107 // deramp
108 inline void _deramp(cell_type * arena) const;
109 // zoom the correlation matrix
110 inline auto _zoomcor(value_type * gamma) const -> value_type *;
111 // assemble the offsets
112 inline auto _offsetField(const int * zoomed) -> const value_type *;
113
114 // unfinished correlation matrix zoom that uses R2C and C2R
115 inline auto _zoomcor_r2r(value_type * gamma) const -> value_type *;
116
117
118 // implementation details: data
119private:
120 // my capacity, in {ref/tgt} pairs
121 const size_type _pairs;
122 const size_type _refineFactor;
123 const size_type _refineMargin;
124 const size_type _zoomFactor;
125
126 // the shape of the reference tiles
127 const layout_type _refLayout;
128 // the shape of the search windows in the target image
129 const layout_type _tgtLayout;
130 // the shape of the correlation matrix
131 const layout_type _corLayout;
132 // the shape of the reference tiles after refinement
133 const layout_type _refRefinedLayout;
134 // the shape of the target tiles after refinement
135 const layout_type _tgtRefinedLayout;
136 // the shape of the correlation matrix after refinement
137 const layout_type _corRefinedLayout;
138 // the shape of the correlation matrix after zooming
139 const layout_type _corZoomedLayout;
140
141 // the number of cells in a reference tile
142 const size_type _refCells;
143 // the number of cells in a target search window
144 const size_type _tgtCells;
145 // the number of cell in a correlation matrix
146 const size_type _corCells;
147 // the number of cells in a refined reference tile
148 const size_type _refRefinedCells;
149 // the number of cells in a refined target tile
150 const size_type _tgtRefinedCells;
151
152 // the number of bytes in a reference tile
153 const size_type _refFootprint;
154 // the number of bytes in a target search window
155 const size_type _tgtFootprint;
156 // the number of bytes in a correlation matrix
157 const size_type _corFootprint;
158 // the number of bytes in a refined reference tile
159 const size_type _refRefinedFootprint;
160 // the number of bytes in a refined target tile
161 const size_type _tgtRefinedFootprint;
162
163 // host storage for the tile pairs
164 //cell_type * const _arena;
165 cell_type * _arena;
166 // host storage for the offset field
167 value_type * const _offsets;
168};
169
170
171// code guard
172#endif
173
174// end of file
Definition Sequential.h:18

Generated for ISCE3.0 by doxygen 1.13.2.