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

Add docs for calculating structure tensor #34

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 45 additions & 0 deletions docs/structure-tensor.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# Calculating Structure Tensor
calvinchai marked this conversation as resolved.
Show resolved Hide resolved

## Prerequisites

Ensure the repository is cloned and its dependencies are installed.
calvinchai marked this conversation as resolved.
Show resolved Hide resolved

Steps to Calculate Structure Tensor
calvinchai marked this conversation as resolved.
Show resolved Hide resolved

1. Run Structure Tensor Calculation

Use the process_zarr function to compute the structure tensor from your input Zarr file. Adjust sigma and rho to control the smoothing parameters:
```
input = "/scratch/input.zarr"
output = "/scratch/output.zarr"
process_zarr(input, output, sigma=0, rho=5)
```
• sigma: Controls the Gaussian smoothing applied before computing derivatives.
• rho: Controls the Gaussian smoothing applied after computing the tensor.

2. Generate Pyramid for Multi-Resolution Data

To enable visualization or efficient access, create a resolution pyramid with generate_pyramid:
`
generate_pyramid(Zarr.zopen(output, "w"), levels=6, mode="mean")

• levels: Specifies the number of pyramid levels.
• mode: Determines the aggregation method (e.g., mean).
`
3. Add OME Metadata

To make the output Zarr file compatible with tools like Neuroglancer or Napari, write OME-compliant metadata:
`
write_ome_metadata(Zarr.zopen(output, "w"), ["c", "z", "y", "x"])

• Dimensions: ["c", "z", "y", "x"] corresponds to the channel, depth, height, and width dimensions of the data.
`
Example Workflow
1. Input: /scratch/input.zarr
2. Output: /scratch/output.zarr
`
process_zarr("/scratch/input.zarr", "/scratch/output.zarr", sigma=0, rho=5)
generate_pyramid(Zarr.zopen("/scratch/output.zarr", "w"), levels=6, mode="mean")
write_ome_metadata(Zarr.zopen("/scratch/output.zarr", "w"), ["c", "z", "y", "x"])
`
This pipeline will produce a multi-resolution Zarr dataset ready for visualization and further analysis.
1 change: 1 addition & 0 deletions mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ nav:
- Welcome: "index.md"
- Upload data: "upload.md"
- Visualize data in Neuroglancer: "neuroglancer.md"
- Calculating Structure Tensor: "structure-tensor.md"
calvinchai marked this conversation as resolved.
Show resolved Hide resolved
- Webknossos:
- Add Webknossos dataset: "webknossos-add-dataset.md"
- Deployment: https://github.com/lincbrain/webknossos/blob/ak-dev/LINC_DEPLOYMENT.md
Expand Down
Loading