Skip to content

Commit bc361fa

Browse files
authored
Merge pull request #24 from AllenNeuralDynamics/docs-readme
improving readme, adding folder structure, env variables and executio…
2 parents 7965865 + 9dd3fcc commit bc361fa

1 file changed

Lines changed: 101 additions & 8 deletions

File tree

README.md

Lines changed: 101 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,24 +9,117 @@
99

1010

1111

12-
## Usage
13-
- To use this template, click the green `Use this template` button and `Create new repository`.
14-
- After github initially creates the new repository, please wait an extra minute for the initialization scripts to finish organizing the repo.
15-
- To enable the automatic semantic version increments: in the repository go to `Settings` and `Collaborators and teams`. Click the green `Add people` button. Add `svc-aindscicomp` as an admin. Modify the file in `.github/workflows/tag_and_publish.yml` and remove the if statement in line 10. The semantic version will now be incremented every time a code is committed into the main branch.
16-
- To publish to PyPI, enable semantic versioning and uncomment the publish block in `.github/workflows/tag_and_publish.yml`. The code will now be published to PyPI every time the code is committed into the main branch.
17-
- The `.github/workflows/test_and_lint.yml` file will run automated tests and style checks every time a Pull Request is opened. If the checks are undesired, the `test_and_lint.yml` can be deleted. The strictness of the code coverage level, etc., can be modified by altering the configurations in the `pyproject.toml` file and the `.flake8` file.
12+
## Overview
13+
This package converts SmartSPIM tile stacks (PNG or TIFF) into OME-Zarr
14+
pyramids, with optional upload to S3. It partitions the work across
15+
independent stack folders so you can parallelize by running multiple
16+
partitions at once.
17+
18+
Key capabilities:
19+
- Read PNG or TIFF stacks and write OME-Zarr pyramids.
20+
- Derive voxel size from the input acquisition.json metadata.
21+
- Optional Blosc compression and S3 sync.
22+
23+
## Expected input layout
24+
Input folders are expected to look like this:
25+
26+
```text
27+
<input_source>/
28+
acquisition.json
29+
derivatives/
30+
metadata.json
31+
SmartSPIM/
32+
Ex_445_Em_469/
33+
432380/
34+
432380_504340/
35+
*.png | *.tif | *.tiff
36+
432380_530260/
37+
*.png | *.tif | *.tiff
38+
Ex_561_Em_600/
39+
...
40+
```
41+
42+
Each stack folder (for example `432380_504340`) is processed into an
43+
OME-Zarr named `<stack_name>.ome.zarr` under the output channel folder.
1844

1945
## Installation
20-
To use the software, in the root directory, run
46+
To use the software, in the root directory, run:
2147
```bash
2248
pip install -e .
2349
```
2450

25-
To develop the code, run
51+
To develop the code, run:
2652
```bash
2753
pip install -e .[dev]
2854
```
2955

56+
## Quick start
57+
Run a single partition locally:
58+
59+
```bash
60+
python -m aind_smartspim_data_transformation.smartspim_job \
61+
--config-file path/to/config.json
62+
```
63+
64+
Example config:
65+
66+
```json
67+
{
68+
"input_source": "/data/SmartSPIM_000000_2024-06-05_07-56-54",
69+
"output_directory": "/data/ome_zarr_output",
70+
"num_of_partitions": 4,
71+
"partition_to_process": 0,
72+
"chunk_size": [128, 128, 128],
73+
"scale_factor": [2, 2, 2],
74+
"downsample_levels": 4,
75+
"compressor_name": "blosc",
76+
"compressor_kwargs": {"cname": "zstd", "clevel": 3, "shuffle": 1},
77+
"s3_location": null
78+
}
79+
```
80+
81+
If `s3_location` is set (for example `s3://bucket/prefix`), the job will
82+
sync each OME-Zarr to S3 and remove the local copy after upload. The
83+
`derivatives/` folder is uploaded once by partition 0.
84+
85+
## Environment variables
86+
You can also configure the job via env vars. These are the keys used in
87+
the tests and the default `BasicJobSettings` behavior:
88+
89+
```bash
90+
export TRANSFORMATION_JOB_INPUT_SOURCE=/data/SmartSPIM_000000_2024-06-05_07-56-54
91+
export TRANSFORMATION_JOB_OUTPUT_DIRECTORY=/data/ome_zarr_output
92+
export TRANSFORMATION_JOB_NUM_OF_PARTITIONS=4
93+
export TRANSFORMATION_JOB_PARTITION_TO_PROCESS=0
94+
```
95+
96+
Then run:
97+
98+
```bash
99+
python -m aind_smartspim_data_transformation.smartspim_job
100+
```
101+
102+
## Output layout
103+
The output directory is organized by channel name, each containing one
104+
OME-Zarr per stack:
105+
106+
```text
107+
<output_directory>/
108+
Ex_445_Em_469/
109+
432380_504340.ome.zarr/
110+
432380_530260.ome.zarr/
111+
Ex_561_Em_600/
112+
432380_504340.ome.zarr/
113+
432380_530260.ome.zarr/
114+
```
115+
116+
## Requirements and notes
117+
- PNG or TIFF stacks only. Mixed extensions within a stack are not
118+
supported.
119+
- AWS CLI must be installed and configured if using S3 upload.
120+
- The voxel size is read from `acquisition.json` and assumed to be
121+
consistent across the dataset.
122+
30123
## Contributing
31124

32125
### Linters and testing

0 commit comments

Comments
 (0)