13 #include <isce3/io/Raster.h>
19 TopoLayers() : _length(0.0), _width(0.0), _haveRasters(
false) {}
21 TopoLayers(
size_t length,
size_t width) : _length(length), _width(width),
23 _x.resize(length*width);
24 _y.resize(length*width);
25 _z.resize(length*width);
26 _inc.resize(length*width);
27 _hdg.resize(length*width);
28 _localInc.resize(length*width);
29 _localPsi.resize(length*width);
30 _sim.resize(length*width);
31 _mask.resize(length*width);
32 _crossTrack.resize(length*width);
42 delete _localIncRaster;
43 delete _localPsiRaster;
52 void setBlockSize(
size_t length,
size_t width) {
55 _x.resize(length*width);
56 _y.resize(length*width);
57 _z.resize(length*width);
58 _inc.resize(length*width);
59 _hdg.resize(length*width);
60 _localInc.resize(length*width);
61 _localPsi.resize(length*width);
62 _sim.resize(length*width);
63 _mask.resize(length*width);
64 _crossTrack.resize(length*width);
68 inline size_t length()
const {
return _length; }
69 inline size_t width()
const {
return _width; }
72 void initRasters(
const std::string & outdir,
size_t width,
size_t length,
73 bool computeMask =
false) {
86 _localIncRaster =
new isce3::io::Raster(outdir +
"/localInc.rdr", width, length, 1,
88 _localPsiRaster =
new isce3::io::Raster(outdir +
"/localPsi.rdr", width, length, 1,
98 _maskRaster =
nullptr;
117 _incRaster = &incRaster;
118 _hdgRaster = &hdgRaster;
119 _localIncRaster = &localIncRaster;
120 _localPsiRaster = &localPsiRaster;
121 _simRaster = &simRaster;
133 _incRaster = &incRaster;
134 _hdgRaster = &hdgRaster;
135 _localIncRaster = &localIncRaster;
136 _localPsiRaster = &localPsiRaster;
137 _simRaster = &simRaster;
138 _maskRaster = &maskRaster;
142 std::valarray<double> & x() {
return _x; }
143 std::valarray<double> & y() {
return _y; }
144 std::valarray<double> & z() {
return _z; }
145 std::valarray<float> & inc() {
return _inc; }
146 std::valarray<float> & hdg() {
return _hdg; }
147 std::valarray<float> & localInc() {
return _localInc; }
148 std::valarray<float> & localPsi() {
return _localPsi; }
149 std::valarray<float> & sim() {
return _sim; }
150 std::valarray<short> & mask() {
return _mask; }
151 std::valarray<double> & crossTrack() {
return _crossTrack; }
154 void x(
size_t row,
size_t col,
double value) {
155 _x[row*_width+col] = value;
158 void y(
size_t row,
size_t col,
double value) {
159 _y[row*_width + col] = value;
162 void z(
size_t row,
size_t col,
double value) {
163 _z[row*_width + col] = value;
166 void inc(
size_t row,
size_t col,
float value) {
167 _inc[row*_width + col] = value;
170 void hdg(
size_t row,
size_t col,
float value) {
171 _hdg[row*_width + col] = value;
174 void localInc(
size_t row,
size_t col,
float value) {
175 _localInc[row*_width + col] = value;
178 void localPsi(
size_t row,
size_t col,
float value) {
179 _localPsi[row*_width + col] = value;
182 void sim(
size_t row,
size_t col,
float value) {
183 _sim[row*_width + col] = value;
186 void mask(
size_t row,
size_t col,
short value) {
187 _mask[row*_width + col] = value;
190 void crossTrack(
size_t row,
size_t col,
double value) {
191 _crossTrack[row*_width + col] = value;
195 double x(
size_t row,
size_t col)
const {
196 return _x[row*_width+col];
199 double y(
size_t row,
size_t col)
const {
200 return _y[row*_width + col];
203 double z(
size_t row,
size_t col)
const {
204 return _z[row*_width + col];
207 float inc(
size_t row,
size_t col)
const {
208 return _inc[row*_width + col];
211 float hdg(
size_t row,
size_t col)
const {
212 return _hdg[row*_width + col];
215 float localInc(
size_t row,
size_t col)
const {
216 return _localInc[row*_width + col];
219 float localPsi(
size_t row,
size_t col)
const {
220 return _localPsi[row*_width + col];
223 float sim(
size_t row,
size_t col)
const {
224 return _sim[row*_width + col];
227 short mask(
size_t row,
size_t col)
const {
228 return _mask[row*_width + col];
231 double crossTrack(
size_t row,
size_t col)
const {
232 return _crossTrack[row*_width + col];
236 void writeData(
size_t xidx,
size_t yidx) {
237 _xRaster->
setBlock(_x, xidx, yidx, _width, _length);
238 _yRaster->
setBlock(_y, xidx, yidx, _width, _length);
239 _zRaster->
setBlock(_z, xidx, yidx, _width, _length);
240 _incRaster->
setBlock(_inc, xidx, yidx, _width, _length);
241 _hdgRaster->
setBlock(_hdg, xidx, yidx, _width, _length);
242 _localIncRaster->
setBlock(_localInc, xidx, yidx, _width, _length);
243 _localPsiRaster->
setBlock(_localPsi, xidx, yidx, _width, _length);
244 _simRaster->
setBlock(_sim, xidx, yidx, _width, _length);
246 _maskRaster->
setBlock(_mask, xidx, yidx, _width, _length);
252 std::valarray<double> _x;
253 std::valarray<double> _y;
254 std::valarray<double> _z;
255 std::valarray<float> _inc;
256 std::valarray<float> _hdg;
257 std::valarray<float> _localInc;
258 std::valarray<float> _localPsi;
259 std::valarray<float> _sim;
260 std::valarray<short> _mask;
261 std::valarray<double> _crossTrack;
275 size_t _length, _width;
278 std::string _topodir;
void setBlock(T *buffer, size_t xidx, size_t yidx, size_t iowidth, size_t iolength, size_t band=1)
Write block of data to given band from buffer, vector, or valarray.
Definition: Raster.icc:424
Definition: TopoLayers.h:15
Data structure meant to handle Raster I/O operations.
Definition: Raster.h:34