From c68e988bbf2a02e777a90d8835af1fb99fac4cb6 Mon Sep 17 00:00:00 2001 From: Kaidong Chai Date: Tue, 7 Jan 2025 10:37:48 -0500 Subject: [PATCH 1/5] Add docs for calculating structure tensor --- docs/structure-tensor.md | 45 ++++++++++++++++++++++++++++++++++++++++ mkdocs.yml | 1 + 2 files changed, 46 insertions(+) create mode 100644 docs/structure-tensor.md diff --git a/docs/structure-tensor.md b/docs/structure-tensor.md new file mode 100644 index 0000000..f919233 --- /dev/null +++ b/docs/structure-tensor.md @@ -0,0 +1,45 @@ +# Calculating Structure Tensor + +## Prerequisites + +Ensure the repository is cloned and its dependencies are installed. + +Steps to Calculate Structure Tensor + +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. diff --git a/mkdocs.yml b/mkdocs.yml index 7aa0c4f..9f81e81 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -22,6 +22,7 @@ nav: - Welcome: "index.md" - Upload data: "upload.md" - Visualize data in Neuroglancer: "neuroglancer.md" + - Calculating Structure Tensor: "structure-tensor.md" - Webknossos: - Add Webknossos dataset: "webknossos-add-dataset.md" - Deployment: https://github.com/lincbrain/webknossos/blob/ak-dev/LINC_DEPLOYMENT.md From 2736b0dd392d0822cbeaa9f961b2d0c113e2226e Mon Sep 17 00:00:00 2001 From: Calvin Chai Date: Tue, 7 Jan 2025 16:47:36 -0500 Subject: [PATCH 2/5] Update mkdocs.yml Co-authored-by: Kabilar Gunalan --- mkdocs.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mkdocs.yml b/mkdocs.yml index 9f81e81..d3b5981 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -22,7 +22,7 @@ nav: - Welcome: "index.md" - Upload data: "upload.md" - Visualize data in Neuroglancer: "neuroglancer.md" - - Calculating Structure Tensor: "structure-tensor.md" + - Calculate Structure Tensor: "structure-tensor.md" - Webknossos: - Add Webknossos dataset: "webknossos-add-dataset.md" - Deployment: https://github.com/lincbrain/webknossos/blob/ak-dev/LINC_DEPLOYMENT.md From 6f9de0c2274786ce139e24f4df12aa1dc82de495 Mon Sep 17 00:00:00 2001 From: Calvin Chai Date: Tue, 7 Jan 2025 16:47:41 -0500 Subject: [PATCH 3/5] Update docs/structure-tensor.md Co-authored-by: Kabilar Gunalan --- docs/structure-tensor.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/structure-tensor.md b/docs/structure-tensor.md index f919233..531612f 100644 --- a/docs/structure-tensor.md +++ b/docs/structure-tensor.md @@ -1,4 +1,4 @@ -# Calculating Structure Tensor +# Calculate Structure Tensors ## Prerequisites From 9eaac0714b73250eccd593bfab5791cf779dfe76 Mon Sep 17 00:00:00 2001 From: Calvin Chai Date: Tue, 7 Jan 2025 16:48:04 -0500 Subject: [PATCH 4/5] Update docs/structure-tensor.md Co-authored-by: Kabilar Gunalan --- docs/structure-tensor.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/structure-tensor.md b/docs/structure-tensor.md index 531612f..e36f895 100644 --- a/docs/structure-tensor.md +++ b/docs/structure-tensor.md @@ -4,7 +4,7 @@ Ensure the repository is cloned and its dependencies are installed. -Steps to Calculate Structure Tensor +## Steps to Calculate Structure Tensor 1. Run Structure Tensor Calculation From 197461d1500ab52f8736cd342c20e290fa4fb0a4 Mon Sep 17 00:00:00 2001 From: Kaidong Chai Date: Tue, 7 Jan 2025 16:50:31 -0500 Subject: [PATCH 5/5] Update Structure Tensor docs --- docs/structure-tensor.md | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/docs/structure-tensor.md b/docs/structure-tensor.md index e36f895..897a352 100644 --- a/docs/structure-tensor.md +++ b/docs/structure-tensor.md @@ -2,7 +2,7 @@ ## Prerequisites -Ensure the repository is cloned and its dependencies are installed. +Ensure the [repository](https://github.com/Tinggong/structens) is cloned and its dependencies are installed. ## Steps to Calculate Structure Tensor @@ -13,33 +13,32 @@ Use the process_zarr function to compute the structure tensor from your input Za 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: -` +To make the output Zarr file compatible with tools like Neuroglancer, 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.