Skip to content

Commit

Permalink
Multiple changes for TileDB-Viz 1.0.0 (#53)
Browse files Browse the repository at this point in the history
* sps added

* sps added
* gui removed
* pointScale removed

* updated parameters

* sps added

* sps added
* gui removed
* pointScale removed

* updated parameters

* package.json updated

* parameters removed

* Update yarn.lock

* gltf parameters updated

* updated to viz-core 0.1.2-beta.11

* readme and notebooks updated

* update to TileDB-Viz 1.0.0
  • Loading branch information
MargrietGroenendijk authored Apr 6, 2023
1 parent 91833eb commit 789cc49
Show file tree
Hide file tree
Showing 14 changed files with 825 additions and 358 deletions.
106 changes: 77 additions & 29 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,7 @@

The TileDB-PyBabylonJS library is a geospatial data visualization Python library that interactively visualizes TileDB arrays with [Babylon.js](https://www.babylonjs.com) in a Jupyter notebook widget.

The package is under development and currently contains:

* point cloud visualizations with the option to stream all data from a TileDB array or define a bounding box to load a slice of the array
* MBRS visualization showing the minimum bounding rectangles of the [fragments](https://docs.tiledb.com/main/background/key-concepts-and-data-format#fragments) in the sparse array containing point cloud data
The package is under development and currently contains point cloud visualizations with the option to stream all data from a TileDB array or define a bounding box to load a slice of the array

## Installation

Expand All @@ -30,9 +27,7 @@ jupyter nbextension enable --py [--sys-prefix|--user|--system] pybabylonjs
Create and activate a development environment:

```bash
conda install -c conda-forge mamba

mamba create -n pybabylonjs-dev -c conda-forge nodejs yarn python=3.7.10 tree scipy 'pyarrow>2' numpy pandas tiledb-py rasterio gdal pdal python-pdal jupyter-packaging jupyterlab
conda create -n pybabylonjs-dev -c conda-forge nodejs yarn python tree scipy 'pyarrow>2' numpy pandas tiledb-py jupyter-packaging jupyterlab

conda activate pybabylonjs-dev

Expand All @@ -45,7 +40,7 @@ Fork or clone the repo and go to the main directory. Install the TileDB-PyBabylo
pip install -e ".[test, examples]"
```

When developing your extensions you need to manually enable your extensions with the notebook / lab frontend. For jupyter lab this is done by the command:
When developing extensions you need to manually enable the extensions with the notebook / lab frontend. For jupyter lab this is done by the command:

```bash
jupyter labextension install @jupyter-widgets/jupyterlab-manager
Expand Down Expand Up @@ -86,15 +81,16 @@ When you make a change to the Python code rebuild the package and restart the no

## Usage

### Point clouds

Jupyter notebooks are provided in the [examples folder](https://github.com/TileDB-Inc/TileDB-PyBabylonJS/tree/main/examples) for the following visualizations:

* [Slice of the Autzen point cloud](/examples/autzen_slice.ipynb)
* [Streaming the Autzen point cloud](/examples/autzen-streaming.ipynb)
* [Slice of the Boulder point cloud](/examples/point-cloud-boulder.ipynb)
* [Point cloud visualization parameters](examples/point-cloud-parameters.ipynb) contains a description of all parameters
* [Slice of the Autzen point cloud](examples/autzen-slice.ipynb)
* [Slice of the Boulder point cloud](examples/boulder-slice.ipynb)
* [Streaming the Autzen point cloud](examples/autzen-streaming.ipynb)
* [Streaming the Bristol point cloud](examples/bristol-streaming.ipynb)
* [Streaming the Santorini point cloud](examples/santorini-streaming.ipynb)

Display a point cloud visualization from a TileDB cloud sparse array by specifying the bounding box of a slice of the data:
[Sign up for a TileDB account](https://cloud.tiledb.com/auth/signup) and display a point cloud visualization from a TileDB cloud sparse array by specifying the bounding box of a slice of data:

```python
from pybabylonjs import Show as show
Expand All @@ -109,28 +105,80 @@ lidar_array = "autzen-classified"

show.point_cloud(source="cloud",
uri = "tiledb://TileDB-Inc/autzen_classified_tiledb",
token = "***",
token=token,
bbox = bbox,
particle_size = 2.5,
width = 1000,
height = 900,
point_size = 3,
rgb_max = 65535,
camera_radius = 700)
camera_up = 25,
camera_location = 2,
camera_zoom = [2,2,2],
point_type = 'fixed_screen_size',
width=1000,
height=600)
```

Or stream all data from a group of arrays:
Or stream all data from a group of arrays:

```python
show.point_cloud(streaming=True,
uri="***",
token="***",
max_levels=6,
particle_size = 3,
color_scheme = 'light',
width = '1200px',
height = '800px',
uri="tiledb://TileDB-Inc/bristol",
token=token,
point_size = 4,
wheel_precision = 0.2,
color_scheme = 'dark',
width = 1200,
height = 800,
rgb_max = 255,
camera_radius = 800,
particle_budget = 8000000)
point_budget = 3500000,
camera_location = 8,
camera_zoom = [1, 1, 2],
camera_up = 50,
move_speed = 8,
point_type = 'fixed_world_size')
```

### Parameters

The following parameters can be set for a point cloud visualization:

* `camera_location` is the location of the arcRotateCamera in relation to the centre of the point cloud. 1: south, 2: south-east, 3: east, 4: north-east, 5: north, 6: north-west, 7: west, 8: south-west and 9: looking down from above the centre of the point cloud
* `camera_up` is the height of the initial location of the freeCamera
* `camera_zoom` scales the camera position relative to the centre of the point cloud with `[1,1,1]` being in the default position and `[2,2,2]` is then twice a far away from the centre in the X, Y and Z direction
* `color_scheme` is the initial background color: `dark` (default), `light` or ` blue`
* `data` is the dictionary with the point cloud data when `source = dict`. This dictionary needs to contain values for the location `X`, `Y` and `Z` and the RGB color for each point `Red`, `Green` and `Blue`
* `height` is the height of the display window in pixels
* `point_size` is the size of the points
* `point_type` is the interactive point size type
* `fixed_screen_size` (default): each point has a constant size in pixels regardless of its distance to the camera
* `fixed_world_space`: each point has a constant size in world space. This value should be set accordingly to the spacing of the points in world space
* `adaptive_world_space`: the same as `fixed_world_space` for the below example. But when streaming point cloud data, the point size depends on the locally loaded LODs at each point. The point density across all blocks of the same LOD should be the same and the point density should double at each LOD
* `source` is the data source (`cloud` (default), `local` or `dict`)
* `use_sps=True` displays the points as 3D blocks using a [Solid Particle System](https://doc.babylonjs.com/features/featuresDeepDive/particles/solid_particle_system/sps_intro)
* `use_shader=True` adds the EDL shading
* `edl_strength` is the strenght of the shader
* `wheel_precision` gives control over how fast to zoom with the mouse wheel
* `width` is the width of the display window in pixels

### Navigating the point cloud

There are two different cameras available to navigate the point cloud, the arcRotateCamera and freeCamera. Toggle between them with `c`. The initial camera is always the arcRotateCamera

**arcRotateCamera**
* Zoom in and out with the scroll wheel
* Rotate by dragging the mouse with left button down
* The parameter `wheel_precision` gives control over how fast to zoom with the mouse wheel
* The camera location and distance from the centre of the points can be changed with `camera_location` and `camera_zoom`
* Rotate through the `camera_locations` with `v`
* Change the background color between dark and light with `b`

**freeCamera**
* Move forward: `w` or `up`
* Move backward: `s` or `down`
* Move up: `e`
* Move down: `q`
* Move to the left: `a` or `left`
* Move to the right: `d` or `right`
* Rotate by dragging the mouse with left button down
* The initial camera position is the centre of the point cloud, the height of the location can be changed with the parameter `camera_up`
* The camera speed can be changed with the parameter `move_speed`
* Change the background color between dark and light with `b`
Loading

0 comments on commit 789cc49

Please sign in to comment.