pco


Namepco JSON
Version 2.1.2 PyPI version JSON
download
home_pagehttps://www.excelitas.com/de/product/pco-software-development-kits/
SummaryThis class provides methods for using pco cameras.
upload_time2024-02-29 16:12:46
maintainer
docs_urlNone
authorExcelitas PCO GmbH
requires_python
licenseMIT
keywords pco camera flim scmos microscopy
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            .. figure:: https://www.excelitas.com/sites/default/files/2021-09/PCO-EXC1%20logo%20blue%202c%20Spot%20pms307C%2BK.png
   :width: 200pt

  
|PyPI-Versions| |LICENCE| |Platform| |PyPI-Status|


The Python package **pco** is a powerful and easy to use high level Software Development Kit (SDK)
for working with PCO cameras. It contains everything needed for camera setup, image acquistion,
readout and color conversion.

The high-level class architecture makes it very easy to integrate PCO cameras into your own
software, while still having access to the underlying pco.sdk and pco.recorder interface for a
detailed control of all possible functionalities.

- **Documentation**: `Manual <https://www.excelitas.com/file-download/download/public/102695?filename=pco_python_Manual.pdf>`_
- **Website**: https://www.excelitas.com/product-category/pco
- **Support**: support.pco@excelitas.com

Installation
============
Install from pypi (recommended)::

    $ pip install pco


For cameras with USB interface on linux you will need to add usb rules to the system.
This can be done with executing the following command (**sudo** permissions required):

.. code-block:: bash
  
    [ ! -f "/etc/udev/rules.d/pco_usb.rules" ] && sudo mkdir -p "/etc/udev/rules.d" && echo 'SUBSYSTEM=="usb" , ATTR{idVendor}=="1cb2" , GROUP="video" , MODE="0666" , SYMLINK+="pco_usb_camera%n"' | sudo tee /etc/udev/rules.d/pco_usb.rules > /dev/null && udevadm trigger || true


Basic Usage
===========
.. code-block:: python

    import pco
    import matplotlib.pyplot as plt

    with pco.Camera() as cam:

        cam.record(mode="sequence")
        image, meta = cam.image()

        plt.imshow(image, cmap='gray')
        plt.show()


Recorder Modes
==============
Depending on your workflow you can choose between different recording modes. 

Some modes are blocking, i.e. the ``record()`` function waits until recording is finished, some are non-blocking.
Some of them are storing the images in memory, the others directly as file(s) on the disk.
However, for the recorder modes which store the images as files,
accessing the recorded images is identical with the modes which store the images in memory.

.. list-table:: record modes
  :widths: 20 10 10 60
  :header-rows: 1

  * - Mode
    - Storage
    - Blocking
    - Description
  
  * - ``sequence``
    - Memory
    - yes
    - Record a sequence of images.
  
  * - ``sequence non blocking``
    - Memory
    - no 
    - Record a sequence of images, do not wait until record is finished.
  
  * - ``ring buffer``
    - Memory
    - no 
    - Continuously record images in a ringbuffer, once the buffer is full, old images are overwritten.
  
  * - ``fifo``
    - Memory
    - no 
    - Record images in fifo mode, i.e. you will always read images sequentially and once the buffer is full, recording will pause until older images have been read.
  
  * - ``sequence dpcore``
    - Memory
    - yes
    - Same as ``sequence``, but with DotPhoton preparation enabled.
  
  * - ``sequence non blocking dpcore``
    - Memory
    - no 
    - Same as ``sequence_non_blocking``, but with DotPhoton preparation enabled.
  
  * - ``ring buffer dpcore``
    - Memory
    - no 
    - Same as ``ring_buffer``, but with DotPhoton preparation enabled.
  
  * - ``fifo dpcore``
    - Memory
    - no 
    - Same as ``fifo``, but with DotPhoton preparation enabled.
  
  * - ``tif``
    - File  
    - no 
    - Record images directly as tif files.
  
  * - ``multitif``
    - File  
    - no 
    - Record images directly as one or more multitiff file(s).
  
  * - ``pcoraw``
    - File  
    - no 
    - Record images directly as one pcoraw file.
  
  * - ``dicom``
    - File  
    - no 
    - Record images directly as dicom files.
  
  * - ``multidicom``
    - File  
    - no 
    - Record images directly as one or more multi-dicom file(s).
  
  * - ``camram segment``
    - Ram
    - no
    - Record images and stop if cam ram segment is full
  
  * - ``camram ring``
    - Ram
    - no
    - Record images and use cam ram segment as ring buffer

Image Formats
=============
All image data is always transferred as 2D or 3D numpy array.
Besides the standard 16 bit raw image data you also have the possibility to get your images in different formats,
shown in the table below.

The format is selected when calling the ``image()`` / ``images()`` / ``image_average()`` functions of the Camera class. 
The image data is stored as numpy array, which enables you to work with it in the most pythonic way.

.. list-table:: image formats
  :widths: 30 70
  :header-rows: 1

  * - Format
    - Description
  
  * - ``Mono8,mono8``
    - Get image as 8 bit grayscale data.
  
  * - ``Mono16,mono16,raw16,bw16``
    - Get image as 16 bit grayscale/raw data.
  
  * - ``BGR8,bgr``
    - Get image as 24 bit color data in bgr format.
  
  * - ``RGB8,rgb``
    - Get image as 24 bit color data in rgb format.
  
  * - ``BGRA8,bgra8,bgra``
    - Get image as 32 bit color data (with alpha channel) in bgra format.
  
  * - ``RGBA8,rgba8,rgba``
    - Get image as 32 bit color data (with alpha channel) in rgba format.
  
  * - ``BGR16,bgr16``
    - Get image as 48 bit color data in bgr format (only possible for color cameras).
  
  * - ``RGB16,rgb16``
    - Get image as 48 bit color data in rgb format (only possible for color cameras).


Logging
=======

Logging is implemented according to the python logging package (https://docs.python.org/3/library/logging.html).
Supported logging levels are:

- `ERROR`
- `WARNING`
- `INFO`
- `DEBUG`

.. code-block:: python

    logger = logging.getLogger("pco")
    logger.setLevel(logging.INFO)
    logger.addHandler(pco.stream_handler)

.. code-block:: python

    ...
    [2023-10-16 16:33:10,450] [3.930 s] [sdk] open_camera_ex: OK.
    ...
    [2023-10-16 16:33:13,485] [0.001 s] [rec] copy_image: OK.
    ...


Documentation (overview)
========================
The full Documentation can be found in the `manual <https://www.excelitas.com/file-download/download/public/102695?filename=pco_python_Manual.pdf>`_

The pco.Camera class offers the following methods:

- ``__init()__`` Open and initializes a camera with its default configuration.
- ``__exit()__`` Close the camera and cleans up everything (e.g. end of with-statement).
- ``close()`` Close the camera and cleans up everything.
- ``default_configuration()`` Set default configuration to the camera
- ``record()`` Initialize and start the recording of images.
- ``stop()`` Stop the current recording.
- ``wait_for_first_image()`` Wait until the first image has been recorded.
- ``wait_for_new_image()`` Wait until a new image has been recorded.
- ``get_convert_control()`` Get current color convert settings.
- ``set_convert_control()`` Set new color convert settings.
- ``load_lut()`` Set the lut file for the convert control setting.
- ``adapt_white_balance()`` Do a white-balance according to a transferred image.
- ``image()`` Read a recorded image as numpy array.
- ``images()`` Read a series of recorded images as a list of numpy arrays.
- ``image_average()`` Read an averaged image (averaged over all recorded images) as numpy array.
- ``switch_to_camram()`` Set camram segment for read via image functions.
- ``set_camram_allocation()`` Set allocation distribution of camram segments.


The pco.Camera class has the following properties:

- ``camera_name`` get the camera name.
- ``camera_serial`` get the serial number of the camera.
- ``is_recording`` get a flag to indicate if the camera is currently recording.
- ``is_color`` get a flag to indicate if the camera is a color camera.
- ``recorded_image_count`` get the number of currently recorded images.
- ``configuration`` get/set the camera configuration.
- ``description`` get the (static) camera description parameters.
- ``exposure_time`` get/set the exposure time (in seconds).
- ``delay_time`` get/set the delay time (in seconds).
- ``has_ram`` get flag that indicates camram support of the camera.
- ``camram_segment`` get segment number of active camram segment
- ``camram_max_images`` get number of images that can be stored in the active camram segment
- ``camram_num_images`` get number of images that are available in the active camram segment

The pco.Camera class holds the following objects:

- ``sdk`` offer direct access to all underlying functions of the pco.sdk.
- ``rec`` offer direct access to all underlying functions of the pco.recorder.
- ``conv`` offer direct access to all underlying functions of the pco.convert according to the selected image format.


.. |PyPI-Versions| image:: https://img.shields.io/pypi/pyversions/pco.svg
   :target: https://pypi.python.org/pypi/pco

.. |LICENCE| image:: https://img.shields.io/badge/License-MIT-green.svg
   :target: https://opensource.org/licenses/MIT

.. |Platform| image:: https://img.shields.io/badge/platform-win_x64%20%7C%20linux_x64-green.svg
   :target: https://pypi.python.org/pypi/pco
   
.. |PyPI-Status| image:: https://img.shields.io/pypi/v/pco.svg
  :target: https://pypi.python.org/pypi/pco


            

Raw data

            {
    "_id": null,
    "home_page": "https://www.excelitas.com/de/product/pco-software-development-kits/",
    "name": "pco",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "pco,camera,flim,scmos,microscopy",
    "author": "Excelitas PCO GmbH",
    "author_email": "support.pco@excelitas.com",
    "download_url": "https://files.pythonhosted.org/packages/58/44/2d003ebf8c4d076db5da9aa95eb710ce0e4a99ca1128a1bc35c9b4139c12/pco-2.1.2.tar.gz",
    "platform": null,
    "description": ".. figure:: https://www.excelitas.com/sites/default/files/2021-09/PCO-EXC1%20logo%20blue%202c%20Spot%20pms307C%2BK.png\n   :width: 200pt\n\n  \n|PyPI-Versions| |LICENCE| |Platform| |PyPI-Status|\n\n\nThe Python package **pco** is a powerful and easy to use high level Software Development Kit (SDK)\nfor working with PCO cameras. It contains everything needed for camera setup, image acquistion,\nreadout and color conversion.\n\nThe high-level class architecture makes it very easy to integrate PCO cameras into your own\nsoftware, while still having access to the underlying pco.sdk and pco.recorder interface for a\ndetailed control of all possible functionalities.\n\n- **Documentation**: `Manual <https://www.excelitas.com/file-download/download/public/102695?filename=pco_python_Manual.pdf>`_\n- **Website**: https://www.excelitas.com/product-category/pco\n- **Support**: support.pco@excelitas.com\n\nInstallation\n============\nInstall from pypi (recommended)::\n\n    $ pip install pco\n\n\nFor cameras with USB interface on linux you will need to add usb rules to the system.\nThis can be done with executing the following command (**sudo** permissions required):\n\n.. code-block:: bash\n  \n    [ ! -f \"/etc/udev/rules.d/pco_usb.rules\" ] && sudo mkdir -p \"/etc/udev/rules.d\" && echo 'SUBSYSTEM==\"usb\" , ATTR{idVendor}==\"1cb2\" , GROUP=\"video\" , MODE=\"0666\" , SYMLINK+=\"pco_usb_camera%n\"' | sudo tee /etc/udev/rules.d/pco_usb.rules > /dev/null && udevadm trigger || true\n\n\nBasic Usage\n===========\n.. code-block:: python\n\n    import pco\n    import matplotlib.pyplot as plt\n\n    with pco.Camera() as cam:\n\n        cam.record(mode=\"sequence\")\n        image, meta = cam.image()\n\n        plt.imshow(image, cmap='gray')\n        plt.show()\n\n\nRecorder Modes\n==============\nDepending on your workflow you can choose between different recording modes. \n\nSome modes are blocking, i.e. the ``record()`` function waits until recording is finished, some are non-blocking.\nSome of them are storing the images in memory, the others directly as file(s) on the disk.\nHowever, for the recorder modes which store the images as files,\naccessing the recorded images is identical with the modes which store the images in memory.\n\n.. list-table:: record modes\n  :widths: 20 10 10 60\n  :header-rows: 1\n\n  * - Mode\n    - Storage\n    - Blocking\n    - Description\n  \n  * - ``sequence``\n    - Memory\n    - yes\n    - Record a sequence of images.\n  \n  * - ``sequence non blocking``\n    - Memory\n    - no \n    - Record a sequence of images, do not wait until record is finished.\n  \n  * - ``ring buffer``\n    - Memory\n    - no \n    - Continuously record images in a ringbuffer, once the buffer is full, old images are overwritten.\n  \n  * - ``fifo``\n    - Memory\n    - no \n    - Record images in fifo mode, i.e. you will always read images sequentially and once the buffer is full, recording will pause until older images have been read.\n  \n  * - ``sequence dpcore``\n    - Memory\n    - yes\n    - Same as ``sequence``, but with DotPhoton preparation enabled.\n  \n  * - ``sequence non blocking dpcore``\n    - Memory\n    - no \n    - Same as ``sequence_non_blocking``, but with DotPhoton preparation enabled.\n  \n  * - ``ring buffer dpcore``\n    - Memory\n    - no \n    - Same as ``ring_buffer``, but with DotPhoton preparation enabled.\n  \n  * - ``fifo dpcore``\n    - Memory\n    - no \n    - Same as ``fifo``, but with DotPhoton preparation enabled.\n  \n  * - ``tif``\n    - File  \n    - no \n    - Record images directly as tif files.\n  \n  * - ``multitif``\n    - File  \n    - no \n    - Record images directly as one or more multitiff file(s).\n  \n  * - ``pcoraw``\n    - File  \n    - no \n    - Record images directly as one pcoraw file.\n  \n  * - ``dicom``\n    - File  \n    - no \n    - Record images directly as dicom files.\n  \n  * - ``multidicom``\n    - File  \n    - no \n    - Record images directly as one or more multi-dicom file(s).\n  \n  * - ``camram segment``\n    - Ram\n    - no\n    - Record images and stop if cam ram segment is full\n  \n  * - ``camram ring``\n    - Ram\n    - no\n    - Record images and use cam ram segment as ring buffer\n\nImage Formats\n=============\nAll image data is always transferred as 2D or 3D numpy array.\nBesides the standard 16 bit raw image data you also have the possibility to get your images in different formats,\nshown in the table below.\n\nThe format is selected when calling the ``image()`` / ``images()`` / ``image_average()`` functions of the Camera class. \nThe image data is stored as numpy array, which enables you to work with it in the most pythonic way.\n\n.. list-table:: image formats\n  :widths: 30 70\n  :header-rows: 1\n\n  * - Format\n    - Description\n  \n  * - ``Mono8,mono8``\n    - Get image as 8 bit grayscale data.\n  \n  * - ``Mono16,mono16,raw16,bw16``\n    - Get image as 16 bit grayscale/raw data.\n  \n  * - ``BGR8,bgr``\n    - Get image as 24 bit color data in bgr format.\n  \n  * - ``RGB8,rgb``\n    - Get image as 24 bit color data in rgb format.\n  \n  * - ``BGRA8,bgra8,bgra``\n    - Get image as 32 bit color data (with alpha channel) in bgra format.\n  \n  * - ``RGBA8,rgba8,rgba``\n    - Get image as 32 bit color data (with alpha channel) in rgba format.\n  \n  * - ``BGR16,bgr16``\n    - Get image as 48 bit color data in bgr format (only possible for color cameras).\n  \n  * - ``RGB16,rgb16``\n    - Get image as 48 bit color data in rgb format (only possible for color cameras).\n\n\nLogging\n=======\n\nLogging is implemented according to the python logging package (https://docs.python.org/3/library/logging.html).\nSupported logging levels are:\n\n- `ERROR`\n- `WARNING`\n- `INFO`\n- `DEBUG`\n\n.. code-block:: python\n\n    logger = logging.getLogger(\"pco\")\n    logger.setLevel(logging.INFO)\n    logger.addHandler(pco.stream_handler)\n\n.. code-block:: python\n\n    ...\n    [2023-10-16 16:33:10,450] [3.930 s] [sdk] open_camera_ex: OK.\n    ...\n    [2023-10-16 16:33:13,485] [0.001 s] [rec] copy_image: OK.\n    ...\n\n\nDocumentation (overview)\n========================\nThe full Documentation can be found in the `manual <https://www.excelitas.com/file-download/download/public/102695?filename=pco_python_Manual.pdf>`_\n\nThe pco.Camera class offers the following methods:\n\n- ``__init()__`` Open and initializes a camera with its default configuration.\n- ``__exit()__`` Close the camera and cleans up everything (e.g. end of with-statement).\n- ``close()`` Close the camera and cleans up everything.\n- ``default_configuration()`` Set default configuration to the camera\n- ``record()`` Initialize and start the recording of images.\n- ``stop()`` Stop the current recording.\n- ``wait_for_first_image()`` Wait until the first image has been recorded.\n- ``wait_for_new_image()`` Wait until a new image has been recorded.\n- ``get_convert_control()`` Get current color convert settings.\n- ``set_convert_control()`` Set new color convert settings.\n- ``load_lut()`` Set the lut file for the convert control setting.\n- ``adapt_white_balance()`` Do a white-balance according to a transferred image.\n- ``image()`` Read a recorded image as numpy array.\n- ``images()`` Read a series of recorded images as a list of numpy arrays.\n- ``image_average()`` Read an averaged image (averaged over all recorded images) as numpy array.\n- ``switch_to_camram()`` Set camram segment for read via image functions.\n- ``set_camram_allocation()`` Set allocation distribution of camram segments.\n\n\nThe pco.Camera class has the following properties:\n\n- ``camera_name`` get the camera name.\n- ``camera_serial`` get the serial number of the camera.\n- ``is_recording`` get a flag to indicate if the camera is currently recording.\n- ``is_color`` get a flag to indicate if the camera is a color camera.\n- ``recorded_image_count`` get the number of currently recorded images.\n- ``configuration`` get/set the camera configuration.\n- ``description`` get the (static) camera description parameters.\n- ``exposure_time`` get/set the exposure time (in seconds).\n- ``delay_time`` get/set the delay time (in seconds).\n- ``has_ram`` get flag that indicates camram support of the camera.\n- ``camram_segment`` get segment number of active camram segment\n- ``camram_max_images`` get number of images that can be stored in the active camram segment\n- ``camram_num_images`` get number of images that are available in the active camram segment\n\nThe pco.Camera class holds the following objects:\n\n- ``sdk`` offer direct access to all underlying functions of the pco.sdk.\n- ``rec`` offer direct access to all underlying functions of the pco.recorder.\n- ``conv`` offer direct access to all underlying functions of the pco.convert according to the selected image format.\n\n\n.. |PyPI-Versions| image:: https://img.shields.io/pypi/pyversions/pco.svg\n   :target: https://pypi.python.org/pypi/pco\n\n.. |LICENCE| image:: https://img.shields.io/badge/License-MIT-green.svg\n   :target: https://opensource.org/licenses/MIT\n\n.. |Platform| image:: https://img.shields.io/badge/platform-win_x64%20%7C%20linux_x64-green.svg\n   :target: https://pypi.python.org/pypi/pco\n   \n.. |PyPI-Status| image:: https://img.shields.io/pypi/v/pco.svg\n  :target: https://pypi.python.org/pypi/pco\n\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "This class provides methods for using pco cameras.",
    "version": "2.1.2",
    "project_urls": {
        "Homepage": "https://www.excelitas.com/de/product/pco-software-development-kits/"
    },
    "split_keywords": [
        "pco",
        "camera",
        "flim",
        "scmos",
        "microscopy"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "3a6de4a1704d0d21cb11af262dd29f0af6e69d05705a6c1e41cbed567c1f32fc",
                "md5": "e906ac85dff3bd29c7eee83adcdbc826",
                "sha256": "9706f70eca02009ecde3043dc50306f9ed28a0e313501c39bd839b459054604b"
            },
            "downloads": -1,
            "filename": "pco-2.1.2-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "e906ac85dff3bd29c7eee83adcdbc826",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 92304856,
            "upload_time": "2024-02-29T16:12:40",
            "upload_time_iso_8601": "2024-02-29T16:12:40.867722Z",
            "url": "https://files.pythonhosted.org/packages/3a/6d/e4a1704d0d21cb11af262dd29f0af6e69d05705a6c1e41cbed567c1f32fc/pco-2.1.2-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "58442d003ebf8c4d076db5da9aa95eb710ce0e4a99ca1128a1bc35c9b4139c12",
                "md5": "cdaa7b79f7dc0ddc2965d0c79c9235aa",
                "sha256": "eaa9d359e3ef99c12962d9c4560c5143535dd23a2da6ed1d3a5a4d2d6f7ccaca"
            },
            "downloads": -1,
            "filename": "pco-2.1.2.tar.gz",
            "has_sig": false,
            "md5_digest": "cdaa7b79f7dc0ddc2965d0c79c9235aa",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 440146,
            "upload_time": "2024-02-29T16:12:46",
            "upload_time_iso_8601": "2024-02-29T16:12:46.478027Z",
            "url": "https://files.pythonhosted.org/packages/58/44/2d003ebf8c4d076db5da9aa95eb710ce0e4a99ca1128a1bc35c9b4139c12/pco-2.1.2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-02-29 16:12:46",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "pco"
}
        
Elapsed time: 0.19181s