Skip to content

Commit a527184

Browse files
committed
optionalize pyspin
1 parent a94be3e commit a527184

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

pylabrobot/plate_reading/biotek_backend.py

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
try:
1414
import PySpin # can be downloaded from
1515
# https://www.teledynevisionsolutions.com/products/spinnaker-sdk/
16-
import numpy as np
1716
USE_PYSPIN = True
1817
except ImportError:
1918
USE_PYSPIN = False
@@ -25,6 +24,12 @@
2524
logger = logging.getLogger("pylabrobot.plate_reading.biotek")
2625

2726

27+
28+
SPINNAKER_COLOR_PROCESSING_ALGORITHM_HQ_LINEAR = PySpin.SPINNAKER_COLOR_PROCESSING_ALGORITHM_HQ_LINEAR if USE_PYSPIN else -1
29+
PixelFormat_Mono8 = PySpin.PixelFormat_Mono8 if USE_PYSPIN else -1
30+
31+
32+
2833
class Cytation5Backend(ImageReaderBackend):
2934
"""Backend for biotek cytation 5 image reader.
3035
@@ -583,8 +588,8 @@ async def set_imaging_mode(self, mode: ImagingMode) -> bool:
583588

584589
async def _acquire_image(
585590
self,
586-
color_processing_algorithm: int = PySpin.SPINNAKER_COLOR_PROCESSING_ALGORITHM_HQ_LINEAR,
587-
pixel_format: int = PySpin.PixelFormat_Mono8,
591+
color_processing_algorithm: int = SPINNAKER_COLOR_PROCESSING_ALGORITHM_HQ_LINEAR,
592+
pixel_format: int = PixelFormat_Mono8,
588593
) -> List[List[float]]:
589594
nodemap = self.cam.GetNodeMap()
590595

@@ -631,8 +636,8 @@ async def capture(
631636
exposure_time: Exposure,
632637
focal_height: FocalHeight,
633638
gain: Gain,
634-
color_processing_algorithm: int = PySpin.SPINNAKER_COLOR_PROCESSING_ALGORITHM_HQ_LINEAR,
635-
pixel_format: int = PySpin.PixelFormat_Mono8,
639+
color_processing_algorithm: int = SPINNAKER_COLOR_PROCESSING_ALGORITHM_HQ_LINEAR,
640+
pixel_format: int = PixelFormat_Mono8,
636641
) -> List[List[float]]:
637642
"""Capture image using the microscope
638643

0 commit comments

Comments
 (0)