nps-cli 0.1.0__tar.gz → 0.1.2__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.
@@ -1,10 +1,10 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: nps-cli
3
- Version: 0.1.0
3
+ Version: 0.1.2
4
4
  Summary: A simple CLI for sampling point clouds from large volumetric datasets
5
5
  Author: Jakob Troidl
6
6
  License-Expression: MIT
7
- Classifier: Programming Language :: Python :: 3
7
+ Classifier: Programming Language :: Python :: 3.11
8
8
  Requires-Python: >=3.11
9
9
  Description-Content-Type: text/markdown
10
10
  Requires-Dist: click
@@ -17,16 +17,18 @@ Requires-Dist: build; extra == "dev"
17
17
  Requires-Dist: twine; extra == "dev"
18
18
  Requires-Dist: ruff; extra == "dev"
19
19
 
20
- # CLI for Point Cloud Sampling
20
+ [![pypi](https://badge.fury.io/py/nps-cli.svg)](https://badge.fury.io/py/nps-cli)
21
+ [![Python Version](https://img.shields.io/pypi/pyversions/nps-cli.svg)](https://pypi.org/project/nps-cli/)
22
+
23
+ # CLI for Distributed Point Cloud Sampling
21
24
 
22
25
  ```
23
- pip install nps
26
+ pip install nps-cli
24
27
  ````
25
28
  ### Get started
26
29
 
27
-
28
30
  ```zsh
29
- (nps-v2) ➜ nps git:(main) ✗ nps --help
31
+ nps --help
30
32
  Usage: nps [OPTIONS]
31
33
 
32
34
  Options:
@@ -35,7 +37,7 @@ Options:
35
37
  --timestamp INTEGER Optional timestamp for the dataset version
36
38
  (graphene only).
37
39
  --sample_svids Sample SVIDs in addition to points (default:
38
- False).
40
+ False) Graphene only.
39
41
  -o, --output-dir DIRECTORY Output directory. [default: ./nps_output]
40
42
  --worker-type [LocalWorker|LSFWorker|SlurmWorker]
41
43
  Type of worker to use for sampling.
@@ -47,11 +49,52 @@ Options:
47
49
  local]
48
50
  --fraction FLOAT Fraction of points to sample [0.0, 1.0].
49
51
  [default: 0.001]
52
+ --bbox INTEGER... Bounding box: begin_x begin_y begin_z
53
+ end_x end_y end_z (in voxels).
50
54
  --block-size INTEGER... Block size in voxels (X Y Z). [default:
51
55
  128, 128, 128]
52
56
  -h, --help Show this message and exit.
53
57
  ```
54
58
 
59
+ ### Example usage
60
+
55
61
  ```bash
56
62
  nps --cv-path precomputed://gs://neuroglancer-janelia-flyem-hemibrain/v1.0/segmentation
57
63
  ```
64
+
65
+ Sample point clouds within a FlyEM Hemibrain subvolume:
66
+
67
+ ```bash
68
+ nps --cv-path precomputed://gs://neuroglancer-janelia-flyem-hemibrain/v1.0/segmentation --bbox 15347 19712 18606 15859 20224 19118 --fraction 0.01
69
+ ```
70
+
71
+ ### Reading Point Clouds
72
+
73
+ Please refer to the [pocaduck](https://github.com/JaneliaSciComp/pocaduck?tab=readme-ov-file#querying-point-clouds) repo on how to read point clouds from the output directory:
74
+
75
+ ```python
76
+ from pocaduck import Query
77
+
78
+ # Create a query object
79
+ query = Query(storage_config=<PATH>) # path to folder where nps output is stored
80
+
81
+ # Get all available labels
82
+ labels = query.get_labels()
83
+ print(f"Available labels: {labels}")
84
+
85
+ # Get all points for a label (aggregated across all blocks)
86
+ points = query.get_points(label=12345)
87
+ print(f"Retrieved {points.shape[0]} points for label 12345")
88
+
89
+ # Close the query connection when done
90
+ query.close()
91
+ ```
92
+
93
+ For optimized point cloud reading, consider [this](https://github.com/JaneliaSciComp/pocaduck?tab=readme-ov-file#running-the-optimization-pipeline).
94
+
95
+
96
+ ### Deploy
97
+ ```python
98
+ python -m build
99
+ twine upload dist/*
100
+ ```
@@ -0,0 +1,81 @@
1
+ [![pypi](https://badge.fury.io/py/nps-cli.svg)](https://badge.fury.io/py/nps-cli)
2
+ [![Python Version](https://img.shields.io/pypi/pyversions/nps-cli.svg)](https://pypi.org/project/nps-cli/)
3
+
4
+ # CLI for Distributed Point Cloud Sampling
5
+
6
+ ```
7
+ pip install nps-cli
8
+ ````
9
+ ### Get started
10
+
11
+ ```zsh
12
+ nps --help
13
+ Usage: nps [OPTIONS]
14
+
15
+ Options:
16
+ --cv-path TEXT Path to CloudVolume data. [required]
17
+ --mip INTEGER MIP level to use. [default: 0]
18
+ --timestamp INTEGER Optional timestamp for the dataset version
19
+ (graphene only).
20
+ --sample_svids Sample SVIDs in addition to points (default:
21
+ False) Graphene only.
22
+ -o, --output-dir DIRECTORY Output directory. [default: ./nps_output]
23
+ --worker-type [LocalWorker|LSFWorker|SlurmWorker]
24
+ Type of worker to use for sampling.
25
+ [default: LocalWorker]
26
+ --num-workers INTEGER Number of workers for blockwise sampling.
27
+ [default: 8]
28
+ --cpus-per-worker INTEGER Number of CPUs per worker. [default: 4]
29
+ --queue TEXT Queue name (for LSF backend). [default:
30
+ local]
31
+ --fraction FLOAT Fraction of points to sample [0.0, 1.0].
32
+ [default: 0.001]
33
+ --bbox INTEGER... Bounding box: begin_x begin_y begin_z
34
+ end_x end_y end_z (in voxels).
35
+ --block-size INTEGER... Block size in voxels (X Y Z). [default:
36
+ 128, 128, 128]
37
+ -h, --help Show this message and exit.
38
+ ```
39
+
40
+ ### Example usage
41
+
42
+ ```bash
43
+ nps --cv-path precomputed://gs://neuroglancer-janelia-flyem-hemibrain/v1.0/segmentation
44
+ ```
45
+
46
+ Sample point clouds within a FlyEM Hemibrain subvolume:
47
+
48
+ ```bash
49
+ nps --cv-path precomputed://gs://neuroglancer-janelia-flyem-hemibrain/v1.0/segmentation --bbox 15347 19712 18606 15859 20224 19118 --fraction 0.01
50
+ ```
51
+
52
+ ### Reading Point Clouds
53
+
54
+ Please refer to the [pocaduck](https://github.com/JaneliaSciComp/pocaduck?tab=readme-ov-file#querying-point-clouds) repo on how to read point clouds from the output directory:
55
+
56
+ ```python
57
+ from pocaduck import Query
58
+
59
+ # Create a query object
60
+ query = Query(storage_config=<PATH>) # path to folder where nps output is stored
61
+
62
+ # Get all available labels
63
+ labels = query.get_labels()
64
+ print(f"Available labels: {labels}")
65
+
66
+ # Get all points for a label (aggregated across all blocks)
67
+ points = query.get_points(label=12345)
68
+ print(f"Retrieved {points.shape[0]} points for label 12345")
69
+
70
+ # Close the query connection when done
71
+ query.close()
72
+ ```
73
+
74
+ For optimized point cloud reading, consider [this](https://github.com/JaneliaSciComp/pocaduck?tab=readme-ov-file#running-the-optimization-pipeline).
75
+
76
+
77
+ ### Deploy
78
+ ```python
79
+ python -m build
80
+ twine upload dist/*
81
+ ```
@@ -19,7 +19,8 @@ from volara.workers import LSFWorker, LocalWorker, SlurmWorker
19
19
  @click.option('--queue', default='local', show_default=True, help='Queue name (for LSF backend).')
20
20
  @click.option('--fraction', default=0.001, show_default=True, type=float, help='Fraction of points to sample [0.0, 1.0].')
21
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):
22
+ @click.option('--bbox', nargs=6, type=int, default=None, help='Bounding box: begin_x begin_y begin_z end_x end_y end_z (in voxels).')
23
+ def main(cv_path, mip, timestamp, output_dir, num_workers, cpus_per_worker, queue, fraction, block_size, sample_svids, worker_type, bbox):
23
24
 
24
25
  click.echo(f"Reading CloudVolume at {cv_path} (mip={mip}, timestamp={timestamp})")
25
26
 
@@ -34,8 +35,9 @@ def main(cv_path, mip, timestamp, output_dir, num_workers, cpus_per_worker, queu
34
35
  click.echo("Sampling points only (no SVIDs)...")
35
36
  svids = None
36
37
 
37
- if not os.path.exists(output_dir):
38
- os.makedirs(output_dir)
38
+ points_dir = os.path.join(output_dir, 'points')
39
+ if not os.path.exists(points_dir):
40
+ os.makedirs(points_dir)
39
41
 
40
42
  if worker_type == 'LocalWorker':
41
43
  click.echo("Using LocalWorker for sampling.")
@@ -47,14 +49,22 @@ def main(cv_path, mip, timestamp, output_dir, num_workers, cpus_per_worker, queu
47
49
  click.echo(f"Using SlurmWorker with queue '{queue}' and {cpus_per_worker} CPUs per worker.")
48
50
  worker_config = SlurmWorker(queue=queue, num_cpus=cpus_per_worker)
49
51
 
52
+ roi = None
53
+ if bbox is not None:
54
+ begin = bbox[:3]
55
+ end = bbox[3:]
56
+ shape = tuple(e - b for b, e in zip(begin, end))
57
+ roi = (begin, shape)
58
+
50
59
  task = SamplePoints(
51
60
  labels=labels,
52
61
  svids=svids,
53
62
  block_size=np.array(block_size),
54
63
  num_workers=num_workers,
55
- out_dir=output_dir,
64
+ out_dir=points_dir,
56
65
  fraction=fraction,
57
- worker_config=worker_config
66
+ worker_config=worker_config,
67
+ roi=roi,
58
68
  )
59
69
 
60
70
  click.echo("Running task...")
@@ -1,10 +1,10 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: nps-cli
3
- Version: 0.1.0
3
+ Version: 0.1.2
4
4
  Summary: A simple CLI for sampling point clouds from large volumetric datasets
5
5
  Author: Jakob Troidl
6
6
  License-Expression: MIT
7
- Classifier: Programming Language :: Python :: 3
7
+ Classifier: Programming Language :: Python :: 3.11
8
8
  Requires-Python: >=3.11
9
9
  Description-Content-Type: text/markdown
10
10
  Requires-Dist: click
@@ -17,16 +17,18 @@ Requires-Dist: build; extra == "dev"
17
17
  Requires-Dist: twine; extra == "dev"
18
18
  Requires-Dist: ruff; extra == "dev"
19
19
 
20
- # CLI for Point Cloud Sampling
20
+ [![pypi](https://badge.fury.io/py/nps-cli.svg)](https://badge.fury.io/py/nps-cli)
21
+ [![Python Version](https://img.shields.io/pypi/pyversions/nps-cli.svg)](https://pypi.org/project/nps-cli/)
22
+
23
+ # CLI for Distributed Point Cloud Sampling
21
24
 
22
25
  ```
23
- pip install nps
26
+ pip install nps-cli
24
27
  ````
25
28
  ### Get started
26
29
 
27
-
28
30
  ```zsh
29
- (nps-v2) ➜ nps git:(main) ✗ nps --help
31
+ nps --help
30
32
  Usage: nps [OPTIONS]
31
33
 
32
34
  Options:
@@ -35,7 +37,7 @@ Options:
35
37
  --timestamp INTEGER Optional timestamp for the dataset version
36
38
  (graphene only).
37
39
  --sample_svids Sample SVIDs in addition to points (default:
38
- False).
40
+ False) Graphene only.
39
41
  -o, --output-dir DIRECTORY Output directory. [default: ./nps_output]
40
42
  --worker-type [LocalWorker|LSFWorker|SlurmWorker]
41
43
  Type of worker to use for sampling.
@@ -47,11 +49,52 @@ Options:
47
49
  local]
48
50
  --fraction FLOAT Fraction of points to sample [0.0, 1.0].
49
51
  [default: 0.001]
52
+ --bbox INTEGER... Bounding box: begin_x begin_y begin_z
53
+ end_x end_y end_z (in voxels).
50
54
  --block-size INTEGER... Block size in voxels (X Y Z). [default:
51
55
  128, 128, 128]
52
56
  -h, --help Show this message and exit.
53
57
  ```
54
58
 
59
+ ### Example usage
60
+
55
61
  ```bash
56
62
  nps --cv-path precomputed://gs://neuroglancer-janelia-flyem-hemibrain/v1.0/segmentation
57
63
  ```
64
+
65
+ Sample point clouds within a FlyEM Hemibrain subvolume:
66
+
67
+ ```bash
68
+ nps --cv-path precomputed://gs://neuroglancer-janelia-flyem-hemibrain/v1.0/segmentation --bbox 15347 19712 18606 15859 20224 19118 --fraction 0.01
69
+ ```
70
+
71
+ ### Reading Point Clouds
72
+
73
+ Please refer to the [pocaduck](https://github.com/JaneliaSciComp/pocaduck?tab=readme-ov-file#querying-point-clouds) repo on how to read point clouds from the output directory:
74
+
75
+ ```python
76
+ from pocaduck import Query
77
+
78
+ # Create a query object
79
+ query = Query(storage_config=<PATH>) # path to folder where nps output is stored
80
+
81
+ # Get all available labels
82
+ labels = query.get_labels()
83
+ print(f"Available labels: {labels}")
84
+
85
+ # Get all points for a label (aggregated across all blocks)
86
+ points = query.get_points(label=12345)
87
+ print(f"Retrieved {points.shape[0]} points for label 12345")
88
+
89
+ # Close the query connection when done
90
+ query.close()
91
+ ```
92
+
93
+ For optimized point cloud reading, consider [this](https://github.com/JaneliaSciComp/pocaduck?tab=readme-ov-file#running-the-optimization-pipeline).
94
+
95
+
96
+ ### Deploy
97
+ ```python
98
+ python -m build
99
+ twine upload dist/*
100
+ ```
@@ -1,7 +1,6 @@
1
1
  README.md
2
2
  pyproject.toml
3
3
  nps/__init__.py
4
- nps/config.py
5
4
  nps/main.py
6
5
  nps_cli.egg-info/PKG-INFO
7
6
  nps_cli.egg-info/SOURCES.txt
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "nps-cli"
7
- version = "0.1.0"
7
+ version = "0.1.2"
8
8
  description = "A simple CLI for sampling point clouds from large volumetric datasets"
9
9
  readme = { file = "README.md", content-type = "text/markdown" }
10
10
  requires-python = ">=3.11"
@@ -17,7 +17,7 @@ dependencies = [
17
17
  ]
18
18
 
19
19
  classifiers = [
20
- "Programming Language :: Python :: 3",
20
+ "Programming Language :: Python :: 3.11",
21
21
  ]
22
22
 
23
23
  [project.optional-dependencies]
nps_cli-0.1.0/README.md DELETED
@@ -1,38 +0,0 @@
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
- ```
@@ -1,5 +0,0 @@
1
- import yaml
2
-
3
- def load_config(path):
4
- with open(path, 'r') as f:
5
- return yaml.safe_load(f)
File without changes
File without changes