isce3 0.25.0
Loading...
Searching...
No Matches
ResampSlc.h
1#pragma once
2
3#include "forward.h"
4#include <isce3/io/forward.h>
5
6#include <complex>
7#include <cstdint>
8#include <cstdio>
9#include <valarray>
10
11#include <pyre/journal.h>
12
13#include <isce3/core/Interpolator.h>
14#include <isce3/core/Poly2d.h>
15#include <isce3/product/RadarGridProduct.h>
16#include <isce3/product/RadarGridParameters.h>
17
18namespace isce3 { namespace image {
19
20class ResampSlc {
21public:
22 typedef Tile<std::complex<float>> Tile_t;
23
25 ResampSlc(const isce3::product::RadarGridProduct& product, char frequency = 'A',
26 const std::complex<float> invalid_value = std::complex<float>(0.0));
27
33 const isce3::product::RadarGridProduct& refProduct, char frequency = 'A',
34 const std::complex<float> invalid_value = std::complex<float>(0.0));
35
38 const std::complex<float> invalid_value = std::complex<float>(0.0));
39
45 const isce3::product::Swath& refSwath,
46 const std::complex<float> invalid_value = std::complex<float>(0.0));
47
53 const std::complex<float> invalid_value = std::complex<float>(0.0));
54
60 const isce3::product::RadarGridParameters& ref_rdr_grid,
62 const std::complex<float> invalid_value = std::complex<float>(0.0));
63
65 ResampSlc(const isce3::core::LUT2d<double>& doppler, double startingRange,
66 double rangePixelSpacing, double sensingStart, double prf,
67 double wvl,
68 const std::complex<float> invalid_value = std::complex<float>(0.0));
69
71 ResampSlc(const isce3::core::LUT2d<double>& doppler, double startingRange,
72 double rangePixelSpacing, double sensingStart, double prf,
73 double wvl, double refStartingRange, double refRangePixelSpacing,
74 double refWvl,
75 const std::complex<float> invalid_value = std::complex<float>(0.0));
76
79
80 double startingRange() const { return _startingRange; }
81 double rangePixelSpacing() const { return _rangePixelSpacing; }
82 double sensingStart() const { return _sensingStart; }
83 double prf() const { return _prf; }
84 double wavelength() const { return _wavelength; }
85 double refStartingRange() const { return _refStartingRange; }
86 double refRangePixelSpacing() const { return _refRangePixelSpacing; }
87 double refWavelength() const { return _refWavelength; }
88
89 // Poly2d and LUT getters
90 isce3::core::Poly2d rgCarrier() const;
91 isce3::core::Poly2d azCarrier() const;
92
93 // Poly2d and LUT setters
94 void rgCarrier(const isce3::core::Poly2d&);
95 void azCarrier(const isce3::core::Poly2d&);
96
98 const isce3::core::LUT2d<double>& doppler() const;
99
101 isce3::core::LUT2d<double>& doppler();
102
104 void doppler(const isce3::core::LUT2d<double>&);
105
106 // Set reference product for flattening
107 void referenceProduct(const isce3::product::RadarGridProduct& product,
108 char frequency = 'A');
109
110 // Get/set number of lines per processing tile
111 size_t linesPerTile() const;
112 void linesPerTile(size_t);
113
115 bool haveRefData() const { return _haveRefData; }
116
117 // Convenience functions
118 void declare(size_t, size_t, size_t, size_t) const;
119
120 /* Generic resamp entry point from externally created rasters
121 *
122 * \param[in] inputSlc input raster of SLC to be resampled
123 * \param[in] outputSlc output raster of resampled SLC
124 * \param[in] rgOffsetRaster raster of range shift to be applied
125 * \param[in] azOffsetRaster raster of azimuth shift to be applied
126 * \param[in] inputBand band of input raster to resample
127 * \param[in] flatten flag to flatten resampled SLC
128 * \param[in] rowBuffer number of rows excluded from top/bottom of azimuth
129 * raster while searching for min/max indices of
130 * resampled SLC
131 * \param[in] chipSize size of chip used in sinc interpolation
132 */
133 void resamp(isce3::io::Raster& inputSlc,
134 isce3::io::Raster& outputSlc,
135 isce3::io::Raster& rgOffsetRaster,
136 isce3::io::Raster& azOffsetRaster,
137 int inputBand = 1,
138 bool flatten = false,
139 int rowBuffer = 40,
140 int chipSize = isce3::core::SINC_ONE);
141
142 /* Generic resamp entry point: use filenames to create rasters
143 * internally in function.
144 *
145 * \param[in] inputFilename path of file containing SLC to be resampled
146 * \param[in] outputFilename path of file containing resampled SLC
147 * \param[in] rgOffsetFilename path of file containing range shift to be applied
148 * \param[in] azOffsetFilename path of file containing azimuth shift to be applied
149 * \param[in] inputBand band of input raster to resample
150 * \param[in] flatten flag to flatten resampled SLC
151 * \param[in] rowBuffer number of rows excluded from top/bottom of azimuth
152 * raster while searching for min/max indices of
153 * resampled SLC
154 * \param[in] chipSize size of chip used in sinc interpolation
155 */
156 void resamp(const std::string& inputFilename,
157 const std::string& outputFilename,
158 const std::string& rgOffsetFilename,
159 const std::string& azOffsetFilename,
160 int inputBand = 1,
161 bool flatten = false,
162 int rowBuffer = 40,
163 int chipSize = isce3::core::SINC_ONE);
164
165protected:
166 // Number of lines per tile
167 size_t _linesPerTile = 1000;
168 // Band number
169 int _inputBand;
170 // Filename of the input product
171 std::string _filename;
172 // Flag indicating if we have a reference data (for flattening)
173 bool _haveRefData;
174 // Interpolator pointer
176
177 // Polynomials and LUTs
178 isce3::core::Poly2d _rgCarrier; // range carrier polynomial
179 isce3::core::Poly2d _azCarrier; // azimuth carrier polynomial
180 isce3::core::LUT2d<double> _dopplerLUT;
181
182 // Variables ingested from a Swath
183 double _startingRange;
184 double _rangePixelSpacing;
185 double _sensingStart;
186 double _prf;
187 double _wavelength;
188 double _refStartingRange;
189 double _refRangePixelSpacing;
190 double _refWavelength;
191
192 /*
193 * Initialize az/range offset tiles and load from az/range offset rasters
194 * for current block
195 *
196 * \param[in] tile tile object containing input block
197 * start/stop indices and dimensions
198 * \param[in] azOffsetRaster raster containing azimuth offsets (from
199 * geo2rdr)
200 * \param[in] rgOffsetRaster raster containing range offsets (from
201 * geo2rdr)
202 * \param[out] azOffTile tile object containing azimuth offsets for
203 * current block
204 * \param[out] rgOffTile tile object containing range offsets for
205 * current block
206 * \param[in] outWidth width of az/range offset tiles
207 */
208 void _initializeOffsetTiles(Tile_t& tile,
209 isce3::io::Raster& azOffsetRaster,
210 isce3::io::Raster& rgOffsetRaster,
211 Tile<double>& azOffTile,
212 Tile<double>& rgOffTile,
213 size_t outWidth);
214
215 /*
216 * Initialize input SLC tile
217 *
218 * \param[out] til e tile object containing input block
219 * start/stop indices and dimensions
220 * \param[out] inputSlc raster containing input SLC used to
221 * populate tile object
222 * \param[in] azOffTile tile object containing azimuth offsets for
223 * current block used to determine tile
224 * start/stop indices and dimensions
225 * \param[in] outLength length output for current block
226 * \param[in] rowBuffer
227 * \param[in] chipHalf half of the size of the chip used by the
228 * sinc interpolator
229 */
230 void _initializeTile(Tile_t& tile, isce3::io::Raster& inputSlc,
231 const Tile<double>& azOffTile, size_t outLength,
232 int rowBuffer, int chipHalf);
233
234
235 /*
236 * Transfrom input SLC tile/block by sinc interpolating
237 *
238 * \param[in] tile tile object containing input block
239 * start/stop indices and dimensions
240 * \param[in] outputSlc raster containing transformed/output SLC
241 * \param[out] rgOffTile tile object containing range offsets for
242 * current block
243 * \param[in] azOffTile tile object containing azimuth offsets for
244 * current block
245 * \param[in] inLength input length for current block
246 * \param[in] flatten whether or not to flatten transformed SLC
247 * block
248 * \param[in] chipSize size of the chip used by the sinc
249 * interpolator
250 */
251 void _transformTile(Tile_t& tile, isce3::io::Raster& outputSlc,
252 const Tile<double>& rgOffTile,
253 const Tile<double>& azOffTile, size_t inLength,
254 bool flatten, int chipSize);
255
256 // Convenience functions
257 size_t _computeNumberOfTiles(size_t, size_t);
258
259 // Initialize interpolator pointer
260 void _prepareInterpMethods(isce3::core::dataInterpMethod, int);
261
262 // Set radar parameters from an isce3::product::Swath
263 void _setDataFromSwath(const isce3::product::Swath& swath);
264
265 // Set reference radar parameters from an isce3::product::Swath (for
266 // flattening)
267 void _setRefDataFromSwath(const isce3::product::Swath& swath);
268
269 // Value assigned to invalid pixels
270 // Default 0 + 0j to facilitate downstream crossmul processing
271 std::complex<float> _invalid_value = std::complex<float>(0.0, 0.0);
272};
273
274}} // namespace isce3::image
275
276// Get inline implementations for ResampSlc
277#include "ResampSlc.icc"
Definition of parent Interpolator.
Definition Interpolator.h:18
Data structure to store 2D Lookup table.
Definition LUT2d.h:20
Data structure for representing 2D polynomials.
Definition Poly2d.h:20
ResampSlc(const isce3::product::RadarGridProduct &product, char frequency='A', const std::complex< float > invalid_value=std::complex< float >(0.0))
Constructor from an isce3::product::RadarGridProduct (no flattening)
Definition ResampSlc.icc:8
const isce3::core::LUT2d< double > & doppler() const
Get read-only reference to Doppler LUT2d.
Definition ResampSlc.icc:142
~ResampSlc()
Destructor.
Definition ResampSlc.h:78
bool haveRefData() const
Get flag for reference data.
Definition ResampSlc.h:115
Definition Tile.h:15
Data structure meant to handle Raster I/O operations.
Definition Raster.h:32
Definition RadarGridParameters.h:16
RadarGridProduct class declaration.
Definition RadarGridProduct.h:71
Definition Swath.h:23
The isce3::product namespace.
Definition forward.h:3
base interpolator is an abstract base class
Definition BinarySearchFunc.cpp:5

Generated for ISCE3.0 by doxygen 1.13.2.