Skip to content

Commit 9eff5d1

Browse files
committed
Merge branch 'master' of https://github.com/openUC2/imSwitch
2 parents afeea85 + 652353f commit 9eff5d1

File tree

5 files changed

+21
-214
lines changed

5 files changed

+21
-214
lines changed

dockerfile

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -183,14 +183,6 @@ RUN cd /opt/Vimba_6_0/VimbaPython/Source && \
183183
# Set environment variable for GenTL detection
184184
ENV GENICAM_GENTL64_PATH="${GENICAM_GENTL64_PATH}:/opt/Vimba_6_0/VimbaUSBTL/CTI/arm_64bit"
185185

186-
# install IOHub - as it will be installed via ImSwitch again
187-
# "iohub @ https://github.com/czbiohub-sf/iohub/archive/refs/heads/main.zip"
188-
RUN /bin/bash -c "source /opt/conda/bin/activate imswitch && pip install --no-cache-dir Cython"
189-
RUN git clone https://github.com/czbiohub-sf/iohub /tmp/iohub && \
190-
cd /tmp/iohub && \
191-
/bin/bash -c "source /opt/conda/bin/activate imswitch && \
192-
pip install --no-build-isolation /tmp/iohub" && \
193-
rm -rf /tmp/iohub
194186

195187
# Always pull the latest version of ImSwitch and UC2-REST repositories
196188
# Adding a dynamic build argument to prevent caching

imswitch/imcontrol/controller/controllers/HistoScanController.py

Lines changed: 17 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -38,12 +38,6 @@
3838
import numpy as np
3939
from io import BytesIO
4040
from PIL import Image
41-
try:
42-
from iohub.ngff import open_ome_zarr
43-
IS_IOHUB = True
44-
except ImportError:
45-
IS_IOHUB = False
46-
isZARR=False
4741
isZARR=False
4842

4943
try:
@@ -1585,55 +1579,23 @@ def add_image(self, img, coords, metadata):
15851579
self.queue.append((img, coords, metadata))
15861580

15871581
def _process_queue(self):
1588-
if isZARR:
1589-
1590-
tmp_dir = TemporaryDirectory()
1591-
store_path = os.path.join(tmp_dir.name, "tiled.zarr")
1592-
print("Zarr store path", store_path)
1593-
1594-
# define grid
1595-
with open_ome_zarr(store_path, layout="tiled", mode="a", channel_names=["Mono"]) as dataset:
1596-
tiles = dataset.make_tiles(
1597-
"tiled_raw", grid_shape=self.grid_shape, tile_shape=self.tile_shape, dtype=self.dtype
1598-
)
1599-
while self.isRunning:
1600-
if not self.queue:
1601-
time.sleep(.02) # unload CPU
1602-
continue
1603-
img, coords, metadata = self.queue.popleft()
1604-
1605-
# flip image if needed
1606-
if self.flipX:
1607-
img = np.fliplr(img)
1608-
if self.flipY:
1609-
img = np.flipud(img)
1610-
self._place_on_canvas(img, coords)
1611-
1612-
# write image to disk
1613-
# tif.write(data=img, metadata=metadata)
1614-
row = metadata['Plane']['IndexX']
1615-
column = metadata['Plane']['IndexY']
1616-
tiles.write_tile(img, row, column)
1617-
1618-
1619-
else:
1620-
with tifffile.TiffWriter(self.file_path, bigtiff=True, append=True) as tif:
1621-
while self.isRunning:
1622-
if not self.queue:
1623-
time.sleep(.02) # unload CPU
1624-
continue
1625-
img, coords, metadata = self.queue.popleft()
1626-
1627-
# flip image if needed
1628-
if self.flipX:
1629-
img = np.fliplr(img)
1630-
if self.flipY:
1631-
img = np.flipud(img)
1632-
1633-
self._place_on_canvas(img, coords)
1634-
# write image to disk
1635-
#metadata e.g. {"Pixels": {"PhysicalSizeX": 0.2, "PhysicalSizeXUnit": "\\u00b5m", "PhysicalSizeY": 0.2, "PhysicalSizeYUnit": "\\u00b5m"}, "Plane": {"PositionX": -100, "PositionY": -100, "IndexX": 0, "IndexY": 0}}
1636-
tif.write(data=img, metadata=metadata)
1582+
with tifffile.TiffWriter(self.file_path, bigtiff=True, append=True) as tif:
1583+
while self.isRunning:
1584+
if not self.queue:
1585+
time.sleep(.02) # unload CPU
1586+
continue
1587+
img, coords, metadata = self.queue.popleft()
1588+
1589+
# flip image if needed
1590+
if self.flipX:
1591+
img = np.fliplr(img)
1592+
if self.flipY:
1593+
img = np.flipud(img)
1594+
1595+
self._place_on_canvas(img, coords)
1596+
# write image to disk
1597+
#metadata e.g. {"Pixels": {"PhysicalSizeX": 0.2, "PhysicalSizeXUnit": "\\u00b5m", "PhysicalSizeY": 0.2, "PhysicalSizeYUnit": "\\u00b5m"}, "Plane": {"PositionX": -100, "PositionY": -100, "IndexX": 0, "IndexY": 0}}
1598+
tif.write(data=img, metadata=metadata)
16371599

16381600
def _place_on_canvas(self, img, coords):
16391601
if self.isStitchAshlar and IS_ASHLAR_AVAILABLE:

imswitch/imcontrol/controller/controllers/WorkflowController.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -47,11 +47,6 @@
4747
from typing import List, Dict, Any, Optional
4848
import uuid
4949

50-
try:
51-
from iohub.ngff import open_ome_zarr
52-
IS_IOHUB = True
53-
except ImportError:
54-
IS_IOHUB = False
5550

5651

5752
isZARR=True
@@ -564,6 +559,8 @@ def start_xyz_histo_workflow(self,
564559
self._logger.debug("Zarr store path: "+store_path)
565560

566561
# Let's assume single channel "Mono" for simplicity, but can adapt for more.
562+
def open_ome_zarr(store_path, layout="tiled", mode="a", channel_names=None):
563+
return None # TODO: Implement this function to open or create a Zarr dataset with the specified layout and channel names.
567564
dataset = open_ome_zarr(store_path, layout="tiled", mode="a", channel_names=[channel])
568565
# Calculate grid shape based on the number of xy positions
569566
grid_shape = (len(ys), len(xs))

imswitch/imcontrol/controller/server/_serialize.py

Lines changed: 0 additions & 141 deletions
This file was deleted.

setup.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,7 @@ def get_version():
5757
"Send2Trash >= 1.8",
5858
"tifffile >= 2020.11.26",
5959
"ome_zarr >= 0.9.0",
60-
"Pyro5 >= 5.14",
61-
"dask[complete] >= 2024.11.2",
60+
"dask[complete] >= 2024.8.0",
6261
"fastAPI >= 0.86.0",
6362
"uvicorn[standard] >= 0.19.0",
6463
"matplotlib == 3.9.2",
@@ -96,9 +95,7 @@ def get_version():
9695
"qtpy >= 1.9"
9796
],
9897
'Ashlar': [
99-
"ashlarUC2",
100-
"iohub==0.2.0a1",
101-
98+
"ashlarUC2"
10299
],
103100
'arkitekt':
104101
[

0 commit comments

Comments
 (0)