Skip to content

Commit

Permalink
bugfix/squeeze-extra-dims (#32)
Browse files Browse the repository at this point in the history
* Squeeze data before return

* Catch more squeezes and update tests
  • Loading branch information
Jackson Maxfield Brown committed Sep 25, 2021
1 parent 0e888bc commit 7605974
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
8 changes: 4 additions & 4 deletions napari_aicsimageio/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@ def _get_full_image_data(
if DimensionNames.MosaicTile in img.reader.dims.order:
try:
if in_memory:
return img.reader.mosaic_xarray_data
return img.reader.mosaic_xarray_data.squeeze()

return img.reader.mosaic_xarray_dask_data
return img.reader.mosaic_xarray_dask_data.squeeze()

# Catch reader does not support tile stitching
except NotImplementedError:
Expand All @@ -50,9 +50,9 @@ def _get_full_image_data(
)

if in_memory:
return img.reader.xarray_data
return img.reader.xarray_data.squeeze()

return img.reader.xarray_dask_data
return img.reader.xarray_dask_data.squeeze()


# Function to get Metadata to provide with data
Expand Down
10 changes: 5 additions & 5 deletions napari_aicsimageio/tests/test_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,29 +50,29 @@
),
(
OME_TIFF,
(1, 4, 65, 600, 900),
(4, 65, 600, 900),
{
"name": [
"0 :: Image:0 :: Bright_2",
"0 :: Image:0 :: EGFP",
"0 :: Image:0 :: CMDRP",
"0 :: Image:0 :: H3342",
],
"channel_axis": 1,
"channel_axis": 0,
"scale": (0.29, 0.10833333333333332, 0.10833333333333332),
},
),
(
LIF_FILE,
(1, 4, 1, 5622, 7666),
(4, 5622, 7666),
{
"name": [
"0 :: TileScan_002 :: Gray",
"0 :: TileScan_002 :: Red",
"0 :: TileScan_002 :: Green",
"0 :: TileScan_002 :: Cyan",
],
"channel_axis": 1,
"channel_axis": 0,
"scale": (0.20061311154598827, 0.20061311154598827),
},
),
Expand Down Expand Up @@ -126,7 +126,7 @@ def test_reader(
@pytest.mark.parametrize(
"filename, expected_shape",
[
(SINGLESCENE_FILE, (1, 325, 475)),
(SINGLESCENE_FILE, (325, 475)),
(MULTISCENE_FILE, (3, 5, 325, 475)),
],
)
Expand Down

0 comments on commit 7605974

Please sign in to comment.