nps-cli 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- nps_cli-0.1.0/PKG-INFO +57 -0
- nps_cli-0.1.0/README.md +38 -0
- nps_cli-0.1.0/nps/__init__.py +0 -0
- nps_cli-0.1.0/nps/config.py +5 -0
- nps_cli-0.1.0/nps/main.py +67 -0
- nps_cli-0.1.0/nps_cli.egg-info/PKG-INFO +57 -0
- nps_cli-0.1.0/nps_cli.egg-info/SOURCES.txt +11 -0
- nps_cli-0.1.0/nps_cli.egg-info/dependency_links.txt +1 -0
- nps_cli-0.1.0/nps_cli.egg-info/entry_points.txt +5 -0
- nps_cli-0.1.0/nps_cli.egg-info/requires.txt +10 -0
- nps_cli-0.1.0/nps_cli.egg-info/top_level.txt +1 -0
- nps_cli-0.1.0/pyproject.toml +44 -0
- nps_cli-0.1.0/setup.cfg +4 -0
nps_cli-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: nps-cli
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: A simple CLI for sampling point clouds from large volumetric datasets
|
|
5
|
+
Author: Jakob Troidl
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Classifier: Programming Language :: Python :: 3
|
|
8
|
+
Requires-Python: >=3.11
|
|
9
|
+
Description-Content-Type: text/markdown
|
|
10
|
+
Requires-Dist: click
|
|
11
|
+
Requires-Dist: volara
|
|
12
|
+
Requires-Dist: pocaduck
|
|
13
|
+
Provides-Extra: dev
|
|
14
|
+
Requires-Dist: pytest; extra == "dev"
|
|
15
|
+
Requires-Dist: black; extra == "dev"
|
|
16
|
+
Requires-Dist: build; extra == "dev"
|
|
17
|
+
Requires-Dist: twine; extra == "dev"
|
|
18
|
+
Requires-Dist: ruff; extra == "dev"
|
|
19
|
+
|
|
20
|
+
# CLI for Point Cloud Sampling
|
|
21
|
+
|
|
22
|
+
```
|
|
23
|
+
pip install nps
|
|
24
|
+
````
|
|
25
|
+
### Get started
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
```zsh
|
|
29
|
+
(nps-v2) ➜ nps git:(main) ✗ nps --help
|
|
30
|
+
Usage: nps [OPTIONS]
|
|
31
|
+
|
|
32
|
+
Options:
|
|
33
|
+
--cv-path TEXT Path to CloudVolume data. [required]
|
|
34
|
+
--mip INTEGER MIP level to use. [default: 0]
|
|
35
|
+
--timestamp INTEGER Optional timestamp for the dataset version
|
|
36
|
+
(graphene only).
|
|
37
|
+
--sample_svids Sample SVIDs in addition to points (default:
|
|
38
|
+
False).
|
|
39
|
+
-o, --output-dir DIRECTORY Output directory. [default: ./nps_output]
|
|
40
|
+
--worker-type [LocalWorker|LSFWorker|SlurmWorker]
|
|
41
|
+
Type of worker to use for sampling.
|
|
42
|
+
[default: LocalWorker]
|
|
43
|
+
--num-workers INTEGER Number of workers for blockwise sampling.
|
|
44
|
+
[default: 8]
|
|
45
|
+
--cpus-per-worker INTEGER Number of CPUs per worker. [default: 4]
|
|
46
|
+
--queue TEXT Queue name (for LSF backend). [default:
|
|
47
|
+
local]
|
|
48
|
+
--fraction FLOAT Fraction of points to sample [0.0, 1.0].
|
|
49
|
+
[default: 0.001]
|
|
50
|
+
--block-size INTEGER... Block size in voxels (X Y Z). [default:
|
|
51
|
+
128, 128, 128]
|
|
52
|
+
-h, --help Show this message and exit.
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
```bash
|
|
56
|
+
nps --cv-path precomputed://gs://neuroglancer-janelia-flyem-hemibrain/v1.0/segmentation
|
|
57
|
+
```
|
nps_cli-0.1.0/README.md
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
# CLI for Point Cloud Sampling
|
|
2
|
+
|
|
3
|
+
```
|
|
4
|
+
pip install nps
|
|
5
|
+
````
|
|
6
|
+
### Get started
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
```zsh
|
|
10
|
+
(nps-v2) ➜ nps git:(main) ✗ nps --help
|
|
11
|
+
Usage: nps [OPTIONS]
|
|
12
|
+
|
|
13
|
+
Options:
|
|
14
|
+
--cv-path TEXT Path to CloudVolume data. [required]
|
|
15
|
+
--mip INTEGER MIP level to use. [default: 0]
|
|
16
|
+
--timestamp INTEGER Optional timestamp for the dataset version
|
|
17
|
+
(graphene only).
|
|
18
|
+
--sample_svids Sample SVIDs in addition to points (default:
|
|
19
|
+
False).
|
|
20
|
+
-o, --output-dir DIRECTORY Output directory. [default: ./nps_output]
|
|
21
|
+
--worker-type [LocalWorker|LSFWorker|SlurmWorker]
|
|
22
|
+
Type of worker to use for sampling.
|
|
23
|
+
[default: LocalWorker]
|
|
24
|
+
--num-workers INTEGER Number of workers for blockwise sampling.
|
|
25
|
+
[default: 8]
|
|
26
|
+
--cpus-per-worker INTEGER Number of CPUs per worker. [default: 4]
|
|
27
|
+
--queue TEXT Queue name (for LSF backend). [default:
|
|
28
|
+
local]
|
|
29
|
+
--fraction FLOAT Fraction of points to sample [0.0, 1.0].
|
|
30
|
+
[default: 0.001]
|
|
31
|
+
--block-size INTEGER... Block size in voxels (X Y Z). [default:
|
|
32
|
+
128, 128, 128]
|
|
33
|
+
-h, --help Show this message and exit.
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
nps --cv-path precomputed://gs://neuroglancer-janelia-flyem-hemibrain/v1.0/segmentation
|
|
38
|
+
```
|
|
File without changes
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import os
|
|
2
|
+
import numpy as np
|
|
3
|
+
import click
|
|
4
|
+
import time
|
|
5
|
+
|
|
6
|
+
from nps.blockwise.sample_points import SamplePoints
|
|
7
|
+
from volara.datasets import CloudVolumeWrapper
|
|
8
|
+
from volara.workers import LSFWorker, LocalWorker, SlurmWorker
|
|
9
|
+
|
|
10
|
+
@click.command(context_settings=dict(help_option_names=['-h', '--help']))
|
|
11
|
+
@click.option('--cv-path', required=True, help='Path to CloudVolume data.')
|
|
12
|
+
@click.option('--mip', default=0, type=int, show_default=True, help='MIP level to use.')
|
|
13
|
+
@click.option('--timestamp', default=int(time.time()), help='Optional timestamp for the dataset version (graphene only).')
|
|
14
|
+
@click.option('--sample_svids', is_flag=True, default=False, help='Sample SVIDs in addition to points (default: False).')
|
|
15
|
+
@click.option('--output-dir', '-o', default='./nps_output', show_default=True, type=click.Path(file_okay=False, writable=True), help='Output directory.')
|
|
16
|
+
@click.option('--worker-type', default='LocalWorker', show_default=True, type=click.Choice(['LocalWorker', 'LSFWorker', 'SlurmWorker'], case_sensitive=True), help='Type of worker to use for sampling.')
|
|
17
|
+
@click.option('--num-workers', default=8, show_default=True, type=int, help='Number of workers for blockwise sampling.')
|
|
18
|
+
@click.option('--cpus-per-worker', default=4, show_default=True, type=int, help='Number of CPUs per worker.')
|
|
19
|
+
@click.option('--queue', default='local', show_default=True, help='Queue name (for LSF backend).')
|
|
20
|
+
@click.option('--fraction', default=0.001, show_default=True, type=float, help='Fraction of points to sample [0.0, 1.0].')
|
|
21
|
+
@click.option('--block-size', nargs=3, type=int, default=(128, 128, 128), show_default=True, help='Block size in voxels (X Y Z).')
|
|
22
|
+
def main(cv_path, mip, timestamp, output_dir, num_workers, cpus_per_worker, queue, fraction, block_size, sample_svids, worker_type):
|
|
23
|
+
|
|
24
|
+
click.echo(f"Reading CloudVolume at {cv_path} (mip={mip}, timestamp={timestamp})")
|
|
25
|
+
|
|
26
|
+
labels_name = os.path.dirname(output_dir) + "_labels"
|
|
27
|
+
labels = CloudVolumeWrapper(data_name=labels_name, store=cv_path, mip=mip, timestamp=timestamp)
|
|
28
|
+
|
|
29
|
+
if sample_svids:
|
|
30
|
+
click.echo("Sampling SVIDs in addition to points...")
|
|
31
|
+
svids_name = os.path.dirname(output_dir) + "_svids"
|
|
32
|
+
svids = CloudVolumeWrapper(data_name=svids_name, store=cv_path, mip=mip, timestamp=timestamp, agglomerate=False)
|
|
33
|
+
else:
|
|
34
|
+
click.echo("Sampling points only (no SVIDs)...")
|
|
35
|
+
svids = None
|
|
36
|
+
|
|
37
|
+
if not os.path.exists(output_dir):
|
|
38
|
+
os.makedirs(output_dir)
|
|
39
|
+
|
|
40
|
+
if worker_type == 'LocalWorker':
|
|
41
|
+
click.echo("Using LocalWorker for sampling.")
|
|
42
|
+
worker_config = LocalWorker()
|
|
43
|
+
elif worker_type == 'LSFWorker':
|
|
44
|
+
click.echo(f"Using LSFWorker with queue '{queue}' and {cpus_per_worker} CPUs per worker.")
|
|
45
|
+
worker_config = LSFWorker(queue=queue, num_cpus=cpus_per_worker)
|
|
46
|
+
elif worker_type == 'SlurmWorker':
|
|
47
|
+
click.echo(f"Using SlurmWorker with queue '{queue}' and {cpus_per_worker} CPUs per worker.")
|
|
48
|
+
worker_config = SlurmWorker(queue=queue, num_cpus=cpus_per_worker)
|
|
49
|
+
|
|
50
|
+
task = SamplePoints(
|
|
51
|
+
labels=labels,
|
|
52
|
+
svids=svids,
|
|
53
|
+
block_size=np.array(block_size),
|
|
54
|
+
num_workers=num_workers,
|
|
55
|
+
out_dir=output_dir,
|
|
56
|
+
fraction=fraction,
|
|
57
|
+
worker_config=worker_config
|
|
58
|
+
)
|
|
59
|
+
|
|
60
|
+
click.echo("Running task...")
|
|
61
|
+
task.drop()
|
|
62
|
+
task.run_blockwise(multiprocessing=True)
|
|
63
|
+
click.secho("✅ Done!", fg='green')
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
if __name__ == "__main__":
|
|
67
|
+
main()
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: nps-cli
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: A simple CLI for sampling point clouds from large volumetric datasets
|
|
5
|
+
Author: Jakob Troidl
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Classifier: Programming Language :: Python :: 3
|
|
8
|
+
Requires-Python: >=3.11
|
|
9
|
+
Description-Content-Type: text/markdown
|
|
10
|
+
Requires-Dist: click
|
|
11
|
+
Requires-Dist: volara
|
|
12
|
+
Requires-Dist: pocaduck
|
|
13
|
+
Provides-Extra: dev
|
|
14
|
+
Requires-Dist: pytest; extra == "dev"
|
|
15
|
+
Requires-Dist: black; extra == "dev"
|
|
16
|
+
Requires-Dist: build; extra == "dev"
|
|
17
|
+
Requires-Dist: twine; extra == "dev"
|
|
18
|
+
Requires-Dist: ruff; extra == "dev"
|
|
19
|
+
|
|
20
|
+
# CLI for Point Cloud Sampling
|
|
21
|
+
|
|
22
|
+
```
|
|
23
|
+
pip install nps
|
|
24
|
+
````
|
|
25
|
+
### Get started
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
```zsh
|
|
29
|
+
(nps-v2) ➜ nps git:(main) ✗ nps --help
|
|
30
|
+
Usage: nps [OPTIONS]
|
|
31
|
+
|
|
32
|
+
Options:
|
|
33
|
+
--cv-path TEXT Path to CloudVolume data. [required]
|
|
34
|
+
--mip INTEGER MIP level to use. [default: 0]
|
|
35
|
+
--timestamp INTEGER Optional timestamp for the dataset version
|
|
36
|
+
(graphene only).
|
|
37
|
+
--sample_svids Sample SVIDs in addition to points (default:
|
|
38
|
+
False).
|
|
39
|
+
-o, --output-dir DIRECTORY Output directory. [default: ./nps_output]
|
|
40
|
+
--worker-type [LocalWorker|LSFWorker|SlurmWorker]
|
|
41
|
+
Type of worker to use for sampling.
|
|
42
|
+
[default: LocalWorker]
|
|
43
|
+
--num-workers INTEGER Number of workers for blockwise sampling.
|
|
44
|
+
[default: 8]
|
|
45
|
+
--cpus-per-worker INTEGER Number of CPUs per worker. [default: 4]
|
|
46
|
+
--queue TEXT Queue name (for LSF backend). [default:
|
|
47
|
+
local]
|
|
48
|
+
--fraction FLOAT Fraction of points to sample [0.0, 1.0].
|
|
49
|
+
[default: 0.001]
|
|
50
|
+
--block-size INTEGER... Block size in voxels (X Y Z). [default:
|
|
51
|
+
128, 128, 128]
|
|
52
|
+
-h, --help Show this message and exit.
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
```bash
|
|
56
|
+
nps --cv-path precomputed://gs://neuroglancer-janelia-flyem-hemibrain/v1.0/segmentation
|
|
57
|
+
```
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
README.md
|
|
2
|
+
pyproject.toml
|
|
3
|
+
nps/__init__.py
|
|
4
|
+
nps/config.py
|
|
5
|
+
nps/main.py
|
|
6
|
+
nps_cli.egg-info/PKG-INFO
|
|
7
|
+
nps_cli.egg-info/SOURCES.txt
|
|
8
|
+
nps_cli.egg-info/dependency_links.txt
|
|
9
|
+
nps_cli.egg-info/entry_points.txt
|
|
10
|
+
nps_cli.egg-info/requires.txt
|
|
11
|
+
nps_cli.egg-info/top_level.txt
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
nps
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=61.0"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "nps-cli"
|
|
7
|
+
version = "0.1.0"
|
|
8
|
+
description = "A simple CLI for sampling point clouds from large volumetric datasets"
|
|
9
|
+
readme = { file = "README.md", content-type = "text/markdown" }
|
|
10
|
+
requires-python = ">=3.11"
|
|
11
|
+
license = "MIT"
|
|
12
|
+
authors = [{ name = "Jakob Troidl" }]
|
|
13
|
+
dependencies = [
|
|
14
|
+
"click",
|
|
15
|
+
"volara",
|
|
16
|
+
"pocaduck",
|
|
17
|
+
]
|
|
18
|
+
|
|
19
|
+
classifiers = [
|
|
20
|
+
"Programming Language :: Python :: 3",
|
|
21
|
+
]
|
|
22
|
+
|
|
23
|
+
[project.optional-dependencies]
|
|
24
|
+
dev = [
|
|
25
|
+
"pytest",
|
|
26
|
+
"black",
|
|
27
|
+
"build",
|
|
28
|
+
"twine",
|
|
29
|
+
"ruff"
|
|
30
|
+
]
|
|
31
|
+
|
|
32
|
+
[project.entry-points."volara.blockwise_tasks"]
|
|
33
|
+
sample-points = "nps.blockwise:SamplePoints"
|
|
34
|
+
|
|
35
|
+
[project.scripts]
|
|
36
|
+
nps = "nps.main:main"
|
|
37
|
+
|
|
38
|
+
[tool.setuptools.packages.find]
|
|
39
|
+
include = ["nps"]
|
|
40
|
+
|
|
41
|
+
[tool.ruff]
|
|
42
|
+
exclude = ["dist", "build", "nps.egg-info", "volara_logs", "nps_output"]
|
|
43
|
+
line-length = 88
|
|
44
|
+
target-version = "py311"
|
nps_cli-0.1.0/setup.cfg
ADDED