-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathLSDRasterMaker.hpp
More file actions
193 lines (160 loc) · 6.55 KB
/
Copy pathLSDRasterMaker.hpp
File metadata and controls
193 lines (160 loc) · 6.55 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
///=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
///
/// LSDRasterMaker.cpp
/// header for the RasterMaker object
/// The raster maker is a series of simple functions to make some rasters
/// with different properties.
/// The initial use is mainly to make rasters for use in the raster model
/// for uplift and K
///=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
///
/// This object is written by
/// @author Simon M. Mudd, University of Edinburgh
///
///=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
///
/// Version 0.0.1 01/09/2017
///=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
#include <iostream>
#include <fstream>
#include <iomanip>
#include <vector>
#include <string>
#include "TNT/tnt.h"
#include "LSDRaster.hpp"
using namespace std;
using namespace TNT;
#ifndef LSDRasterMaker_H
#define LSDRasterMaker_H
///@brief Create model objects to use LSDRaster methods on synthetic landscapes.
class LSDRasterMaker: public LSDRaster
{
public:
/// @brief Constructor. Create an LSDRasterMaker from an LSDRaster.
/// @return LSDRasterMaker
LSDRasterMaker()
{
create();
}
/// @brief Constructor. Create an LSDRasterMaker from an LSDRaster.
/// @return LSDRasterMaker
/// @param An_LSDRaster LSDRaster object.
LSDRasterMaker(LSDRaster& An_LSDRaster)
{
create(An_LSDRaster);
}
/// @brief Constructor. Create an LSDRasterMaker from a file.
/// Uses a filename and file extension
/// @return LSDRasterMaker
/// @param filename A String, the file to be loaded.
/// @param extension A String, the file extension to be loaded.
LSDRasterMaker(string filename, string extension)
{
create(filename, extension);
}
/// @brief Constructor. Create a blank raster nodel
/// @return LSDRasterModel
/// @param NCols Height of raster
/// @param NRows Width of raster
LSDRasterMaker(int NRows, int NCols)
{
create(NRows,NCols);
}
/// @brief This just returns the raster model object data as a raster
/// @return A raster with the data from the LSDRasterModel
/// @author SMM
/// @date 01/09/2017
LSDRaster return_as_raster();
/// @brief This resizes the LSDRasterModel, resetting some flags in the process,
/// as well as setting many of the Array2D data members to be empty arrays
/// The raster data in the end is a random surface (determined by the noise
/// data member)
/// This overloaded version also changes the data resolution
/// @param new_rows the new number of rows
/// @param new_cols the new number of columns
/// @param new_resolution the new data resolution
/// @param new_value the new value of the raster
/// @author SMM
/// @date 01/09/2017
void resize_and_reset( int new_rows, int new_cols, float new_resolution, float new_value );
/// @brief Gets the minimum and maximum values from a raster
/// @return vector with the first element is the minimum and second is the maximum
/// @author SMM
/// @date 03/09/2017
vector<float> minimum_and_maximum_value();
/// @brief This linearly scales the raster to new minimum and maximum values
/// @param new_minimum does what it says on the tin.
/// @param new_maxuimum does what it says on the tin
/// @author SMM
/// @date 03/09/2017
void scale_to_new_minimum_and_maximum_value(float new_minimum, float new_maximum);
/// @brief This smooths the raster. At some point in the future I'll
/// add more options but at the moment it just uses 4 neighbours and has
/// double weighting on the central pixel. It assumes periodic boundaries
/// on the E/W
/// @param boundary type: this just goes to a default at the moment.
/// @author SMM
/// @date 03/09/2017
void smooth(int boundary_type);
//void random_horizontal_strips(int minimum_strip_size, int maximum_strip_size, float minimum_value, float maximum_value);
/// @brief This makes square blobs randomly in the DEM
/// @param minimum_blob_size minimum blob size
/// @param maximum_blob_size maximum blob size
/// @param minimum_value minimum value on the raster
/// @param maximum_value maximum value on the raster
/// @parameter n_blobs the number of square blobs
/// @author SMM
/// @date 01/09/2017
void random_square_blobs(int minimum_blob_size, int maximum_blob_size, float minimum_value, float maximum_value, int n_blobs);
/// @brief This function adds some sine waves together to get patterns
/// @param x_coefficients Coefficients of the sin waves in the x direction.
/// @param y_coefficients Coefficients of the sin waves in the y direction.
/// @author SMM
/// @date 01/09/2017
void sine_waves(vector<float> x_coefficients, vector<float> y_coefficients);
/// @brief This returns a clipped raster that has the same dimensions as the
/// smaller raster
/// @param smaller_raster the raster to which the bigger raster should be
/// clipped
/// @author SMM
/// @date 20/03/2015
LSDRaster clip_to_smaller_raster(LSDRaster& smaller_raster);
/// @brief This returns a clipped raster that has the same dimensions as the
/// smaller raster
/// @param smaller_raster the raster to which the bigger raster should be
/// clipped
/// @author SMM
/// @date 20/03/2015
LSDRaster clip_to_smaller_raster(LSDIndexRaster& smaller_raster);
///@brief This function returns the raster data as text file
///@return text file with raster data
///@author FJC
///@date 30/09/16
void write_RasterData_to_text_file(string filename);
///@brief This function returns the raster data as a vector
///@return vector<float> with raster data
///@author FJC
///@date 06/11/15
vector<float> get_RasterData_vector();
/// @brief This function returns a vector with the X adn Y minimum and max
/// values
/// @return XYMinMax a vector with four elements
/// XYMinMax[0] = XMinimum
/// XYMinMax[1] = YMinimum
/// XYMinMax[2] = XMaximum
/// XYMinMax[3] = XMaximum
/// @author SMM
/// @date 3/7/2015
vector<float> get_XY_MinMax();
protected:
private:
/// @brief Make a 100x100 raster
void create();
/// @brief Load a raster
void create(string filename, string extension);
/// @brief Make a rastermaker from another raster
void create(LSDRaster& An_LSDRaster);
/// @brief create a raster from NRows and NCols information
void create(int NRows, int NCols);
};
#endif