Sensor

  1# coding: utf-8
  2from Element import Element
  3from LiDAR import ALSLiDAR, create_lidar_from_file
  4import os
  5import sys
  6import json
  7
  8
  9class SensorType:
 10    PERSPECTIVE = "perspective"
 11    ORTHOGRAPHIC = "orthographic"
 12    CIRCULARFISHEYE = "CircularFisheye"
 13    PHOTONTRACING = "PhotonTracing"
 14    LIDAR = "LiDAR"
 15
 16
 17class SensorBasic(Element):
 18    def __init__(self):
 19        super().__init__()
 20        self.sensor_type = "Base Sensor"
 21        self.thermal_radiation = False
 22        self.record_only_direct = 200
 23        self.image_height = 100
 24        self.image_width = 100
 25        self.repetitive_scene = 100
 26        self._film_type = "spectrum"
 27        self._bands = "600:2,900:2"
 28        self.no_data_value = -1
 29
 30        # virtual plane
 31        self._virtualPlane = None
 32
 33    def get_number_of_bands(self):
 34        return len(self._bands.split(","))
 35
 36    def set_film_type(self, film_type):
 37        self._film_type = film_type
 38
 39    def get_film_type(self):
 40        return self._film_type
 41
 42    def set_image_width(self, image_width):
 43        self.image_width = image_width
 44
 45    def get_image_width(self):
 46        return self.image_width
 47
 48    def set_image_height(self, image_height):
 49        self.image_height = image_height
 50
 51    def get_image_height(self):
 52        return self.image_height
 53
 54    def set_repetitive_scene(self, num):
 55        self.repetitive_scene = num
 56
 57    def get_repetitive_scene(self):
 58        return self.repetitive_scene
 59
 60    def set_spectral_bands(self, spectral_bands):
 61        self._bands = spectral_bands
 62        if self.get_sim() is not None:
 63            # correct atmosphere skl according to number of bands
 64            new_len = len(self.get_spectral_bands().split(","))
 65            ill = self.get_sim().get_scene().get_illumination()
 66            ats_skl = ill.get_ats_percentage()
 67            arr = ats_skl.split(",")
 68            old_len = len(arr)
 69            if new_len >= old_len:
 70                for i in range(0, new_len - old_len):
 71                    arr.append("0.0")
 72            else:
 73                arr = arr[0:new_len]
 74            ill.set_ats_percentage(','.join(arr))
 75
 76    def get_spectral_bands(self):
 77        return self._bands
 78
 79    def get_virtualPlane(self):
 80        return self._virtualPlane
 81
 82    def enable_virtual_plane(self, enabled, center=(50, 50), size=(100, 100)):
 83        if enabled:
 84            self._virtualPlane = {"vx": str(center[0]), "vy": str(center[1]), "vz": "MAX",
 85                                  "sizex": str(size[0]), "sizey": str(size[1])}
 86        else:
 87            self._virtualPlane = None
 88
 89    def init_sensor_from_json(self, json_object):
 90        if "virtualPlane" in json_object["sensor"]:
 91            self._virtualPlane = json_object["sensor"]["virtualPlane"]
 92
 93
 94class SensorOrthographic(SensorBasic):
 95    def __init__(self):
 96        super().__init__()
 97        self.sensor_type = SensorType.ORTHOGRAPHIC
 98        self.has_four_components_product = False
 99        self.has_Fluor_Product = 0
100        self.cover_whole_scene = False
101        self.sample_per_pixel = 128
102        self.sub_region_width = 100
103        self.sub_region_height = 100
104
105    def set_sample_per_pixel(self, num):
106        self.sample_per_pixel = num
107
108    def get_sample_per_pixel(self):
109        return self.sample_per_pixel
110
111    def set_sub_region_width(self, width):
112        self.sub_region_width = width
113
114    def set_sub_region_height(self, height):
115        self.sub_region_height = height
116
117    def init_sensor_from_json(self, json_object):
118        super().init_sensor_from_json(json_object)
119        self.sensor_type = json_object["sensor"]["sensor_type"]
120        self.thermal_radiation = json_object["sensor"]["thermal_radiation"]
121        self.record_only_direct = json_object["sensor"]["record_only_direct"]
122        self.image_height = json_object["sensor"]["image_height"]
123        self.image_width = json_object["sensor"]["image_width"]
124        self.repetitive_scene = json_object["sensor"]["RepetitiveScene"]
125        self.has_four_components_product = json_object["sensor"]["hasFourComponentProduct"]
126        self.has_Fluor_Product = json_object["sensor"]["hasFluorProduct"]
127        self._film_type = json_object["sensor"]["film_type"]
128        self._bands = json_object["sensor"]["bands"]
129        self.no_data_value = json_object["sensor"]["NoDataValue"]
130
131        self.cover_whole_scene = json_object["sensor"]["orthographic"]["cover_whole_scene"]
132        self.sample_per_pixel = json_object["sensor"]["orthographic"]["sample_per_square_meter"]
133        self.sub_region_width = json_object["sensor"]["orthographic"]["sub_region_width"]
134        self.sub_region_height = json_object["sensor"]["orthographic"]["sub_region_height"]
135
136        return self
137
138    def to_json_object(self):
139        json_object = {"thermal_radiation": self.thermal_radiation,
140                       "record_only_direct": self.record_only_direct,
141                       "image_height": self.image_height,
142                       "RepetitiveScene": self.repetitive_scene,
143                       "hasFourComponentProduct": self.has_four_components_product,
144                       "hasFluorProduct": self.has_Fluor_Product,
145                       "film_type": self._film_type,
146                       "orthographic": {
147                          "cover_whole_scene": self.cover_whole_scene,
148                          "sample_per_square_meter": self.sample_per_pixel,
149                          "sub_region_width": self.sub_region_width,
150                          "sub_region_height": self.sub_region_height
151                        },
152                       "image_width": self.image_width,
153                       "bands": self._bands,
154                       "sensor_type": self.sensor_type,
155                       "NoDataValue": self.no_data_value}
156        if self._virtualPlane is not None:
157            json_object["virtualPlane"] = self._virtualPlane
158        return json_object
159
160
161class SensorPhotonTracing(SensorBasic):
162    def __init__(self):
163        super().__init__()
164        self.sensor_type = SensorType.PHOTONTRACING
165        self.cover_whole_scene = False
166        self.sample_per_pixel = 128
167        self.sub_region_width = 100
168        self.sub_region_height = 100
169
170        self.sun_ray_resolution = 0.02
171        self.BRF_product = True
172        self.Fluor_product = 0
173        self.number_of_directions = 150
174        self.virtual_detector_directions = ""
175        self.virtual_directions = ""
176        self.up_down_product = False
177        self.fPAR_product = False
178        self.fpar_layers = "0:2:20"
179
180    def set_virtual_director_directions(self, virtual_detector):
181        self.virtual_detector_directions = virtual_detector
182
183    def get_virtual_director_directions(self):
184        return self.virtual_detector_directions
185
186    def set_virtual_directions(self, virtual_directions):
187        self.virtual_directions = virtual_directions
188
189    def get_virtual_directions(self):
190        return self.virtual_directions
191
192    def set_sun_ray_resolution(self, sun_ray_resolution):
193        self.sun_ray_resolution = sun_ray_resolution
194
195    def get_run_ray_resolution(self):
196        return self.sun_ray_resolution
197
198    def set_number_of_directions(self, num):
199        self.number_of_directions = num
200
201    def get_number_of_directions(self):
202        return self.number_of_directions
203
204    def enable_brf_product(self, enabled):
205        self.BRF_product = enabled
206    def enable_Fluor_product(self, enabled):
207        self.Fluor_product = enabled
208
209    def enable_fpar_product(self, enabled):
210        self.fPAR_product = enabled
211
212    def set_fpar_layer(self, fpar_layer):
213        self.fpar_layers = fpar_layer
214
215    def get_fpar_layer(self):
216        return self.fpar_layers
217
218    def enable_updown_radiation_product(self,enabled):
219        self.up_down_product = enabled
220
221    def init_sensor_from_json(self, json_object):
222        super().init_sensor_from_json(json_object)
223        self.sensor_type = json_object["sensor"]["sensor_type"]
224        self.thermal_radiation = json_object["sensor"]["thermal_radiation"]
225        self.record_only_direct = json_object["sensor"]["record_only_direct"]
226        self.image_height = json_object["sensor"]["image_height"]
227        self.image_width = json_object["sensor"]["image_width"]
228        self.repetitive_scene = json_object["sensor"]["RepetitiveScene"]
229        self._film_type = json_object["sensor"]["film_type"]
230        self._bands = json_object["sensor"]["bands"]
231        self.no_data_value = json_object["sensor"]["NoDataValue"]
232
233        self.cover_whole_scene = json_object["sensor"]["orthographic"]["cover_whole_scene"]
234        self.sample_per_pixel = json_object["sensor"]["orthographic"]["sample_per_square_meter"]
235        self.sub_region_width = json_object["sensor"]["orthographic"]["sub_region_width"]
236        self.sub_region_height = json_object["sensor"]["orthographic"]["sub_region_height"]
237
238        self.sun_ray_resolution = json_object["sensor"]["PhotonTracing"]["sunRayResolution"]
239        self.BRF_product = json_object["sensor"]["PhotonTracing"]["BRFProduct"]
240        self.Fluor_product = json_object["sensor"]["PhotonTracing"]["FluorProduct"]
241        if self.BRF_product or self.Fluor_product != 0:
242            self.virtual_detector_directions = json_object["sensor"]["PhotonTracing"]["virtualDetectorDirections"]
243            self.virtual_directions = json_object["sensor"]["PhotonTracing"]["virtualDirections"]
244            self.number_of_directions = json_object["sensor"]["PhotonTracing"]["NumberOfDirections"]
245        self.up_down_product = json_object["sensor"]["PhotonTracing"]["UpDownProduct"]
246        self.fPAR_product = json_object["sensor"]["PhotonTracing"]["fPARProduct"]
247        self.fpar_layers = json_object["sensor"]["PhotonTracing"]["LayerDefinition"] if "LayerDefinition" in json_object["sensor"]["PhotonTracing"] else "0:2:20"
248        return self
249
250    def to_json_object(self):
251        json_object = {"thermal_radiation": self.thermal_radiation,
252                       "record_only_direct": self.record_only_direct,
253                       "image_height": self.image_height,
254                       "RepetitiveScene": self.repetitive_scene,
255                       "film_type": self._film_type,
256                       "PhotonTracing": {
257                           "virtualDetectorDirections": self.virtual_detector_directions,
258                           "sunRayResolution": self.sun_ray_resolution,
259                           "NumberOfDirections": self.number_of_directions,
260                           "BRFProduct": self.BRF_product,
261                           "FluorProduct": self.Fluor_product,
262                           "UpDownProduct": self.up_down_product,
263                           "virtualDirections": self.virtual_directions,
264                           "fPARProduct": self.fPAR_product,
265                           "LayerDefinition": self.fpar_layers
266                       },
267                       "orthographic": {
268                          "cover_whole_scene": self.cover_whole_scene,
269                          "sample_per_square_meter": self.sample_per_pixel,
270                          "sub_region_width": self.sub_region_width,
271                          "sub_region_height": self.sub_region_height
272                        },
273                       "image_width": self.image_width,
274                       "bands": self._bands,
275                       "sensor_type": self.sensor_type,
276                       "NoDataValue": self.no_data_value}
277        if self._virtualPlane is not None:
278            json_object["virtualPlane"] = self._virtualPlane
279        return json_object
280
281
282class SensorPerspective(SensorBasic):
283    def __init__(self):
284        super().__init__()
285        self.sensor_type = SensorType.PERSPECTIVE
286        self.has_four_components_product = False
287        self.sample_per_pixel = 128
288        self.fov_x = 40
289        self.fov_y = 30
290        self.fov_axis = "diagonal"
291        self.has_Fluor_Product = 0
292
293    def set_fov_x(self, fov_x):
294        self.fov_x = fov_x
295
296    def get_fov_x(self):
297        return self.fov_x
298
299    def set_fov_y(self, fov_y):
300        self.fov_y = fov_y
301
302    def get_fov_y(self):
303        return self.fov_y
304
305    def set_sample_per_pixel(self, num):
306        self.sample_per_pixel = num
307
308    def get_sample_per_pixel(self):
309        return self.sample_per_pixel
310
311    def init_sensor_from_json(self, json_object):
312        super().init_sensor_from_json(json_object)
313        self.sensor_type = json_object["sensor"]["sensor_type"]
314        self.thermal_radiation = json_object["sensor"]["thermal_radiation"]
315        self.record_only_direct = json_object["sensor"]["record_only_direct"]
316        self.image_height = json_object["sensor"]["image_height"]
317        self.image_width = json_object["sensor"]["image_width"]
318        self.repetitive_scene = json_object["sensor"]["RepetitiveScene"]
319        self.has_four_components_product = json_object["sensor"]["hasFourComponentProduct"]
320        self.has_Fluor_Product = json_object["sensor"]["hasFluorProduct"]
321        self._film_type = json_object["sensor"]["film_type"]
322        self._bands = json_object["sensor"]["bands"]
323        self.no_data_value = json_object["sensor"]["NoDataValue"]
324
325        self.sample_per_pixel = json_object["sensor"]["perspective"]["sample_per_square_meter"]
326        self.fov_x = json_object["sensor"]["perspective"]["fovx"]
327        self.fov_y = json_object["sensor"]["perspective"]["fovy"]
328        self.fov_axis = json_object["sensor"]["perspective"]["fovAxis"]
329
330        return self
331
332    def to_json_object(self):
333        json_object = {"thermal_radiation": self.thermal_radiation,
334                       "record_only_direct": self.record_only_direct,
335                       "image_height": self.image_height,
336                       "RepetitiveScene": self.repetitive_scene,
337                       "hasFourComponentProduct": self.has_four_components_product,
338                       "hasFluorProduct": self.has_Fluor_Product,
339                       "film_type": self._film_type,
340                       "perspective": {
341                          "sample_per_square_meter": self.sample_per_pixel,
342                          "fovx": self.fov_x,
343                          "fovy": self.fov_y,
344                          "fovAxis": self.fov_axis
345                        },
346                       "image_width": self.image_width,
347                       "bands": self._bands,
348                       "sensor_type": self.sensor_type,
349                       "NoDataValue": self.no_data_value}
350        if self._virtualPlane is not None:
351            json_object["virtualPlane"] = self._virtualPlane
352        return json_object
353
354
355class SensorFisheye(SensorBasic):
356    def __init__(self):
357        super().__init__()
358        self.sensor_type = SensorType.CIRCULARFISHEYE
359        # self.sample_per_square_meter = 128
360        self.sample_per_pixel = 128
361        self.angular_fov = 165
362        self.projection_type = "equisolid"
363        self.has_Fluor_Product = 0
364
365    def set_sample_per_pixel(self, num):
366        self.sample_per_pixel = num
367
368    def get_sample_per_pixel(self):
369        return self.sample_per_pixel
370
371    def set_angular_fov(self, fov):
372        self.angular_fov = fov
373
374    def get_angular_fov(self):
375        return self.angular_fov
376
377    def set_projection_type(self, prj_type):
378        self.projection_type = prj_type
379
380    def get_projection_type(self):
381        return self.projection_type
382
383    def init_sensor_from_json(self, json_object):
384        self.sensor_type = json_object["sensor"]["sensor_type"]
385        self.thermal_radiation = json_object["sensor"]["thermal_radiation"]
386        self.record_only_direct = json_object["sensor"]["record_only_direct"]
387        self.image_height = json_object["sensor"]["image_height"]
388        self.image_width = json_object["sensor"]["image_width"]
389        self.repetitive_scene = json_object["sensor"]["RepetitiveScene"]
390        self.has_Fluor_Product = json_object["sensor"]["hasFluorProduct"]
391        self._film_type = json_object["sensor"]["film_type"]
392        self._bands = json_object["sensor"]["bands"]
393        self.no_data_value = json_object["sensor"]["NoDataValue"]
394
395        self.sample_per_pixel = json_object["sensor"]["CircularFisheye"]["sample_per_square_meter"]
396        self.angular_fov = json_object["sensor"]["CircularFisheye"]["angular_fov"]
397        self.projection_type = json_object["sensor"]["CircularFisheye"]["projection_type"]
398
399        return self
400
401    def to_json_object(self):
402        json_object = {"thermal_radiation": self.thermal_radiation,
403                       "record_only_direct": self.record_only_direct,
404                       "image_height": self.image_height,
405                       "RepetitiveScene": self.repetitive_scene,
406                       "hasFluorProduct": self.has_Fluor_Product,
407                       "film_type": self._film_type,
408                       "CircularFisheye": {
409                          "angular_fov": self.angular_fov,
410                          "projection_type": self.projection_type,
411                          "sample_per_square_meter": self.sample_per_pixel
412                        },
413                       "image_width": self.image_width,
414                       "bands": self._bands,
415                       "sensor_type": self.sensor_type,
416                       "NoDataValue": self.no_data_value}
417        return json_object
418
419
420class SensorLiDAR(SensorBasic):
421    def __init__(self):
422        super().__init__()
423        self.sensor_type = SensorType.LIDAR
424        self.scanning_device = ALSLiDAR()
425
426    def get_scanning_device(self):
427        return self.scanning_device
428
429    def set_scanning_device(self, scanning_device):
430        self.scanning_device = scanning_device
431
432    def init_sensor_from_json(self, json_object):
433        # lidar
434        lidar_conf_path = os.path.join(self.get_sim().get_sim_dir(), "Parameters", "lidar.conf")
435        if os.path.exists(lidar_conf_path):
436            self.scanning_device = create_lidar_from_file(lidar_conf_path)
437        else:
438            print("Error: LiDAR device parameters is not set.")
439            sys.exit(0)
440        self.sensor_type = json_object["sensor"]["sensor_type"]
441        self.thermal_radiation = json_object["sensor"]["thermal_radiation"]
442        self.record_only_direct = json_object["sensor"]["record_only_direct"]
443        self.image_height = json_object["sensor"]["image_height"]
444        self.image_width = json_object["sensor"]["image_width"]
445        self.repetitive_scene = json_object["sensor"]["RepetitiveScene"]
446        self._film_type = json_object["sensor"]["film_type"]
447        self._bands = json_object["sensor"]["bands"]
448        self.no_data_value = json_object["sensor"]["NoDataValue"]
449        return self
450
451    def to_json_object(self):
452        lidar_conf_path = os.path.join(self.get_sim().get_sim_dir(), "Parameters", "lidar.conf")
453        f_out = open(lidar_conf_path, "w")
454        json.dump(self.scanning_device.to_json_object(), f_out, indent=2)
455        f_out.close()
456        json_object = {"thermal_radiation": self.thermal_radiation,
457                       "record_only_direct": self.record_only_direct,
458                       "image_height": self.image_height,
459                       "RepetitiveScene": self.repetitive_scene,
460                       "film_type": self._film_type,
461                       "image_width": self.image_width,
462                       "bands": self._bands,
463                       "sensor_type": self.sensor_type,
464                       "NoDataValue": self.no_data_value}
465        return json_object
class SensorType:
10class SensorType:
11    PERSPECTIVE = "perspective"
12    ORTHOGRAPHIC = "orthographic"
13    CIRCULARFISHEYE = "CircularFisheye"
14    PHOTONTRACING = "PhotonTracing"
15    LIDAR = "LiDAR"
PERSPECTIVE = 'perspective'
ORTHOGRAPHIC = 'orthographic'
CIRCULARFISHEYE = 'CircularFisheye'
PHOTONTRACING = 'PhotonTracing'
LIDAR = 'LiDAR'
class SensorBasic(Element.Element):
18class SensorBasic(Element):
19    def __init__(self):
20        super().__init__()
21        self.sensor_type = "Base Sensor"
22        self.thermal_radiation = False
23        self.record_only_direct = 200
24        self.image_height = 100
25        self.image_width = 100
26        self.repetitive_scene = 100
27        self._film_type = "spectrum"
28        self._bands = "600:2,900:2"
29        self.no_data_value = -1
30
31        # virtual plane
32        self._virtualPlane = None
33
34    def get_number_of_bands(self):
35        return len(self._bands.split(","))
36
37    def set_film_type(self, film_type):
38        self._film_type = film_type
39
40    def get_film_type(self):
41        return self._film_type
42
43    def set_image_width(self, image_width):
44        self.image_width = image_width
45
46    def get_image_width(self):
47        return self.image_width
48
49    def set_image_height(self, image_height):
50        self.image_height = image_height
51
52    def get_image_height(self):
53        return self.image_height
54
55    def set_repetitive_scene(self, num):
56        self.repetitive_scene = num
57
58    def get_repetitive_scene(self):
59        return self.repetitive_scene
60
61    def set_spectral_bands(self, spectral_bands):
62        self._bands = spectral_bands
63        if self.get_sim() is not None:
64            # correct atmosphere skl according to number of bands
65            new_len = len(self.get_spectral_bands().split(","))
66            ill = self.get_sim().get_scene().get_illumination()
67            ats_skl = ill.get_ats_percentage()
68            arr = ats_skl.split(",")
69            old_len = len(arr)
70            if new_len >= old_len:
71                for i in range(0, new_len - old_len):
72                    arr.append("0.0")
73            else:
74                arr = arr[0:new_len]
75            ill.set_ats_percentage(','.join(arr))
76
77    def get_spectral_bands(self):
78        return self._bands
79
80    def get_virtualPlane(self):
81        return self._virtualPlane
82
83    def enable_virtual_plane(self, enabled, center=(50, 50), size=(100, 100)):
84        if enabled:
85            self._virtualPlane = {"vx": str(center[0]), "vy": str(center[1]), "vz": "MAX",
86                                  "sizex": str(size[0]), "sizey": str(size[1])}
87        else:
88            self._virtualPlane = None
89
90    def init_sensor_from_json(self, json_object):
91        if "virtualPlane" in json_object["sensor"]:
92            self._virtualPlane = json_object["sensor"]["virtualPlane"]
sensor_type
thermal_radiation
record_only_direct
image_height
image_width
repetitive_scene
no_data_value
def get_number_of_bands(self):
34    def get_number_of_bands(self):
35        return len(self._bands.split(","))
def set_film_type(self, film_type):
37    def set_film_type(self, film_type):
38        self._film_type = film_type
def get_film_type(self):
40    def get_film_type(self):
41        return self._film_type
def set_image_width(self, image_width):
43    def set_image_width(self, image_width):
44        self.image_width = image_width
def get_image_width(self):
46    def get_image_width(self):
47        return self.image_width
def set_image_height(self, image_height):
49    def set_image_height(self, image_height):
50        self.image_height = image_height
def get_image_height(self):
52    def get_image_height(self):
53        return self.image_height
def set_repetitive_scene(self, num):
55    def set_repetitive_scene(self, num):
56        self.repetitive_scene = num
def get_repetitive_scene(self):
58    def get_repetitive_scene(self):
59        return self.repetitive_scene
def set_spectral_bands(self, spectral_bands):
61    def set_spectral_bands(self, spectral_bands):
62        self._bands = spectral_bands
63        if self.get_sim() is not None:
64            # correct atmosphere skl according to number of bands
65            new_len = len(self.get_spectral_bands().split(","))
66            ill = self.get_sim().get_scene().get_illumination()
67            ats_skl = ill.get_ats_percentage()
68            arr = ats_skl.split(",")
69            old_len = len(arr)
70            if new_len >= old_len:
71                for i in range(0, new_len - old_len):
72                    arr.append("0.0")
73            else:
74                arr = arr[0:new_len]
75            ill.set_ats_percentage(','.join(arr))
def get_spectral_bands(self):
77    def get_spectral_bands(self):
78        return self._bands
def get_virtualPlane(self):
80    def get_virtualPlane(self):
81        return self._virtualPlane
def enable_virtual_plane(self, enabled, center=(50, 50), size=(100, 100)):
83    def enable_virtual_plane(self, enabled, center=(50, 50), size=(100, 100)):
84        if enabled:
85            self._virtualPlane = {"vx": str(center[0]), "vy": str(center[1]), "vz": "MAX",
86                                  "sizex": str(size[0]), "sizey": str(size[1])}
87        else:
88            self._virtualPlane = None
def init_sensor_from_json(self, json_object):
90    def init_sensor_from_json(self, json_object):
91        if "virtualPlane" in json_object["sensor"]:
92            self._virtualPlane = json_object["sensor"]["virtualPlane"]
Inherited Members
Element.Element
set_sim
get_sim
class SensorOrthographic(SensorBasic):
 95class SensorOrthographic(SensorBasic):
 96    def __init__(self):
 97        super().__init__()
 98        self.sensor_type = SensorType.ORTHOGRAPHIC
 99        self.has_four_components_product = False
100        self.has_Fluor_Product = 0
101        self.cover_whole_scene = False
102        self.sample_per_pixel = 128
103        self.sub_region_width = 100
104        self.sub_region_height = 100
105
106    def set_sample_per_pixel(self, num):
107        self.sample_per_pixel = num
108
109    def get_sample_per_pixel(self):
110        return self.sample_per_pixel
111
112    def set_sub_region_width(self, width):
113        self.sub_region_width = width
114
115    def set_sub_region_height(self, height):
116        self.sub_region_height = height
117
118    def init_sensor_from_json(self, json_object):
119        super().init_sensor_from_json(json_object)
120        self.sensor_type = json_object["sensor"]["sensor_type"]
121        self.thermal_radiation = json_object["sensor"]["thermal_radiation"]
122        self.record_only_direct = json_object["sensor"]["record_only_direct"]
123        self.image_height = json_object["sensor"]["image_height"]
124        self.image_width = json_object["sensor"]["image_width"]
125        self.repetitive_scene = json_object["sensor"]["RepetitiveScene"]
126        self.has_four_components_product = json_object["sensor"]["hasFourComponentProduct"]
127        self.has_Fluor_Product = json_object["sensor"]["hasFluorProduct"]
128        self._film_type = json_object["sensor"]["film_type"]
129        self._bands = json_object["sensor"]["bands"]
130        self.no_data_value = json_object["sensor"]["NoDataValue"]
131
132        self.cover_whole_scene = json_object["sensor"]["orthographic"]["cover_whole_scene"]
133        self.sample_per_pixel = json_object["sensor"]["orthographic"]["sample_per_square_meter"]
134        self.sub_region_width = json_object["sensor"]["orthographic"]["sub_region_width"]
135        self.sub_region_height = json_object["sensor"]["orthographic"]["sub_region_height"]
136
137        return self
138
139    def to_json_object(self):
140        json_object = {"thermal_radiation": self.thermal_radiation,
141                       "record_only_direct": self.record_only_direct,
142                       "image_height": self.image_height,
143                       "RepetitiveScene": self.repetitive_scene,
144                       "hasFourComponentProduct": self.has_four_components_product,
145                       "hasFluorProduct": self.has_Fluor_Product,
146                       "film_type": self._film_type,
147                       "orthographic": {
148                          "cover_whole_scene": self.cover_whole_scene,
149                          "sample_per_square_meter": self.sample_per_pixel,
150                          "sub_region_width": self.sub_region_width,
151                          "sub_region_height": self.sub_region_height
152                        },
153                       "image_width": self.image_width,
154                       "bands": self._bands,
155                       "sensor_type": self.sensor_type,
156                       "NoDataValue": self.no_data_value}
157        if self._virtualPlane is not None:
158            json_object["virtualPlane"] = self._virtualPlane
159        return json_object
sensor_type
has_four_components_product
has_Fluor_Product
cover_whole_scene
sample_per_pixel
sub_region_width
sub_region_height
def set_sample_per_pixel(self, num):
106    def set_sample_per_pixel(self, num):
107        self.sample_per_pixel = num
def get_sample_per_pixel(self):
109    def get_sample_per_pixel(self):
110        return self.sample_per_pixel
def set_sub_region_width(self, width):
112    def set_sub_region_width(self, width):
113        self.sub_region_width = width
def set_sub_region_height(self, height):
115    def set_sub_region_height(self, height):
116        self.sub_region_height = height
def init_sensor_from_json(self, json_object):
118    def init_sensor_from_json(self, json_object):
119        super().init_sensor_from_json(json_object)
120        self.sensor_type = json_object["sensor"]["sensor_type"]
121        self.thermal_radiation = json_object["sensor"]["thermal_radiation"]
122        self.record_only_direct = json_object["sensor"]["record_only_direct"]
123        self.image_height = json_object["sensor"]["image_height"]
124        self.image_width = json_object["sensor"]["image_width"]
125        self.repetitive_scene = json_object["sensor"]["RepetitiveScene"]
126        self.has_four_components_product = json_object["sensor"]["hasFourComponentProduct"]
127        self.has_Fluor_Product = json_object["sensor"]["hasFluorProduct"]
128        self._film_type = json_object["sensor"]["film_type"]
129        self._bands = json_object["sensor"]["bands"]
130        self.no_data_value = json_object["sensor"]["NoDataValue"]
131
132        self.cover_whole_scene = json_object["sensor"]["orthographic"]["cover_whole_scene"]
133        self.sample_per_pixel = json_object["sensor"]["orthographic"]["sample_per_square_meter"]
134        self.sub_region_width = json_object["sensor"]["orthographic"]["sub_region_width"]
135        self.sub_region_height = json_object["sensor"]["orthographic"]["sub_region_height"]
136
137        return self
def to_json_object(self):
139    def to_json_object(self):
140        json_object = {"thermal_radiation": self.thermal_radiation,
141                       "record_only_direct": self.record_only_direct,
142                       "image_height": self.image_height,
143                       "RepetitiveScene": self.repetitive_scene,
144                       "hasFourComponentProduct": self.has_four_components_product,
145                       "hasFluorProduct": self.has_Fluor_Product,
146                       "film_type": self._film_type,
147                       "orthographic": {
148                          "cover_whole_scene": self.cover_whole_scene,
149                          "sample_per_square_meter": self.sample_per_pixel,
150                          "sub_region_width": self.sub_region_width,
151                          "sub_region_height": self.sub_region_height
152                        },
153                       "image_width": self.image_width,
154                       "bands": self._bands,
155                       "sensor_type": self.sensor_type,
156                       "NoDataValue": self.no_data_value}
157        if self._virtualPlane is not None:
158            json_object["virtualPlane"] = self._virtualPlane
159        return json_object
class SensorPhotonTracing(SensorBasic):
162class SensorPhotonTracing(SensorBasic):
163    def __init__(self):
164        super().__init__()
165        self.sensor_type = SensorType.PHOTONTRACING
166        self.cover_whole_scene = False
167        self.sample_per_pixel = 128
168        self.sub_region_width = 100
169        self.sub_region_height = 100
170
171        self.sun_ray_resolution = 0.02
172        self.BRF_product = True
173        self.Fluor_product = 0
174        self.number_of_directions = 150
175        self.virtual_detector_directions = ""
176        self.virtual_directions = ""
177        self.up_down_product = False
178        self.fPAR_product = False
179        self.fpar_layers = "0:2:20"
180
181    def set_virtual_director_directions(self, virtual_detector):
182        self.virtual_detector_directions = virtual_detector
183
184    def get_virtual_director_directions(self):
185        return self.virtual_detector_directions
186
187    def set_virtual_directions(self, virtual_directions):
188        self.virtual_directions = virtual_directions
189
190    def get_virtual_directions(self):
191        return self.virtual_directions
192
193    def set_sun_ray_resolution(self, sun_ray_resolution):
194        self.sun_ray_resolution = sun_ray_resolution
195
196    def get_run_ray_resolution(self):
197        return self.sun_ray_resolution
198
199    def set_number_of_directions(self, num):
200        self.number_of_directions = num
201
202    def get_number_of_directions(self):
203        return self.number_of_directions
204
205    def enable_brf_product(self, enabled):
206        self.BRF_product = enabled
207    def enable_Fluor_product(self, enabled):
208        self.Fluor_product = enabled
209
210    def enable_fpar_product(self, enabled):
211        self.fPAR_product = enabled
212
213    def set_fpar_layer(self, fpar_layer):
214        self.fpar_layers = fpar_layer
215
216    def get_fpar_layer(self):
217        return self.fpar_layers
218
219    def enable_updown_radiation_product(self,enabled):
220        self.up_down_product = enabled
221
222    def init_sensor_from_json(self, json_object):
223        super().init_sensor_from_json(json_object)
224        self.sensor_type = json_object["sensor"]["sensor_type"]
225        self.thermal_radiation = json_object["sensor"]["thermal_radiation"]
226        self.record_only_direct = json_object["sensor"]["record_only_direct"]
227        self.image_height = json_object["sensor"]["image_height"]
228        self.image_width = json_object["sensor"]["image_width"]
229        self.repetitive_scene = json_object["sensor"]["RepetitiveScene"]
230        self._film_type = json_object["sensor"]["film_type"]
231        self._bands = json_object["sensor"]["bands"]
232        self.no_data_value = json_object["sensor"]["NoDataValue"]
233
234        self.cover_whole_scene = json_object["sensor"]["orthographic"]["cover_whole_scene"]
235        self.sample_per_pixel = json_object["sensor"]["orthographic"]["sample_per_square_meter"]
236        self.sub_region_width = json_object["sensor"]["orthographic"]["sub_region_width"]
237        self.sub_region_height = json_object["sensor"]["orthographic"]["sub_region_height"]
238
239        self.sun_ray_resolution = json_object["sensor"]["PhotonTracing"]["sunRayResolution"]
240        self.BRF_product = json_object["sensor"]["PhotonTracing"]["BRFProduct"]
241        self.Fluor_product = json_object["sensor"]["PhotonTracing"]["FluorProduct"]
242        if self.BRF_product or self.Fluor_product != 0:
243            self.virtual_detector_directions = json_object["sensor"]["PhotonTracing"]["virtualDetectorDirections"]
244            self.virtual_directions = json_object["sensor"]["PhotonTracing"]["virtualDirections"]
245            self.number_of_directions = json_object["sensor"]["PhotonTracing"]["NumberOfDirections"]
246        self.up_down_product = json_object["sensor"]["PhotonTracing"]["UpDownProduct"]
247        self.fPAR_product = json_object["sensor"]["PhotonTracing"]["fPARProduct"]
248        self.fpar_layers = json_object["sensor"]["PhotonTracing"]["LayerDefinition"] if "LayerDefinition" in json_object["sensor"]["PhotonTracing"] else "0:2:20"
249        return self
250
251    def to_json_object(self):
252        json_object = {"thermal_radiation": self.thermal_radiation,
253                       "record_only_direct": self.record_only_direct,
254                       "image_height": self.image_height,
255                       "RepetitiveScene": self.repetitive_scene,
256                       "film_type": self._film_type,
257                       "PhotonTracing": {
258                           "virtualDetectorDirections": self.virtual_detector_directions,
259                           "sunRayResolution": self.sun_ray_resolution,
260                           "NumberOfDirections": self.number_of_directions,
261                           "BRFProduct": self.BRF_product,
262                           "FluorProduct": self.Fluor_product,
263                           "UpDownProduct": self.up_down_product,
264                           "virtualDirections": self.virtual_directions,
265                           "fPARProduct": self.fPAR_product,
266                           "LayerDefinition": self.fpar_layers
267                       },
268                       "orthographic": {
269                          "cover_whole_scene": self.cover_whole_scene,
270                          "sample_per_square_meter": self.sample_per_pixel,
271                          "sub_region_width": self.sub_region_width,
272                          "sub_region_height": self.sub_region_height
273                        },
274                       "image_width": self.image_width,
275                       "bands": self._bands,
276                       "sensor_type": self.sensor_type,
277                       "NoDataValue": self.no_data_value}
278        if self._virtualPlane is not None:
279            json_object["virtualPlane"] = self._virtualPlane
280        return json_object
sensor_type
cover_whole_scene
sample_per_pixel
sub_region_width
sub_region_height
sun_ray_resolution
BRF_product
Fluor_product
number_of_directions
virtual_detector_directions
virtual_directions
up_down_product
fPAR_product
fpar_layers
def set_virtual_director_directions(self, virtual_detector):
181    def set_virtual_director_directions(self, virtual_detector):
182        self.virtual_detector_directions = virtual_detector
def get_virtual_director_directions(self):
184    def get_virtual_director_directions(self):
185        return self.virtual_detector_directions
def set_virtual_directions(self, virtual_directions):
187    def set_virtual_directions(self, virtual_directions):
188        self.virtual_directions = virtual_directions
def get_virtual_directions(self):
190    def get_virtual_directions(self):
191        return self.virtual_directions
def set_sun_ray_resolution(self, sun_ray_resolution):
193    def set_sun_ray_resolution(self, sun_ray_resolution):
194        self.sun_ray_resolution = sun_ray_resolution
def get_run_ray_resolution(self):
196    def get_run_ray_resolution(self):
197        return self.sun_ray_resolution
def set_number_of_directions(self, num):
199    def set_number_of_directions(self, num):
200        self.number_of_directions = num
def get_number_of_directions(self):
202    def get_number_of_directions(self):
203        return self.number_of_directions
def enable_brf_product(self, enabled):
205    def enable_brf_product(self, enabled):
206        self.BRF_product = enabled
def enable_Fluor_product(self, enabled):
207    def enable_Fluor_product(self, enabled):
208        self.Fluor_product = enabled
def enable_fpar_product(self, enabled):
210    def enable_fpar_product(self, enabled):
211        self.fPAR_product = enabled
def set_fpar_layer(self, fpar_layer):
213    def set_fpar_layer(self, fpar_layer):
214        self.fpar_layers = fpar_layer
def get_fpar_layer(self):
216    def get_fpar_layer(self):
217        return self.fpar_layers
def enable_updown_radiation_product(self, enabled):
219    def enable_updown_radiation_product(self,enabled):
220        self.up_down_product = enabled
def init_sensor_from_json(self, json_object):
222    def init_sensor_from_json(self, json_object):
223        super().init_sensor_from_json(json_object)
224        self.sensor_type = json_object["sensor"]["sensor_type"]
225        self.thermal_radiation = json_object["sensor"]["thermal_radiation"]
226        self.record_only_direct = json_object["sensor"]["record_only_direct"]
227        self.image_height = json_object["sensor"]["image_height"]
228        self.image_width = json_object["sensor"]["image_width"]
229        self.repetitive_scene = json_object["sensor"]["RepetitiveScene"]
230        self._film_type = json_object["sensor"]["film_type"]
231        self._bands = json_object["sensor"]["bands"]
232        self.no_data_value = json_object["sensor"]["NoDataValue"]
233
234        self.cover_whole_scene = json_object["sensor"]["orthographic"]["cover_whole_scene"]
235        self.sample_per_pixel = json_object["sensor"]["orthographic"]["sample_per_square_meter"]
236        self.sub_region_width = json_object["sensor"]["orthographic"]["sub_region_width"]
237        self.sub_region_height = json_object["sensor"]["orthographic"]["sub_region_height"]
238
239        self.sun_ray_resolution = json_object["sensor"]["PhotonTracing"]["sunRayResolution"]
240        self.BRF_product = json_object["sensor"]["PhotonTracing"]["BRFProduct"]
241        self.Fluor_product = json_object["sensor"]["PhotonTracing"]["FluorProduct"]
242        if self.BRF_product or self.Fluor_product != 0:
243            self.virtual_detector_directions = json_object["sensor"]["PhotonTracing"]["virtualDetectorDirections"]
244            self.virtual_directions = json_object["sensor"]["PhotonTracing"]["virtualDirections"]
245            self.number_of_directions = json_object["sensor"]["PhotonTracing"]["NumberOfDirections"]
246        self.up_down_product = json_object["sensor"]["PhotonTracing"]["UpDownProduct"]
247        self.fPAR_product = json_object["sensor"]["PhotonTracing"]["fPARProduct"]
248        self.fpar_layers = json_object["sensor"]["PhotonTracing"]["LayerDefinition"] if "LayerDefinition" in json_object["sensor"]["PhotonTracing"] else "0:2:20"
249        return self
def to_json_object(self):
251    def to_json_object(self):
252        json_object = {"thermal_radiation": self.thermal_radiation,
253                       "record_only_direct": self.record_only_direct,
254                       "image_height": self.image_height,
255                       "RepetitiveScene": self.repetitive_scene,
256                       "film_type": self._film_type,
257                       "PhotonTracing": {
258                           "virtualDetectorDirections": self.virtual_detector_directions,
259                           "sunRayResolution": self.sun_ray_resolution,
260                           "NumberOfDirections": self.number_of_directions,
261                           "BRFProduct": self.BRF_product,
262                           "FluorProduct": self.Fluor_product,
263                           "UpDownProduct": self.up_down_product,
264                           "virtualDirections": self.virtual_directions,
265                           "fPARProduct": self.fPAR_product,
266                           "LayerDefinition": self.fpar_layers
267                       },
268                       "orthographic": {
269                          "cover_whole_scene": self.cover_whole_scene,
270                          "sample_per_square_meter": self.sample_per_pixel,
271                          "sub_region_width": self.sub_region_width,
272                          "sub_region_height": self.sub_region_height
273                        },
274                       "image_width": self.image_width,
275                       "bands": self._bands,
276                       "sensor_type": self.sensor_type,
277                       "NoDataValue": self.no_data_value}
278        if self._virtualPlane is not None:
279            json_object["virtualPlane"] = self._virtualPlane
280        return json_object
class SensorPerspective(SensorBasic):
283class SensorPerspective(SensorBasic):
284    def __init__(self):
285        super().__init__()
286        self.sensor_type = SensorType.PERSPECTIVE
287        self.has_four_components_product = False
288        self.sample_per_pixel = 128
289        self.fov_x = 40
290        self.fov_y = 30
291        self.fov_axis = "diagonal"
292        self.has_Fluor_Product = 0
293
294    def set_fov_x(self, fov_x):
295        self.fov_x = fov_x
296
297    def get_fov_x(self):
298        return self.fov_x
299
300    def set_fov_y(self, fov_y):
301        self.fov_y = fov_y
302
303    def get_fov_y(self):
304        return self.fov_y
305
306    def set_sample_per_pixel(self, num):
307        self.sample_per_pixel = num
308
309    def get_sample_per_pixel(self):
310        return self.sample_per_pixel
311
312    def init_sensor_from_json(self, json_object):
313        super().init_sensor_from_json(json_object)
314        self.sensor_type = json_object["sensor"]["sensor_type"]
315        self.thermal_radiation = json_object["sensor"]["thermal_radiation"]
316        self.record_only_direct = json_object["sensor"]["record_only_direct"]
317        self.image_height = json_object["sensor"]["image_height"]
318        self.image_width = json_object["sensor"]["image_width"]
319        self.repetitive_scene = json_object["sensor"]["RepetitiveScene"]
320        self.has_four_components_product = json_object["sensor"]["hasFourComponentProduct"]
321        self.has_Fluor_Product = json_object["sensor"]["hasFluorProduct"]
322        self._film_type = json_object["sensor"]["film_type"]
323        self._bands = json_object["sensor"]["bands"]
324        self.no_data_value = json_object["sensor"]["NoDataValue"]
325
326        self.sample_per_pixel = json_object["sensor"]["perspective"]["sample_per_square_meter"]
327        self.fov_x = json_object["sensor"]["perspective"]["fovx"]
328        self.fov_y = json_object["sensor"]["perspective"]["fovy"]
329        self.fov_axis = json_object["sensor"]["perspective"]["fovAxis"]
330
331        return self
332
333    def to_json_object(self):
334        json_object = {"thermal_radiation": self.thermal_radiation,
335                       "record_only_direct": self.record_only_direct,
336                       "image_height": self.image_height,
337                       "RepetitiveScene": self.repetitive_scene,
338                       "hasFourComponentProduct": self.has_four_components_product,
339                       "hasFluorProduct": self.has_Fluor_Product,
340                       "film_type": self._film_type,
341                       "perspective": {
342                          "sample_per_square_meter": self.sample_per_pixel,
343                          "fovx": self.fov_x,
344                          "fovy": self.fov_y,
345                          "fovAxis": self.fov_axis
346                        },
347                       "image_width": self.image_width,
348                       "bands": self._bands,
349                       "sensor_type": self.sensor_type,
350                       "NoDataValue": self.no_data_value}
351        if self._virtualPlane is not None:
352            json_object["virtualPlane"] = self._virtualPlane
353        return json_object
sensor_type
has_four_components_product
sample_per_pixel
fov_x
fov_y
fov_axis
has_Fluor_Product
def set_fov_x(self, fov_x):
294    def set_fov_x(self, fov_x):
295        self.fov_x = fov_x
def get_fov_x(self):
297    def get_fov_x(self):
298        return self.fov_x
def set_fov_y(self, fov_y):
300    def set_fov_y(self, fov_y):
301        self.fov_y = fov_y
def get_fov_y(self):
303    def get_fov_y(self):
304        return self.fov_y
def set_sample_per_pixel(self, num):
306    def set_sample_per_pixel(self, num):
307        self.sample_per_pixel = num
def get_sample_per_pixel(self):
309    def get_sample_per_pixel(self):
310        return self.sample_per_pixel
def init_sensor_from_json(self, json_object):
312    def init_sensor_from_json(self, json_object):
313        super().init_sensor_from_json(json_object)
314        self.sensor_type = json_object["sensor"]["sensor_type"]
315        self.thermal_radiation = json_object["sensor"]["thermal_radiation"]
316        self.record_only_direct = json_object["sensor"]["record_only_direct"]
317        self.image_height = json_object["sensor"]["image_height"]
318        self.image_width = json_object["sensor"]["image_width"]
319        self.repetitive_scene = json_object["sensor"]["RepetitiveScene"]
320        self.has_four_components_product = json_object["sensor"]["hasFourComponentProduct"]
321        self.has_Fluor_Product = json_object["sensor"]["hasFluorProduct"]
322        self._film_type = json_object["sensor"]["film_type"]
323        self._bands = json_object["sensor"]["bands"]
324        self.no_data_value = json_object["sensor"]["NoDataValue"]
325
326        self.sample_per_pixel = json_object["sensor"]["perspective"]["sample_per_square_meter"]
327        self.fov_x = json_object["sensor"]["perspective"]["fovx"]
328        self.fov_y = json_object["sensor"]["perspective"]["fovy"]
329        self.fov_axis = json_object["sensor"]["perspective"]["fovAxis"]
330
331        return self
def to_json_object(self):
333    def to_json_object(self):
334        json_object = {"thermal_radiation": self.thermal_radiation,
335                       "record_only_direct": self.record_only_direct,
336                       "image_height": self.image_height,
337                       "RepetitiveScene": self.repetitive_scene,
338                       "hasFourComponentProduct": self.has_four_components_product,
339                       "hasFluorProduct": self.has_Fluor_Product,
340                       "film_type": self._film_type,
341                       "perspective": {
342                          "sample_per_square_meter": self.sample_per_pixel,
343                          "fovx": self.fov_x,
344                          "fovy": self.fov_y,
345                          "fovAxis": self.fov_axis
346                        },
347                       "image_width": self.image_width,
348                       "bands": self._bands,
349                       "sensor_type": self.sensor_type,
350                       "NoDataValue": self.no_data_value}
351        if self._virtualPlane is not None:
352            json_object["virtualPlane"] = self._virtualPlane
353        return json_object
class SensorFisheye(SensorBasic):
356class SensorFisheye(SensorBasic):
357    def __init__(self):
358        super().__init__()
359        self.sensor_type = SensorType.CIRCULARFISHEYE
360        # self.sample_per_square_meter = 128
361        self.sample_per_pixel = 128
362        self.angular_fov = 165
363        self.projection_type = "equisolid"
364        self.has_Fluor_Product = 0
365
366    def set_sample_per_pixel(self, num):
367        self.sample_per_pixel = num
368
369    def get_sample_per_pixel(self):
370        return self.sample_per_pixel
371
372    def set_angular_fov(self, fov):
373        self.angular_fov = fov
374
375    def get_angular_fov(self):
376        return self.angular_fov
377
378    def set_projection_type(self, prj_type):
379        self.projection_type = prj_type
380
381    def get_projection_type(self):
382        return self.projection_type
383
384    def init_sensor_from_json(self, json_object):
385        self.sensor_type = json_object["sensor"]["sensor_type"]
386        self.thermal_radiation = json_object["sensor"]["thermal_radiation"]
387        self.record_only_direct = json_object["sensor"]["record_only_direct"]
388        self.image_height = json_object["sensor"]["image_height"]
389        self.image_width = json_object["sensor"]["image_width"]
390        self.repetitive_scene = json_object["sensor"]["RepetitiveScene"]
391        self.has_Fluor_Product = json_object["sensor"]["hasFluorProduct"]
392        self._film_type = json_object["sensor"]["film_type"]
393        self._bands = json_object["sensor"]["bands"]
394        self.no_data_value = json_object["sensor"]["NoDataValue"]
395
396        self.sample_per_pixel = json_object["sensor"]["CircularFisheye"]["sample_per_square_meter"]
397        self.angular_fov = json_object["sensor"]["CircularFisheye"]["angular_fov"]
398        self.projection_type = json_object["sensor"]["CircularFisheye"]["projection_type"]
399
400        return self
401
402    def to_json_object(self):
403        json_object = {"thermal_radiation": self.thermal_radiation,
404                       "record_only_direct": self.record_only_direct,
405                       "image_height": self.image_height,
406                       "RepetitiveScene": self.repetitive_scene,
407                       "hasFluorProduct": self.has_Fluor_Product,
408                       "film_type": self._film_type,
409                       "CircularFisheye": {
410                          "angular_fov": self.angular_fov,
411                          "projection_type": self.projection_type,
412                          "sample_per_square_meter": self.sample_per_pixel
413                        },
414                       "image_width": self.image_width,
415                       "bands": self._bands,
416                       "sensor_type": self.sensor_type,
417                       "NoDataValue": self.no_data_value}
418        return json_object
sensor_type
sample_per_pixel
angular_fov
projection_type
has_Fluor_Product
def set_sample_per_pixel(self, num):
366    def set_sample_per_pixel(self, num):
367        self.sample_per_pixel = num
def get_sample_per_pixel(self):
369    def get_sample_per_pixel(self):
370        return self.sample_per_pixel
def set_angular_fov(self, fov):
372    def set_angular_fov(self, fov):
373        self.angular_fov = fov
def get_angular_fov(self):
375    def get_angular_fov(self):
376        return self.angular_fov
def set_projection_type(self, prj_type):
378    def set_projection_type(self, prj_type):
379        self.projection_type = prj_type
def get_projection_type(self):
381    def get_projection_type(self):
382        return self.projection_type
def init_sensor_from_json(self, json_object):
384    def init_sensor_from_json(self, json_object):
385        self.sensor_type = json_object["sensor"]["sensor_type"]
386        self.thermal_radiation = json_object["sensor"]["thermal_radiation"]
387        self.record_only_direct = json_object["sensor"]["record_only_direct"]
388        self.image_height = json_object["sensor"]["image_height"]
389        self.image_width = json_object["sensor"]["image_width"]
390        self.repetitive_scene = json_object["sensor"]["RepetitiveScene"]
391        self.has_Fluor_Product = json_object["sensor"]["hasFluorProduct"]
392        self._film_type = json_object["sensor"]["film_type"]
393        self._bands = json_object["sensor"]["bands"]
394        self.no_data_value = json_object["sensor"]["NoDataValue"]
395
396        self.sample_per_pixel = json_object["sensor"]["CircularFisheye"]["sample_per_square_meter"]
397        self.angular_fov = json_object["sensor"]["CircularFisheye"]["angular_fov"]
398        self.projection_type = json_object["sensor"]["CircularFisheye"]["projection_type"]
399
400        return self
def to_json_object(self):
402    def to_json_object(self):
403        json_object = {"thermal_radiation": self.thermal_radiation,
404                       "record_only_direct": self.record_only_direct,
405                       "image_height": self.image_height,
406                       "RepetitiveScene": self.repetitive_scene,
407                       "hasFluorProduct": self.has_Fluor_Product,
408                       "film_type": self._film_type,
409                       "CircularFisheye": {
410                          "angular_fov": self.angular_fov,
411                          "projection_type": self.projection_type,
412                          "sample_per_square_meter": self.sample_per_pixel
413                        },
414                       "image_width": self.image_width,
415                       "bands": self._bands,
416                       "sensor_type": self.sensor_type,
417                       "NoDataValue": self.no_data_value}
418        return json_object
class SensorLiDAR(SensorBasic):
421class SensorLiDAR(SensorBasic):
422    def __init__(self):
423        super().__init__()
424        self.sensor_type = SensorType.LIDAR
425        self.scanning_device = ALSLiDAR()
426
427    def get_scanning_device(self):
428        return self.scanning_device
429
430    def set_scanning_device(self, scanning_device):
431        self.scanning_device = scanning_device
432
433    def init_sensor_from_json(self, json_object):
434        # lidar
435        lidar_conf_path = os.path.join(self.get_sim().get_sim_dir(), "Parameters", "lidar.conf")
436        if os.path.exists(lidar_conf_path):
437            self.scanning_device = create_lidar_from_file(lidar_conf_path)
438        else:
439            print("Error: LiDAR device parameters is not set.")
440            sys.exit(0)
441        self.sensor_type = json_object["sensor"]["sensor_type"]
442        self.thermal_radiation = json_object["sensor"]["thermal_radiation"]
443        self.record_only_direct = json_object["sensor"]["record_only_direct"]
444        self.image_height = json_object["sensor"]["image_height"]
445        self.image_width = json_object["sensor"]["image_width"]
446        self.repetitive_scene = json_object["sensor"]["RepetitiveScene"]
447        self._film_type = json_object["sensor"]["film_type"]
448        self._bands = json_object["sensor"]["bands"]
449        self.no_data_value = json_object["sensor"]["NoDataValue"]
450        return self
451
452    def to_json_object(self):
453        lidar_conf_path = os.path.join(self.get_sim().get_sim_dir(), "Parameters", "lidar.conf")
454        f_out = open(lidar_conf_path, "w")
455        json.dump(self.scanning_device.to_json_object(), f_out, indent=2)
456        f_out.close()
457        json_object = {"thermal_radiation": self.thermal_radiation,
458                       "record_only_direct": self.record_only_direct,
459                       "image_height": self.image_height,
460                       "RepetitiveScene": self.repetitive_scene,
461                       "film_type": self._film_type,
462                       "image_width": self.image_width,
463                       "bands": self._bands,
464                       "sensor_type": self.sensor_type,
465                       "NoDataValue": self.no_data_value}
466        return json_object
sensor_type
scanning_device
def get_scanning_device(self):
427    def get_scanning_device(self):
428        return self.scanning_device
def set_scanning_device(self, scanning_device):
430    def set_scanning_device(self, scanning_device):
431        self.scanning_device = scanning_device
def init_sensor_from_json(self, json_object):
433    def init_sensor_from_json(self, json_object):
434        # lidar
435        lidar_conf_path = os.path.join(self.get_sim().get_sim_dir(), "Parameters", "lidar.conf")
436        if os.path.exists(lidar_conf_path):
437            self.scanning_device = create_lidar_from_file(lidar_conf_path)
438        else:
439            print("Error: LiDAR device parameters is not set.")
440            sys.exit(0)
441        self.sensor_type = json_object["sensor"]["sensor_type"]
442        self.thermal_radiation = json_object["sensor"]["thermal_radiation"]
443        self.record_only_direct = json_object["sensor"]["record_only_direct"]
444        self.image_height = json_object["sensor"]["image_height"]
445        self.image_width = json_object["sensor"]["image_width"]
446        self.repetitive_scene = json_object["sensor"]["RepetitiveScene"]
447        self._film_type = json_object["sensor"]["film_type"]
448        self._bands = json_object["sensor"]["bands"]
449        self.no_data_value = json_object["sensor"]["NoDataValue"]
450        return self
def to_json_object(self):
452    def to_json_object(self):
453        lidar_conf_path = os.path.join(self.get_sim().get_sim_dir(), "Parameters", "lidar.conf")
454        f_out = open(lidar_conf_path, "w")
455        json.dump(self.scanning_device.to_json_object(), f_out, indent=2)
456        f_out.close()
457        json_object = {"thermal_radiation": self.thermal_radiation,
458                       "record_only_direct": self.record_only_direct,
459                       "image_height": self.image_height,
460                       "RepetitiveScene": self.repetitive_scene,
461                       "film_type": self._film_type,
462                       "image_width": self.image_width,
463                       "bands": self._bands,
464                       "sensor_type": self.sensor_type,
465                       "NoDataValue": self.no_data_value}
466        return json_object