Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generate neuroglancer compatible 3D pyramids #18

Merged
merged 13 commits into from
Oct 10, 2024
45 changes: 43 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@ python setup.py install

## Usage

Argolid can generate Pyramids from a single image or an image collection with a stitching vector provided. It can generate three different kind of pyramids:
### PyramidGenerator

Argolid can generate 2D Pyramids from a single image or an image collection with a stitching vector provided. It can generate three different kind of pyramids:
- Neuroglancer compatible Zarr (NG_Zarr)
- Precomputed Neuroglancer (PCNG)
- Viv compatible Zarr (Viv)
Expand All @@ -43,7 +45,6 @@ output_dir = "/home/samee/axle/data/test_image_ome_zarr"
min_dim = 1024
pyr_gen = PyramidGenerartor()
pyr_gen.generate_from_single_image(input_file, output_dir, min_dim, "NG_Zarr", {0:"mode_max"})
```

Here is an example of generating a pyramid from a collection of images and a stitching vector.
```
Expand All @@ -56,4 +57,44 @@ min_dim = 1024
pyr_gen = PyramidGenerartor()
pyr_gen.generate_from_image_collection(input_dir, file_pattern, image_name,
output_dir, min_dim, "Viv", {1:"mean"})



Argolid provides two main classes for working with volumetric data and generating multi-resolution pyramids:

### VolumeGenerator

The `VolumeGenerator` class is used to create Zarr arrays from image stacks. It handles reading image files, grouping them based on specified criteria, and writing the data into a Zarr array.

Here's an example of how to use `VolumeGenerator`:

```
from argolid import VolumeGenerator

source_dir = "/path/to/image/files"
group_by = "z" # Group images by z-axis
file_pattern = "image_{z:d}.tif"
out_dir = "/path/to/output"
image_name = "my_volume"

volume_gen = VolumeGenerator(source_dir, group_by, file_pattern, out_dir, image_name)
volume_gen.generate_volume()
```



### PyramidGenerator3D

Here is an example of generating a 3D pyramid from a Zarr array:


```
from argolid import PyramidGenerator3D

zarr_loc_dir = "/path/to/zarr/array"
base_scale_key = 0
num_levels = 5

pyramid_gen = PyramidGenerator3D(zarr_loc_dir, base_scale_key)
pyramid_gen.generate_pyramid(num_levels)
```
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ def build_extension(self, ext):
package_dir={"": "src/python"},
ext_modules=[CMakeExtension("argolid/libargolid")],
test_suite="tests",
install_requires=["pydantic"],
install_requires=["pydantic", "filepattern", "tensorstore", "bfio"],
zip_safe=False,
python_requires=">=3.8",
)
5 changes: 4 additions & 1 deletion src/python/argolid/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
from .pyramid_generator import PyramidGenerartor, PyramidView, PlateVisualizationMetadata, Downsample
from .pyramid_compositor import PyramidCompositor
from .volume_generator import VolumeGenerator, PyramidGenerator3D

from . import _version
__version__ = _version.get_versions()['version']

__version__ = _version.get_versions()["version"]
Loading
Loading