Skip to content

Commit

Permalink
Temp fix for napari bug, add test to catch it (#177)
Browse files Browse the repository at this point in the history
* add test that fails :(

* disable axis labels for now due to napari bug
  • Loading branch information
brisvag authored Jul 12, 2024
1 parent c76547f commit 61611e3
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 9 deletions.
10 changes: 5 additions & 5 deletions src/blik/reader.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def _construct_positions_layer(
"metadata": {"experiment_id": exp_id, "p_id": p_id, "source": source},
"out_of_slice_display": True,
"projection_mode": "all",
"axis_labels": ('z', 'y', 'x'),
# "axis_labels": ('z', 'y', 'x'),
"units": 'angstrom',
**pt_kwargs,
},
Expand Down Expand Up @@ -71,7 +71,7 @@ def _construct_orientations_layer(
"vector_style": "arrow",
"out_of_slice_display": True,
"projection_mode": "all",
"axis_labels": ('z', 'y', 'x'),
# "axis_labels": ('z', 'y', 'x'),
"units": 'angstrom',
},
"vectors",
Expand Down Expand Up @@ -179,7 +179,7 @@ def read_image(image):
"blending": "translucent",
"plane": {"thickness": 5},
"projection_mode": "mean",
"axis_labels": ('z', 'y', 'x'),
# "axis_labels": ('z', 'y', 'x'),
"units": 'angstrom',
},
"image",
Expand Down Expand Up @@ -212,7 +212,7 @@ def read_surface_picks(path):
"edge_color": "surface_id",
"shape_type": "path",
"ndim": 3,
"axis_labels": ('z', 'y', 'x'),
# "axis_labels": ('z', 'y', 'x'),
"units": 'angstrom',
},
"shapes",
Expand All @@ -236,7 +236,7 @@ def read_surface(path):
"scale": scale,
# TODO: needs to exposed in napari
# colormap=colormap
"axis_labels": ('z', 'y', 'x'),
# "axis_labels": ('z', 'y', 'x'),
"units": 'angstrom',
},
"surface",
Expand Down
8 changes: 4 additions & 4 deletions src/blik/widgets/main_widget.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ def _attach_callbacks_to_viewer(wdg):
# pixels are 1 A. We put 0.1nm cause it's more readable with multiples
viewer.scale_bar.unit = "0.1nm"
viewer.scale_bar.visible = True
viewer.dims.axis_labels = ['z', 'y', 'x']
# viewer.dims.axis_labels = ['z', 'y', 'x']


def _connect_layers(viewer, e):
Expand Down Expand Up @@ -175,7 +175,7 @@ def new(
np.zeros(lay.data.shape, dtype=np.int32),
name=f"{exp_id} - segmentation",
scale=lay.scale,
axis_labels=('z', 'y', 'x'),
# axis_labels=('z', 'y', 'x'),
units='angstrom',
metadata={
"experiment_id": exp_id,
Expand Down Expand Up @@ -207,7 +207,7 @@ def new(
edge_color_cycle=np.random.rand(30, 3),
edge_color="surface_id",
ndim=3,
axis_labels=('z', 'y', 'x'),
# axis_labels=('z', 'y', 'x'),
units='angstrom',
)

Expand All @@ -222,7 +222,7 @@ def new(
metadata={"experiment_id": exp_id},
face_color_cycle=np.random.rand(30, 3),
ndim=3,
axis_labels=('z', 'y', 'x'),
# axis_labels=('z', 'y', 'x'),
units='angstrom',
)

Expand Down
6 changes: 6 additions & 0 deletions tests/test_reader.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,9 @@ def test_construct_empty_layers():
assert pts[2] == "points"
vec = layer_data_list[1]
assert vec[2] == "vectors"


def test_napari_read(star_file, mrc_file, make_napari_viewer):
v = make_napari_viewer()
v.open(star_file, plugin='blik')
v.open(mrc_file, plugin='blik')

0 comments on commit 61611e3

Please sign in to comment.