imswitchclient


Nameimswitchclient JSON
Version 0.1.2 PyPI version JSON
download
home_pagehttps://github.com/beniroquai/imswitchclient
SummaryThis is a package that connects ImSwitch's REST API to the rest of the world (e.g. jupyter lab)
upload_time2024-04-23 06:02:02
maintainerNone
docs_urlNone
authorBenedict Diederich
requires_python>=3.6
licenseMIT license
keywords imswitchclient
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # ImSwitchClient Documentation

`ImSwitchClient` is a Python package designed to connect to the ImSwitch REST API, enabling remote control of ImSwitchUC2 functionalities directly from Jupyter Notebooks. This client facilitates easy integration with the ImSwitch ecosystem, offering programmable access to various features like laser control, stage manipulation, and image acquisition.

[![PyPI Version](https://img.shields.io/pypi/v/imswitchclient.svg)](https://pypi.python.org/pypi/imswitchclient)

## Features

- **Remote Control**: Interact with ImSwitchUC2 from Jupyter Notebooks via fastapi endpoints.
- **Comprehensive Documentation**: Access detailed documentation and explore API endpoints at [https://imswitchclient.readthedocs.io](https://imswitchclient.readthedocs.io).
- **API Exploration**: Utilize FastAPI's interface at http://localhost:8000/docs for an interactive API experience.
- **Broad Functionality**: Current implementations include laser control, stage manipulation, and image acquisition, with the possibility for future expansion based on user requests.
- **Global API Testing**: Test the client using the globally hosted API at [https://youseetoo.github.io/imswitch/api.html](https://youseetoo.github.io/imswitch/api.html).
- **Open Source**: Inspired by the OpenFlexure Client, `ImSwitchClient` is freely available for modification and distribution under the MIT license.
- **Implemented functions** (so far, please file an issue for feature requests):
  - Laser
  - Stage
  - Image Acquisition
- You can test the client with the globally hosted api here: https://youseetoo.github.io/imswitch/api.html
- It is inspired by the OpenFlexure Client: https://gitlab.com/openflexure/openflexure-microscope-pyclient/-/blob/master/openflexure_microscope_client/microscope_client.py
- The source files can be found here: https://github.com/openUC2/imswitchclient/

## Installation

To install `ImSwitchClient`, use the following pip command:

```bash
pip install imswitchclient
```

## Quick Start Example

This example demonstrates basic usage of `ImSwitchClient` for moving a positioner and acquiring an image.

```python
import imswitchclient.ImSwitchClient as imc 
import numpy as np
import matplotlib.pyplot as plt
import time

# Initialize the client
client = imc.ImSwitchClient()

# Retrieve the first positioner's name and current position
positioner_names = client.positionersManager.getAllDeviceNames()
positioner_name = positioner_names[0]
currentPositions = client.positionersManager.getPositionerPositions()[positioner_name]
initialPosition = (currentPositions["X"], currentPositions["Y"])

# turn on illumination
mLaserName = client.lasersManager.getLaserNames()[0]
client.lasersManager.setLaserActive(mLaserName, True)
client.lasersManager.setLaserValue(mLaserName, 512)

for ix in range(10):
    for iy in range(10):
        # Define and move to a new position
        newPosition = (initialPosition[0] + ix*50, initialPosition[1] + iy*50)
        client.positionersManager.movePositioner(positioner_name, "X", newPosition[0], is_absolute=True, is_blocking=True)
        client.positionersManager.movePositioner(positioner_name, "Y", newPosition[1], is_absolute=True, is_blocking=True)
        
        # Acquire and display an image
        #time.sleep(0.5)  # Allow time for the move
        lastFrame = client.recordingManager.snapNumpyToFastAPI()
        plt.imshow(lastFrame)
        plt.show()
        
        # Return the positioner to its initial position
        client.positionersManager.movePositioner(positioner_name, "X", initialPosition[0], is_absolute=True, is_blocking=True)
        client.positionersManager.movePositioner(positioner_name, "Y", initialPosition[1], is_absolute=True, is_blocking=True)
```

## Contributing

Contributions to `ImSwitchClient` are welcome! Please refer to the project's GitHub repository for contribution guidelines: [https://github.com/openUC2/imswitchclient/](https://github.com/openUC2/imswitchclient/).

## License

`ImSwitchClient` is licensed under the MIT License. For more details, see the LICENSE file in the project repository.


            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/beniroquai/imswitchclient",
    "name": "imswitchclient",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.6",
    "maintainer_email": null,
    "keywords": "imswitchclient",
    "author": "Benedict Diederich",
    "author_email": "benedictdied@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/cd/96/ac785b2792731d9917ca77e1fe39df5db65c460db75624f3e2de274decea/imswitchclient-0.1.2.tar.gz",
    "platform": null,
    "description": "# ImSwitchClient Documentation\n\n`ImSwitchClient` is a Python package designed to connect to the ImSwitch REST API, enabling remote control of ImSwitchUC2 functionalities directly from Jupyter Notebooks. This client facilitates easy integration with the ImSwitch ecosystem, offering programmable access to various features like laser control, stage manipulation, and image acquisition.\n\n[![PyPI Version](https://img.shields.io/pypi/v/imswitchclient.svg)](https://pypi.python.org/pypi/imswitchclient)\n\n## Features\n\n- **Remote Control**: Interact with ImSwitchUC2 from Jupyter Notebooks via fastapi endpoints.\n- **Comprehensive Documentation**: Access detailed documentation and explore API endpoints at [https://imswitchclient.readthedocs.io](https://imswitchclient.readthedocs.io).\n- **API Exploration**: Utilize FastAPI's interface at http://localhost:8000/docs for an interactive API experience.\n- **Broad Functionality**: Current implementations include laser control, stage manipulation, and image acquisition, with the possibility for future expansion based on user requests.\n- **Global API Testing**: Test the client using the globally hosted API at [https://youseetoo.github.io/imswitch/api.html](https://youseetoo.github.io/imswitch/api.html).\n- **Open Source**: Inspired by the OpenFlexure Client, `ImSwitchClient` is freely available for modification and distribution under the MIT license.\n- **Implemented functions** (so far, please file an issue for feature requests):\n  - Laser\n  - Stage\n  - Image Acquisition\n- You can test the client with the globally hosted api here: https://youseetoo.github.io/imswitch/api.html\n- It is inspired by the OpenFlexure Client: https://gitlab.com/openflexure/openflexure-microscope-pyclient/-/blob/master/openflexure_microscope_client/microscope_client.py\n- The source files can be found here: https://github.com/openUC2/imswitchclient/\n\n## Installation\n\nTo install `ImSwitchClient`, use the following pip command:\n\n```bash\npip install imswitchclient\n```\n\n## Quick Start Example\n\nThis example demonstrates basic usage of `ImSwitchClient` for moving a positioner and acquiring an image.\n\n```python\nimport imswitchclient.ImSwitchClient as imc \nimport numpy as np\nimport matplotlib.pyplot as plt\nimport time\n\n# Initialize the client\nclient = imc.ImSwitchClient()\n\n# Retrieve the first positioner's name and current position\npositioner_names = client.positionersManager.getAllDeviceNames()\npositioner_name = positioner_names[0]\ncurrentPositions = client.positionersManager.getPositionerPositions()[positioner_name]\ninitialPosition = (currentPositions[\"X\"], currentPositions[\"Y\"])\n\n# turn on illumination\nmLaserName = client.lasersManager.getLaserNames()[0]\nclient.lasersManager.setLaserActive(mLaserName, True)\nclient.lasersManager.setLaserValue(mLaserName, 512)\n\nfor ix in range(10):\n    for iy in range(10):\n        # Define and move to a new position\n        newPosition = (initialPosition[0] + ix*50, initialPosition[1] + iy*50)\n        client.positionersManager.movePositioner(positioner_name, \"X\", newPosition[0], is_absolute=True, is_blocking=True)\n        client.positionersManager.movePositioner(positioner_name, \"Y\", newPosition[1], is_absolute=True, is_blocking=True)\n        \n        # Acquire and display an image\n        #time.sleep(0.5)  # Allow time for the move\n        lastFrame = client.recordingManager.snapNumpyToFastAPI()\n        plt.imshow(lastFrame)\n        plt.show()\n        \n        # Return the positioner to its initial position\n        client.positionersManager.movePositioner(positioner_name, \"X\", initialPosition[0], is_absolute=True, is_blocking=True)\n        client.positionersManager.movePositioner(positioner_name, \"Y\", initialPosition[1], is_absolute=True, is_blocking=True)\n```\n\n## Contributing\n\nContributions to `ImSwitchClient` are welcome! Please refer to the project's GitHub repository for contribution guidelines: [https://github.com/openUC2/imswitchclient/](https://github.com/openUC2/imswitchclient/).\n\n## License\n\n`ImSwitchClient` is licensed under the MIT License. For more details, see the LICENSE file in the project repository.\n\n",
    "bugtrack_url": null,
    "license": "MIT license",
    "summary": "This is a package that connects ImSwitch's REST API to the rest of the world (e.g. jupyter lab)",
    "version": "0.1.2",
    "project_urls": {
        "Homepage": "https://github.com/beniroquai/imswitchclient"
    },
    "split_keywords": [
        "imswitchclient"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "5ff6eb292f039df08b9c9a0765db0d891d9e813e0639501615285892cc4fcd93",
                "md5": "9b1dee9896cde57c221ac6db705e1cb3",
                "sha256": "04973800d44c84fa2705b9f19d63d4e39b43eca1600232ee6995ba33c5d49790"
            },
            "downloads": -1,
            "filename": "imswitchclient-0.1.2-py2.py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "9b1dee9896cde57c221ac6db705e1cb3",
            "packagetype": "bdist_wheel",
            "python_version": "py2.py3",
            "requires_python": ">=3.6",
            "size": 7904,
            "upload_time": "2024-04-23T06:02:00",
            "upload_time_iso_8601": "2024-04-23T06:02:00.843077Z",
            "url": "https://files.pythonhosted.org/packages/5f/f6/eb292f039df08b9c9a0765db0d891d9e813e0639501615285892cc4fcd93/imswitchclient-0.1.2-py2.py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "cd96ac785b2792731d9917ca77e1fe39df5db65c460db75624f3e2de274decea",
                "md5": "439f369b7776b5d5661844c1c3236783",
                "sha256": "fd16467013778f23c1fb680c2958e00ae411d38d120ae8cf50eb77528d79e226"
            },
            "downloads": -1,
            "filename": "imswitchclient-0.1.2.tar.gz",
            "has_sig": false,
            "md5_digest": "439f369b7776b5d5661844c1c3236783",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.6",
            "size": 12887,
            "upload_time": "2024-04-23T06:02:02",
            "upload_time_iso_8601": "2024-04-23T06:02:02.878563Z",
            "url": "https://files.pythonhosted.org/packages/cd/96/ac785b2792731d9917ca77e1fe39df5db65c460db75624f3e2de274decea/imswitchclient-0.1.2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-04-23 06:02:02",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "beniroquai",
    "github_project": "imswitchclient",
    "github_not_found": true,
    "lcname": "imswitchclient"
}
        
Elapsed time: 0.27861s