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

Fix/update brt ng metadata #339

Merged
merged 2 commits into from
Oct 5, 2023
Merged
Changes from all 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
15 changes: 11 additions & 4 deletions em_workflows/brt/flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@
from typing import Dict
import glob
import os

from pytools.HedwigZarrImages import HedwigZarrImages
from em_workflows.file_path import FilePath
import subprocess
import math
Expand All @@ -46,7 +48,6 @@
from prefect import task, Flow, Parameter, unmapped
from prefect.run_configs import LocalRun
from prefect.engine import signals
from pytools.workflow_functions import visual_min_max

from em_workflows.utils import utils
from em_workflows.utils import neuroglancer as ng
Expand Down Expand Up @@ -502,13 +503,19 @@ def gen_zarr(fp_in: FilePath):
def gen_ng_metadata(fp_in: FilePath) -> Dict:
file_path = fp_in
asset_fp = Path(f"{file_path.assets_dir}/{file_path.base}.zarr")

first_zarr_arr = Path(asset_fp.as_posix() + "/0/0")
zarr_fp = Path(f"{file_path.working_dir}/{file_path.base}.zarr")
hw_images = HedwigZarrImages(zarr_fp)
_, hw_image = next(hw_images.series())

ng_asset = file_path.gen_asset(
asset_type=AssetType.NEUROGLANCER_ZARR, asset_fp=asset_fp
)
ng_asset["metadata"] = visual_min_max(mad_scale=5, input_image=first_zarr_arr)
metadata = {
"shader": "Grayscale",
"dimensions": "XYZ",
"shaderParameters": hw_image.neuroglancer_shader_parameters(),
}
ng_asset["metadata"] = metadata
return ng_asset


Expand Down
Loading