Skip to content

Commit 30a66a8

Browse files
committed
add ndv dims
1 parent 4cd56bc commit 30a66a8

6 files changed

+7
-5
lines changed
371 Bytes
Binary file not shown.
0 Bytes
Binary file not shown.
224 Bytes
Binary file not shown.
17 Bytes
Binary file not shown.

gui/_image_viewer.py

+6-4
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ def __init__(self, parent: QWidget | None = None):
7979

8080
self._image: None | str | Path = None\
8181

82-
self._ndv_file: None | DataArray = None
82+
self._ndv_file: None | tuple[DataArray, int, int, int] = None
8383

8484
# LUT controls -----------------------------------------------------------
8585

@@ -153,11 +153,11 @@ def clear(self) -> None:
153153
self._viewer.view.camera.set_range(margin=0)
154154

155155
@property
156-
def ndv_file(self) -> None | DataArray:
156+
def ndv_file(self) -> None | tuple[DataArray, int, int, int]:
157157
return self._ndv_file
158158

159159
@ndv_file.setter
160-
def ndv_file(self, file: None | DataArray) -> None:
160+
def ndv_file(self, file: None | tuple[DataArray, int, int, int]) -> None:
161161
self._ndv_file = file
162162

163163
def _on_clims_changed(self, range: tuple[float, float]) -> None:
@@ -180,7 +180,9 @@ def _reset(self) -> None:
180180
def _open_with_ndv(self) -> None:
181181
if self._ndv_file is None:
182182
return
183-
ndv = NDViewer(self._ndv_file, parent=self)
183+
ary, c, z, t = self._ndv_file
184+
ndv = NDViewer(ary, parent=self)
185+
ndv.set_current_index({"C": c, "Z": z, "T": t})
184186
ndv.setWindowFlags(Qt.WindowType.Dialog)
185187
ndv.show()
186188

gui/_main_window.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ def _on_point_selected(self, args: None | int | str) -> None:
124124
self._files[path] = _file.xarray_data
125125
image = _file.xarray_data.isel(C=c, Z=z, T=t).to_numpy()
126126
self.image_viewer.setData(image)
127-
self.image_viewer.ndv_file = self._files[path]
127+
self.image_viewer.ndv_file = (self._files[path], c, z, t)
128128
print(
129129
f"-----------\nfile_shape: {self._files[path].shape},\n"
130130
f"C: {c}, Z: {z}, T: {t},\nimage shape: {image.shape},\n"

0 commit comments

Comments
 (0)