Skip to content

Commit 61611e3

Browse files
authored
Temp fix for napari bug, add test to catch it (#177)
* add test that fails :( * disable axis labels for now due to napari bug
1 parent c76547f commit 61611e3

File tree

3 files changed

+15
-9
lines changed

3 files changed

+15
-9
lines changed

src/blik/reader.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ def _construct_positions_layer(
4242
"metadata": {"experiment_id": exp_id, "p_id": p_id, "source": source},
4343
"out_of_slice_display": True,
4444
"projection_mode": "all",
45-
"axis_labels": ('z', 'y', 'x'),
45+
# "axis_labels": ('z', 'y', 'x'),
4646
"units": 'angstrom',
4747
**pt_kwargs,
4848
},
@@ -71,7 +71,7 @@ def _construct_orientations_layer(
7171
"vector_style": "arrow",
7272
"out_of_slice_display": True,
7373
"projection_mode": "all",
74-
"axis_labels": ('z', 'y', 'x'),
74+
# "axis_labels": ('z', 'y', 'x'),
7575
"units": 'angstrom',
7676
},
7777
"vectors",
@@ -179,7 +179,7 @@ def read_image(image):
179179
"blending": "translucent",
180180
"plane": {"thickness": 5},
181181
"projection_mode": "mean",
182-
"axis_labels": ('z', 'y', 'x'),
182+
# "axis_labels": ('z', 'y', 'x'),
183183
"units": 'angstrom',
184184
},
185185
"image",
@@ -212,7 +212,7 @@ def read_surface_picks(path):
212212
"edge_color": "surface_id",
213213
"shape_type": "path",
214214
"ndim": 3,
215-
"axis_labels": ('z', 'y', 'x'),
215+
# "axis_labels": ('z', 'y', 'x'),
216216
"units": 'angstrom',
217217
},
218218
"shapes",
@@ -236,7 +236,7 @@ def read_surface(path):
236236
"scale": scale,
237237
# TODO: needs to exposed in napari
238238
# colormap=colormap
239-
"axis_labels": ('z', 'y', 'x'),
239+
# "axis_labels": ('z', 'y', 'x'),
240240
"units": 'angstrom',
241241
},
242242
"surface",

src/blik/widgets/main_widget.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ def _attach_callbacks_to_viewer(wdg):
7979
# pixels are 1 A. We put 0.1nm cause it's more readable with multiples
8080
viewer.scale_bar.unit = "0.1nm"
8181
viewer.scale_bar.visible = True
82-
viewer.dims.axis_labels = ['z', 'y', 'x']
82+
# viewer.dims.axis_labels = ['z', 'y', 'x']
8383

8484

8585
def _connect_layers(viewer, e):
@@ -175,7 +175,7 @@ def new(
175175
np.zeros(lay.data.shape, dtype=np.int32),
176176
name=f"{exp_id} - segmentation",
177177
scale=lay.scale,
178-
axis_labels=('z', 'y', 'x'),
178+
# axis_labels=('z', 'y', 'x'),
179179
units='angstrom',
180180
metadata={
181181
"experiment_id": exp_id,
@@ -207,7 +207,7 @@ def new(
207207
edge_color_cycle=np.random.rand(30, 3),
208208
edge_color="surface_id",
209209
ndim=3,
210-
axis_labels=('z', 'y', 'x'),
210+
# axis_labels=('z', 'y', 'x'),
211211
units='angstrom',
212212
)
213213

@@ -222,7 +222,7 @@ def new(
222222
metadata={"experiment_id": exp_id},
223223
face_color_cycle=np.random.rand(30, 3),
224224
ndim=3,
225-
axis_labels=('z', 'y', 'x'),
225+
# axis_labels=('z', 'y', 'x'),
226226
units='angstrom',
227227
)
228228

tests/test_reader.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,3 +28,9 @@ def test_construct_empty_layers():
2828
assert pts[2] == "points"
2929
vec = layer_data_list[1]
3030
assert vec[2] == "vectors"
31+
32+
33+
def test_napari_read(star_file, mrc_file, make_napari_viewer):
34+
v = make_napari_viewer()
35+
v.open(star_file, plugin='blik')
36+
v.open(mrc_file, plugin='blik')

0 commit comments

Comments
 (0)