Skip to main content

A simple CLI for sampling point clouds from large volumetric datasets

Project description

pypi Python Version

CLI for Distributed Point Cloud Sampling

pip install nps-cli

Get started

nps --help
Usage: nps [OPTIONS]

Options:
  --cv-path TEXT                  Path to CloudVolume data.  [required]
  --mip INTEGER                   MIP level to use.  [default: 0]
  --timestamp INTEGER             Optional timestamp for the dataset version
                                  (graphene only).
  --sample_svids                  Sample SVIDs in addition to points (default:
                                  False) Graphene only.
  -o, --output-dir DIRECTORY      Output directory.  [default: ./nps_output]
  --worker-type [LocalWorker|LSFWorker|SlurmWorker]
                                  Type of worker to use for sampling.
                                  [default: LocalWorker]
  --num-workers INTEGER           Number of workers for blockwise sampling.
                                  [default: 8]
  --cpus-per-worker INTEGER       Number of CPUs per worker.  [default: 4]
  --queue TEXT                    Queue name (for LSF backend).  [default:
                                  local]
  --fraction FLOAT                Fraction of points to sample [0.0, 1.0].
                                  [default: 0.001]
  --bbox INTEGER...               Bounding box: begin_x begin_y begin_z
                                  end_x end_y end_z (in voxels).
  --block-size INTEGER...         Block size in voxels (X Y Z).  [default:
                                  128, 128, 128]
  -h, --help                      Show this message and exit.

Example usage

nps --cv-path precomputed://gs://neuroglancer-janelia-flyem-hemibrain/v1.0/segmentation

Sample point clouds within a FlyEM Hemibrain subvolume:

nps --cv-path precomputed://gs://neuroglancer-janelia-flyem-hemibrain/v1.0/segmentation --bbox 15347 19712 18606 15859 20224 19118 --fraction 0.01

Reading Point Clouds

Please refer to the pocaduck repo on how to read point clouds from the output directory:

from pocaduck import Query

# Create a query object
query = Query(storage_config=<PATH>) # path to folder where nps output is stored

# Get all available labels
labels = query.get_labels()
print(f"Available labels: {labels}")

# Get all points for a label (aggregated across all blocks)
points = query.get_points(label=12345)
print(f"Retrieved {points.shape[0]} points for label 12345")

# Close the query connection when done
query.close()

For optimized point cloud reading, consider this.

Deploy

python -m build
twine upload dist/*

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

nps_cli-0.1.2.tar.gz (4.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

nps_cli-0.1.2-py3-none-any.whl (4.3 kB view details)

Uploaded Python 3

File details

Details for the file nps_cli-0.1.2.tar.gz.

File metadata

  • Download URL: nps_cli-0.1.2.tar.gz
  • Upload date:
  • Size: 4.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.11

File hashes

Hashes for nps_cli-0.1.2.tar.gz
Algorithm Hash digest
SHA256 9a4906f3b6c2f4dbf63f79a9302e36d7551912376d40c7e5bfdab2ad25ab8d67
MD5 75319a3c39ab1f4adffd86951ef86ef7
BLAKE2b-256 226c6ee1086d00603e170c79c2d262f92d3928180e0954cf481fb11385ed0c4b

See more details on using hashes here.

File details

Details for the file nps_cli-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: nps_cli-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 4.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.11

File hashes

Hashes for nps_cli-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 a58af092335551c9925d44367bd32b057db010a874afa451c04ad582fc746405
MD5 415f98c802a2fccc0dd7e82c4045d846
BLAKE2b-256 a09ac7e1b1f8a9bee9c6da0e30e41c88a9c0c3f494c4655cd5a875027e5b5cce

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page