Skip to content

Commit

Permalink
Pass scale metadata through recorder reconstruct (#399)
Browse files Browse the repository at this point in the history
* pass scale metadata through reconstruct

* test scale passing
  • Loading branch information
talonchandler authored Aug 9, 2023
1 parent 1367a35 commit 7cf3b56
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
4 changes: 4 additions & 0 deletions recOrder/cli/apply_inverse_transfer_function.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import numpy as np
import torch
from iohub import open_ome_zarr
from iohub.ngff_meta import TransformationMeta
from waveorder.models import (
inplane_oriented_thick_pol3d,
isotropic_fluorescent_thick_3d,
Expand Down Expand Up @@ -122,6 +123,9 @@ def apply_inverse_transfer_function_cli(
1,
)
+ input_dataset.data.shape[3:], # chunk by YX
transform=[
TransformationMeta(type="scale", scale=input_dataset.scale)
],
)
else:
output_array = output_dataset[0]
Expand Down
13 changes: 11 additions & 2 deletions recOrder/tests/cli_tests/test_reconstruct.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import numpy as np
from click.testing import CliRunner
from iohub.ngff import open_ome_zarr
from iohub.ngff_meta import TransformationMeta

from recOrder.cli import settings
from recOrder.cli.main import cli
Expand All @@ -18,7 +19,13 @@ def test_reconstruct(tmp_path):
mode="w",
channel_names=channel_names,
)
dataset.create_zeros("0", (5, 4, 4, 5, 6), dtype=np.uint16)
input_scale = [1, 2, 3, 4, 5]
dataset.create_zeros(
"0",
(5, 4, 4, 5, 6),
dtype=np.uint16,
transform=[TransformationMeta(type="scale", scale=input_scale)],
)

# Setup options
birefringence_settings = settings.BirefringenceSettings(
Expand Down Expand Up @@ -111,4 +118,6 @@ def test_reconstruct(tmp_path):
assert result_path.exists()
assert result_inv.exit_code == 0
assert "Reconstructing" in result_inv.output
assert "Reconstructing" in result_inv.output

# Check scale transformations pass through
assert input_scale == result_dataset.scale

0 comments on commit 7cf3b56

Please sign in to comment.