BioImager  3.9.1
A .NET microscopy imaging library. Supports various microscopes by using imported libraries & GUI automation. Supported libraries include PriorĀ® & ZeissĀ® & all devices supported by Micromanager 2.0 and python-microscope.
Loading...
Searching...
No Matches
microscope.abc.Camera Class Reference
Inheritance diagram for microscope.abc.Camera:
microscope.abc.TriggerTargetMixin microscope.abc.DataDevice microscope.abc.Device microscope.cameras.andorsdk3.AndorSDK3 microscope.cameras.atmcd.AndorAtmcd microscope.cameras.picam.PiCamera microscope.cameras.pvcam.PVCamera microscope.cameras.ximea.XimeaCamera microscope.simulators.SimulatedCamera microscope.simulators.stage_aware_camera.StageAwareCamera microscope.testsuite.devices.TestCamera

Public Member Functions

None __init__ (self, **kwargs)
 
def set_readout_mode (self, description)
 
def get_transform (self)
 
def set_transform (self, transform)
 
None set_exposure_time (self, float value)
 
float get_exposure_time (self)
 
float get_cycle_time (self)
 
typing.Tuple[int, int] get_sensor_shape (self)
 
microscope.Binning get_binning (self)
 
None set_binning (self, microscope.Binning binning)
 
microscope.ROI get_roi (self)
 
None set_roi (self, microscope.ROI roi)
 
- Public Member Functions inherited from microscope.abc.TriggerTargetMixin
microscope.TriggerMode trigger_mode (self)
 
microscope.TriggerType trigger_type (self)
 
None set_trigger (self, microscope.TriggerType ttype, microscope.TriggerMode tmode)
 
None trigger (self)
 
- Public Member Functions inherited from microscope.abc.DataDevice
None __init__ (self, int buffer_length=0, **kwargs)
 
def __del__ (self)
 
None abort (self)
 
None enable (self)
 
None disable (self)
 
None set_client (self, new_client)
 
None update_settings (self, settings, bool init=False)
 
None receiveClient (self, str client_uri)
 
def grab_next_data (self, bool soft_trigger=True)
 
None receiveData (self, data, timestamp)
 
- Public Member Functions inherited from microscope.abc.Device
None __init__ (self)
 
None __del__ (self)
 
bool get_is_enabled (self)
 
None disable (self)
 
None enable (self)
 
None initialize (self)
 
None shutdown (self)
 
None add_setting (self, name, dtype, get_func, set_func, values, typing.Optional[typing.Callable[[], bool]] readonly=None)
 
def get_setting (self, str name)
 
def get_all_settings (self)
 
None set_setting (self, str name, value)
 
def describe_setting (self, str name)
 
def describe_settings (self)
 
def update_settings (self, incoming, bool init=False)
 

Static Public Attributes

list ALLOWED_TRANSFORMS = [p for p in itertools.product(*3 * [[False, True]])]
 
- Static Public Attributes inherited from microscope.abc.DataDevice
 set_setting = keep_acquiring(Device.set_setting)
 

Additional Inherited Members

- Public Attributes inherited from microscope.abc.DataDevice
 enabled
 
- Public Attributes inherited from microscope.abc.Device
 enabled
 

Detailed Description

Adds functionality to :class:`DataDevice` to support cameras.

Defines the interface for cameras.  Applies a transform to
acquired data in the processing step.

Definition at line 819 of file abc.py.

Constructor & Destructor Documentation

◆ __init__()

None microscope.abc.Camera.__init__ (   self,
**  buffer_length 
)
Derived.__init__ must call this at some point.

Reimplemented from microscope.abc.DataDevice.

Reimplemented in microscope.simulators.SimulatedCamera, microscope.testsuite.devices.TestCamera, microscope.cameras.picam.PiCamera, microscope.simulators.stage_aware_camera.StageAwareCamera, and microscope.cameras.ximea.XimeaCamera.

Definition at line 829 of file abc.py.

829 def __init__(self, **kwargs) -> None:
830 super().__init__(**kwargs)
831 # A list of readout mode descriptions.
832 self._readout_modes = ["default"]
833 # The index of the current readout mode.
834 self._readout_mode = 0
835 # Transforms to apply to data (fliplr, flipud, rot90)
836 # Transform to correct for readout order.
837 self._readout_transform = (False, False, False)
838 # Transform supplied by client to correct for system geometry.
839 self._client_transform = (False, False, False)
840 # Result of combining client and readout transforms
841 self._transform = (False, False, False)
842 # A transform provided by the client.
843 self.add_setting(
844 "transform",
845 "enum",
846 lambda: Camera.ALLOWED_TRANSFORMS.index(self._transform),
847 lambda index: self.set_transform(Camera.ALLOWED_TRANSFORMS[index]),
848 Camera.ALLOWED_TRANSFORMS,
849 )
850 self.add_setting(
851 "readout mode",
852 "enum",
853 lambda: self._readout_mode,
854 self.set_readout_mode,
855 lambda: self._readout_modes,
856 )
857 self.add_setting("roi", "tuple", self.get_roi, self.set_roi, None)
858

References microscope.abc.Camera.__init__(), microscope.abc.Camera._client_transform, microscope.abc.Camera._readout_mode, microscope.cameras.pvcam.PVCamera._readout_mode, microscope.abc.Camera._readout_modes, microscope.cameras.atmcd.AndorAtmcd._readout_modes, microscope.cameras.pvcam.PVCamera._readout_modes, microscope.abc.Camera._readout_transform, microscope.abc.Camera._transform, microscope.abc.Device.add_setting(), microscope.abc.Camera.get_roi(), microscope.abc.Camera.set_readout_mode(), microscope.cameras.pvcam.PVCamera.set_readout_mode(), microscope.abc.Camera.set_roi(), and microscope.abc.Camera.set_transform().

Referenced by microscope.abc.Camera.__init__().

Member Function Documentation

◆ get_binning()

microscope.Binning microscope.abc.Camera.get_binning (   self)
Return the current binning corrected for transform.

Definition at line 933 of file abc.py.

933 def get_binning(self) -> microscope.Binning:
934 """Return the current binning corrected for transform."""
935 binning = self._get_binning()
936 if self._transform[2]:
937 # 90 degree rotation
938 binning = microscope.Binning(binning[1], binning[0])
939 return binning
940

Referenced by microscope.cameras.atmcd.AndorAtmcd.initialize(), and microscope.abc.Camera.set_roi().

◆ get_cycle_time()

float microscope.abc.Camera.get_cycle_time (   self)
Return the cycle time in seconds.

Reimplemented in microscope.cameras.andorsdk3.AndorSDK3, microscope.cameras.atmcd.AndorAtmcd, microscope.cameras.picam.PiCamera, microscope.cameras.pvcam.PVCamera, microscope.cameras.ximea.XimeaCamera, and microscope.simulators.SimulatedCamera.

Definition at line 911 of file abc.py.

911 def get_cycle_time(self) -> float:
912 """Return the cycle time in seconds."""
913 pass
914

◆ get_exposure_time()

float microscope.abc.Camera.get_exposure_time (   self)
Return the current exposure time in seconds.

Reimplemented in microscope.cameras.andorsdk3.AndorSDK3, microscope.cameras.atmcd.AndorAtmcd, microscope.cameras.picam.PiCamera, microscope.cameras.pvcam.PVCamera, microscope.cameras.ximea.XimeaCamera, and microscope.simulators.SimulatedCamera.

Definition at line 907 of file abc.py.

907 def get_exposure_time(self) -> float:
908 """Return the current exposure time in seconds."""
909 pass
910

◆ get_roi()

microscope.ROI microscope.abc.Camera.get_roi (   self)

◆ get_sensor_shape()

typing.Tuple[int, int] microscope.abc.Camera.get_sensor_shape (   self)
Return a tuple of `(width, height)` corrected for transform.

Definition at line 920 of file abc.py.

920 def get_sensor_shape(self) -> typing.Tuple[int, int]:
921 """Return a tuple of `(width, height)` corrected for transform."""
922 shape = self._get_sensor_shape()
923 if self._transform[2]:
924 # 90 degree rotation
925 shape = (shape[1], shape[0])
926 return shape
927

Referenced by microscope.abc.Camera.set_roi().

◆ get_transform()

def microscope.abc.Camera.get_transform (   self)
Return the current transform without readout transform.

Definition at line 880 of file abc.py.

880 def get_transform(self):
881 """Return the current transform without readout transform."""
882 return self._client_transform
883

◆ set_binning()

None microscope.abc.Camera.set_binning (   self,
microscope.Binning  binning 
)
Set binning along both axes.  Return `True` if successful.

Definition at line 946 of file abc.py.

946 def set_binning(self, binning: microscope.Binning) -> None:
947 """Set binning along both axes. Return `True` if successful."""
948 h_bin, v_bin = binning
949 if self._transform[2]:
950 # 90 degree rotation
951 binning = microscope.Binning(v_bin, h_bin)
952 else:
953 binning = microscope.Binning(h_bin, v_bin)
954 return self._set_binning(binning)
955

References microscope.cameras.andorsdk3.AndorSDK3._set_binning(), microscope.cameras.atmcd.AndorAtmcd._set_binning(), microscope.cameras.pvcam.PVCamera._set_binning(), microscope.simulators.SimulatedCamera._set_binning(), microscope.cameras.picam.PiCamera._set_binning(), microscope.abc.Camera._set_binning(), microscope.cameras.ximea.XimeaCamera._set_binning(), and microscope.abc.Camera._transform.

Referenced by microscope.cameras.atmcd.AndorAtmcd.initialize().

◆ set_exposure_time()

None microscope.abc.Camera.set_exposure_time (   self,
float  value 
)
Set the exposure time on the device in seconds.

Reimplemented in microscope.cameras.ximea.XimeaCamera, microscope.cameras.andorsdk3.AndorSDK3, microscope.cameras.atmcd.AndorAtmcd, microscope.cameras.picam.PiCamera, microscope.cameras.pvcam.PVCamera, and microscope.simulators.SimulatedCamera.

Definition at line 903 of file abc.py.

903 def set_exposure_time(self, value: float) -> None:
904 """Set the exposure time on the device in seconds."""
905 pass
906

◆ set_readout_mode()

def microscope.abc.Camera.set_readout_mode (   self,
  description 
)
Set the readout mode and _readout_transform.

Reimplemented in microscope.cameras.pvcam.PVCamera.

Definition at line 876 of file abc.py.

876 def set_readout_mode(self, description):
877 """Set the readout mode and _readout_transform."""
878 pass
879

Referenced by microscope.abc.Camera.__init__(), and microscope.cameras.pvcam.PVCamera.initialize().

◆ set_roi()

None microscope.abc.Camera.set_roi (   self,
microscope.ROI  roi 
)
Set the ROI according to the provided rectangle.

Return True if ROI set correctly, False otherwise.

Definition at line 974 of file abc.py.

974 def set_roi(self, roi: microscope.ROI) -> None:
975 """Set the ROI according to the provided rectangle.
976
977 Return True if ROI set correctly, False otherwise.
978 """
979 maxw, maxh = self.get_sensor_shape()
980 binning = self.get_binning()
981 left, top, width, height = roi
982 if not width: # 0 or None
983 width = maxw // binning.h
984 if not height: # 0 or None
985 height = maxh // binning.v
986 if self._transform[2]:
987 roi = microscope.ROI(left, top, height, width)
988 else:
989 roi = microscope.ROI(left, top, width, height)
990 return self._set_roi(roi)
991
992

References microscope.cameras.picam.PiCamera._set_roi(), microscope.abc.Camera._set_roi(), microscope.cameras.ximea.XimeaCamera._set_roi(), microscope.cameras.andorsdk3.AndorSDK3._set_roi(), microscope.cameras.atmcd.AndorAtmcd._set_roi(), microscope.cameras.pvcam.PVCamera._set_roi(), microscope.simulators.SimulatedCamera._set_roi(), microscope.abc.Camera._transform, microscope.abc.Camera.get_binning(), and microscope.abc.Camera.get_sensor_shape().

Referenced by microscope.abc.Camera.__init__(), microscope.cameras.atmcd.AndorAtmcd.initialize(), and microscope.cameras.ximea.XimeaCamera.initialize().

◆ set_transform()

def microscope.abc.Camera.set_transform (   self,
  transform 
)
Combine provided transform with readout transform.

Definition at line 884 of file abc.py.

884 def set_transform(self, transform):
885 """Combine provided transform with readout transform."""
886 if isinstance(transform, str):
887 transform = literal_eval(transform)
888 self._client_transform = transform
889 lr, ud, rot = (
890 self._readout_transform[i] ^ transform[i] for i in range(3)
891 )
892 if self._readout_transform[2] and self._client_transform[2]:
893 lr = not lr
894 ud = not ud
895 self._transform = (lr, ud, rot)
896

References microscope.abc.Camera._client_transform, microscope.abc.Camera._readout_transform, microscope.abc.Camera._transform, and microscope.abc.Camera.set_transform().

Referenced by microscope.abc.Camera.__init__(), and microscope.abc.Camera.set_transform().

Member Data Documentation

◆ ALLOWED_TRANSFORMS

list microscope.abc.Camera.ALLOWED_TRANSFORMS = [p for p in itertools.product(*3 * [[False, True]])]
static

Definition at line 827 of file abc.py.


The documentation for this class was generated from the following file: