Skip to content

Commit

Permalink
Fix deskew vol usage
Browse files Browse the repository at this point in the history
  • Loading branch information
multimeric committed Nov 23, 2023
1 parent 9990f78 commit b770b32
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 29 deletions.
2 changes: 1 addition & 1 deletion core/lls_core/models/lattice_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,7 @@ def check_incomplete_acquisition(self, volume: ArrayLike, time_point: int, chann
@property
def deskewed_volume(self) -> DaskArray:
from dask.array import zeros
return zeros(self.deskew_vol_shape)
return zeros(self.derived.deskew_vol_shape)

def _process_crop(self) -> Iterable[ImageSlice]:
"""
Expand Down
56 changes: 28 additions & 28 deletions core/tests/test_deskew.py
Original file line number Diff line number Diff line change
@@ -1,28 +1,28 @@
#filename and function name should start with "test_" when using pytest
import pyclesperanto_prototype as cle
import numpy as np
from lls_core.models.lattice_data import LatticeData
from xarray import DataArray
import tempfile

def test_deskew():

raw = np.zeros((5,5,5))
raw[2,0,0] = 10

deskewed = cle.deskew_y(raw,angle_in_degrees=60)

#np.argwhere(deskewed>0)
assert deskewed.shape == (4,8,5)
assert deskewed[2,2,0] == 0.5662433505058289

def test_lattice_data_deskew():
raw = DataArray(np.zeros((5, 5, 5)), dims=["X", "Y", "Z"])
with tempfile.TemporaryDirectory() as tmpdir:
lattice = LatticeData(
input_image=raw,
physical_pixel_sizes = (1, 1, 1),
save_name="test",
save_dir=tmpdir
)
assert lattice.deskew_vol_shape == [2, 9, 5]
#filename and function name should start with "test_" when using pytest
import pyclesperanto_prototype as cle
import numpy as np
from lls_core.models.lattice_data import LatticeData
from xarray import DataArray
import tempfile

def test_deskew():

raw = np.zeros((5,5,5))
raw[2,0,0] = 10

deskewed = cle.deskew_y(raw,angle_in_degrees=60)

#np.argwhere(deskewed>0)
assert deskewed.shape == (4,8,5)
assert deskewed[2,2,0] == 0.5662433505058289

def test_lattice_data_deskew():
raw = DataArray(np.zeros((5, 5, 5)), dims=["X", "Y", "Z"])
with tempfile.TemporaryDirectory() as tmpdir:
lattice = LatticeData(
input_image=raw,
physical_pixel_sizes = (1, 1, 1),
save_name="test",
save_dir=tmpdir
)
assert lattice.derived.deskew_vol_shape == (2, 9, 5)

0 comments on commit b770b32

Please sign in to comment.