Skip to content

Commit ffbe6d8

Browse files
authored
Merge pull request #162 from eEcoLiDAR/development
Development
2 parents 6619783 + 3cf879c commit ffbe6d8

File tree

97 files changed

+3002
-2171
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

97 files changed

+3002
-2171
lines changed

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ before_install:
1616
- export PATH="$HOME/miniconda/bin:$PATH"
1717
- conda config --set always_yes yes
1818
- conda update -q conda
19-
- conda create -q -n test-environment python=$TRAVIS_PYTHON_VERSION pip openblas numpy scipy
19+
- conda create -q -n test-environment python=$TRAVIS_PYTHON_VERSION pip
2020
- source activate test-environment
2121
- "pip install -q --upgrade 'pip'"
2222
- "pip install -q 'coverage'"

.zenodo.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,18 @@
3232
"affiliation": "Netherlands eScience Center",
3333
"name": "van den Oord, Gijs"
3434
},
35+
{
36+
"affiliation": "Netherlands eScience Center",
37+
"name": "Grootes, Meiert W."
38+
},
39+
{
40+
"affiliation": "Netherlands eScience Center",
41+
"name": "Nattino, Francesco"
42+
},
43+
{
44+
"affiliation": "Netherlands eScience Center",
45+
"name": "Ku, Ou"
46+
},
3547
{
3648
"affiliation": "Institute for Biodiversity and Ecosystem Dynamics, University of Amsterdam",
3749
"name": "Koma, Zsófia"

CHANGELOG.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,26 @@ All notable changes to this project will be documented in this file.
44
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
55
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
66

7+
## Unreleased
8+
9+
## 0.4.0 - 2020-05-13
10+
## Added:
11+
- build_volume module
12+
- the most relevant functions can be now imported directly from laserchicken
13+
- reading/writing of binary PLY and LAZ files, with optional writing of selected attributes
14+
- utility function to merge point-cloud data
15+
- extra log tasks implemented: point-cloud log entries are introduced upon point-cloud loading, filtering, normalizing, merging and assigning to targets.
16+
- select_polygon now supports multi-polygons and optionally return a mask for the selected points
17+
18+
## Changed:
19+
- compute neighborhoods returns generator with neighborhoods instead of nested neighborhoods like it did before (breaking change!)
20+
- Some of the existing modules have been renamed/restructured (breaking changes!):
21+
- `normalization` --> `normalize`
22+
- `feature_extraction` created (functions moved from `feature_extractor/__init__.py`)
23+
- `select` and `spatial_selection` merged into `filter`, with the function `select_polygon` allowing to deal with all the spatial selection functionalities
24+
- format-specific `read_*` and `write_*` modules replaced by `load` and `export`
25+
- Dependency on `laspy` replaced by `pylas` + `lazperf` (easier reading/writing of LAS/LAZ files)
26+
727
## 0.3.2 - 2019-12-12
828
## Added
929
- Features added:

CITATION.cff

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,24 @@ authors:
3535
family-names: Oord
3636
given-names: Gijs
3737
name-particle: "van den"
38+
-
39+
affiliation: "Netherlands eScience Center"
40+
family-names: Grootes
41+
given-names: "Meiert W."
42+
-
43+
affiliation: "Netherlands eScience Center"
44+
family-names: Nattino
45+
given-names: Francesco
46+
-
47+
affiliation: "Netherlands eScience Center"
48+
family-names: Ku
49+
given-names: Ou
3850
-
3951
affiliation: "Institute for Biodiversity and Ecosystem Dynamics, University of Amsterdam"
4052
family-names: Koma
4153
given-names: Zsófia
4254
cff-version: "1.0.3"
43-
date-released: 2019-10-15
55+
date-released: 2020-05-13
4456
doi: "10.5281/zenodo.1219422"
4557
keywords:
4658
- "airborne laser scanning"
@@ -50,5 +62,5 @@ keywords:
5062
license: "Apache-2.0"
5163
message: "If you use this software, please cite it using these metadata."
5264
title: "Laserchicken: toolkit for ALS point clouds"
53-
version: "0.3.2"
65+
version: "0.4.0"
5466
...

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ Toolkit for handling point clouds created using airborne laser scanning (ALS). F
1313

1414
# Installation
1515
Prerequisites:
16-
- Python 3.5 or higher
16+
- Python 3.5 or higher (3.6 is recommended)
1717
- pip
1818
```
1919
pip install laserchicken

docs/index.rst

Lines changed: 18 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -65,17 +65,17 @@ the PDAL library (https://pdal.io/), this provides access to a comprehensive ran
6565

6666
Example from the tutorial notebook::
6767

68-
from laserchicken.read_las import read
69-
point_cloud = read('testdata/AHN3.las')
68+
from laserchicken import load
69+
point_cloud = load('testdata/AHN3.las')
7070

7171
Normalize
7272
---------
7373

74-
A number of features (Table~\ref{tab_features}) require the normalized height above ground as input. Laserchicken provides the option of internally constructing a digital terrain model (DTM) and deriving this quantity. To this end, the EPC is divided into small cells 1m or 2.5m squared). The lowest point in each cell is taken as the height of the DTM. Each point in the cell is then assigned a normalized height with respect to the derived DTM height. This results in strictly positive heights and smooths variations in elevation on scales larger than the cell size. The normalized EPC can be used directly in further analysis, or serialized to disk.
74+
A number of features require the normalized height above ground as input. Laserchicken provides the option of internally constructing a digital terrain model (DTM) and deriving this quantity. To this end, the EPC is divided into small cells 1m or 2.5m squared). The lowest point in each cell is taken as the height of the DTM. Each point in the cell is then assigned a normalized height with respect to the derived DTM height. This results in strictly positive heights and smooths variations in elevation on scales larger than the cell size. The normalized EPC can be used directly in further analysis, or serialized to disk.
7575

7676
Example from the tutorial notebook::
7777

78-
from laserchicken.normalization import normalize
78+
from laserchicken.normalize import normalize
7979
normalize(point_cloud)
8080

8181
Filter
@@ -84,18 +84,17 @@ Laserchicken provides the option of filtering the EPC prior to extracting featur
8484

8585
Example of spatial filtering from the tutorial notebook::
8686

87-
from laserchicken.spatial_selections import points_in_polygon_wkt
87+
from laserchicken.filter import select_polygon
8888
polygon = "POLYGON(( 131963.984125 549718.375000," + \
8989
" 132000.000125 549718.375000," + \
9090
" 132000.000125 549797.063000," + \
9191
" 131963.984125 549797.063000," + \
9292
" 131963.984125 549718.375000))"
93-
points_in_area = points_in_polygon_wkt(point_cloud, polygon)
94-
point_cloud = points_in_area
93+
point_cloud = select_polygon(point_cloud, polygon)
9594

9695
Example of applying a filter on the theshold of an attribute::
9796

98-
from laserchicken.select import select_above, select_below
97+
from laserchicken.filter import select_above, select_below
9998
points_below_1_meter = select_below(point_cloud, 'normalized_height', 1)
10099
points_above_1_meter = select_above(point_cloud, 'normalized_height', 1)
101100

@@ -110,13 +109,13 @@ and TPC in kdTrees in an initial step prior to the computation of neighbors, sub
110109

111110
Example from the tutorial notebook::
112111

113-
from laserchicken.compute_neighbors import compute_neighborhoods
114-
from laserchicken.volume_specification import Sphere
112+
from laserchicken import compute_neighborhoods
113+
from laserchicken import build_volume
115114
targets = point_cloud
116-
volume = Sphere(5)
117-
neighbors = compute_neighborhoods(point_cloud, targets, volume)
115+
volume = build_volume('sphere', radius=5)
116+
neighborhoods = compute_neighborhoods(point_cloud, targets, volume)
118117

119-
Note that in the above example, neighbors is a generator and can only be iterated once. If you would want to do multiple calculations without recalculating the neighbors, you can copy the neighbors to a list. This is not done by default because neighbors can quickly grow quite large so that available RAM unnecessarily becomes the bottle neck.
118+
Note that in the above example, ``neighborhoods`` is a generator and can only be iterated once. If you would want to do multiple calculations without recalculating the neighbors, you can copy the neighborhoods to a list. This is not done by default because neighborhoods can quickly grow quite large so that available RAM unnecessarily becomes the bottle neck.
120119

121120
Features
122121
--------
@@ -128,15 +127,14 @@ template for new features requiring similar operations.
128127

129128
Example from the tutorial notebook::
130129

131-
from laserchicken.feature_extractor import compute_features
132-
for x in neighbors:
133-
compute_features(point_cloud, x, 0, targets, ['std_z','mean_z','slope'], volume)
130+
from laserchicken import compute_features
131+
compute_features(point_cloud, neighborhoods, targets, ['std_z','mean_z','slope'], volume)
134132

135133
Features can be parameterized. If you need different parameters for them then their defaults you need to register them with these prior to using them.
136134

137135
Example of adding a few parameterized band ratio features on different attributes::
138136

139-
from laserchicken.feature_extractor import register_new_feature_extractor
137+
from laserchicken import register_new_feature_extractor
140138
from laserchicken.feature_extractor.band_ratio_feature_extractor import BandRatioFeatureExtractor
141139
register_new_feature_extractor(BandRatioFeatureExtractor(None,1,data_key='normalized_height'))
142140
register_new_feature_extractor(BandRatioFeatureExtractor(1,2,data_key='normalized_height'))
@@ -210,12 +208,12 @@ Below is an example. The figure visualizes the slope feature for a small neighbo
210208
Export
211209
------
212210

213-
Laserchicken can write to PLY, CSV, or LAS/LAZ format for further analysis with the user's choice of software. The PLY format is preferred, as it is flexibly extendable and is the only format Laserchicken will write provenance data to. It is also a widely supported point cloud format.
211+
Laserchicken can write to PLY or LAS/LAZ format for further analysis with the user's choice of software. The PLY format is preferred, as it is flexibly extendable and is the only format Laserchicken will write provenance data to. It is also a widely supported point cloud format.
214212

215213
Example from the tutorial notebook::
216214

217-
from laserchicken.write_ply import write
218-
write(point_cloud, 'my_output.ply')
215+
from laserchicken import export
216+
export(point_cloud, 'my_output.ply')
219217

220218

221219

laserchicken/__init__.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,7 @@
11
from ._version import __version__
2+
3+
from laserchicken.compute_neighbors import compute_neighborhoods
4+
from laserchicken.feature_extractor.feature_extraction import compute_features, register_new_feature_extractor
5+
from laserchicken.io.load import load
6+
from laserchicken.io.export import export
7+
from laserchicken.build_volume import build_volume

laserchicken/_version.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,6 @@
1-
__version__ = '0.3.2'
1+
import os
2+
3+
with open(os.path.join(os.path.dirname(__file__), '_version.txt'),
4+
'r') as f:
5+
version = f.read()
6+
__version__ = version.strip()

laserchicken/_version.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
0.4.0

laserchicken/build_volume.py

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
import inspect
2+
3+
import laserchicken
4+
from laserchicken.volume_specification import Volume
5+
6+
7+
def create_volume_map():
8+
""" Generate map of volume types that are available """
9+
volume_map = {}
10+
for name, obj in inspect.getmembers(laserchicken.volume_specification):
11+
if inspect.isclass(obj) and issubclass(obj, Volume) and obj is not Volume:
12+
volume_map[obj.TYPE] = obj
13+
return volume_map
14+
15+
16+
VOLUMES = create_volume_map()
17+
18+
19+
def build_volume(volume_type, *args, **kwargs):
20+
"""
21+
Return volume object from the volume name and the corresponding parameters
22+
23+
Example:
24+
>>>> vol = build_volume('sphere', radius=5)
25+
26+
:param volume_type: name corresponding to the
27+
:param args: optional non-keyword args to build the volume
28+
:param kwargs: optional keyword args to build the volume
29+
:return:
30+
"""
31+
_volume_type = volume_type.lower()
32+
_verify_volume_type(_volume_type)
33+
volume_builder = VOLUMES[_volume_type]
34+
return volume_builder(*args, **kwargs)
35+
36+
37+
def _verify_volume_type(volume_type):
38+
if volume_type not in VOLUMES.keys():
39+
raise ValueError('Unknown volume specified: {}. Available volumes are: {}'
40+
.format(volume_type, ', '.join(VOLUMES.keys())))

0 commit comments

Comments
 (0)