From 0d170ff77decdd463f2a5940b31ab4cfb476b186 Mon Sep 17 00:00:00 2001 From: Talon Chandler Date: Mon, 7 Aug 2023 18:00:35 -0700 Subject: [PATCH] Upgrade PM and MM (#39) * pycromanager==0.27.2 * MM docs * update github workflows to python 3.10 * upgrade to python 3.10 * pin ndtiff==1.12.2 * recommend MM 230312 * bump versions * update docs * bump setuptools version * store mm version in __init__.py * update acq_engine default mm_app_path * remove defaults from CLI options * Revert "update acq_engine default mm_app_path" This reverts commit bc4dd056822f8836c13f3594323579ea98b948cd. * Revert "remove defaults from CLI options" This reverts commit 58f74de81d1d777f91e55e7aa625716bd70c3065. * store default paths in `run_acquisition` only * bump versions * Oryx demo size bugfix * patch until micro-manager/mmCoreAndDevices#362 merges * bump pycromanager version --------- Co-authored-by: Uditha Velidandla --- docs/data_structure.md | 8 ++++---- docs/mantis_usage.md | 2 +- docs/setup_guide.md | 11 ++++++++--- mantis/__init__.py | 1 + mantis/acquisition/acq_engine.py | 12 ++++++------ mantis/acquisition/microscope_operations.py | 4 ++++ .../settings/demo_acquisition_settings.yaml | 7 +++++-- mantis/cli/run_acquisition.py | 10 ++++++++-- pyproject.toml | 7 ++++--- 9 files changed, 41 insertions(+), 21 deletions(-) diff --git a/docs/data_structure.md b/docs/data_structure.md index 6ba663e2..48338b1c 100644 --- a/docs/data_structure.md +++ b/docs/data_structure.md @@ -1,9 +1,9 @@ -# Data format +# Data format This document defines the standard for organizing data acquired by the mantis microscope. -## Raw directory organization +## Raw directory organization Organization of the raw data is constrained by the `pycromanager`-based acquisitioon engine. Currently, we structure raw data in the following hierarchy: @@ -49,7 +49,7 @@ Each acquisition will contain a PTCZYX dataset; some dimensions may be singleton The structure of the mantis acquisition log file is not final and is subject to change. Input is welcome. Currently, acquisition script writes one log file per call. -A `positions.csv` file will accompany each acquisition. This file is needed as it carries information about the position labels, which is not saved by `pycromanager`. In the future, we may decide to manage that differently - see [pycro-manager#575](https://github.com/micro-manager/pycro-manager/issues/575). A template for this file is provided [here](positions.csv). +A `positions.csv` file will accompany each acquisition. This file is needed as it carries information about the position labels, which is not saved by `pycromanager`. In the future, we may decide to manage that differently - see [pycro-manager#575](https://github.com/micro-manager/pycro-manager/issues/575). A template for this file is provided [here](positions.csv). A `platemap.csv` file will accompany each acquisition. This file carries information about the sample in each well and is populated by the user. Multiple wells may contain the same sample. A template for this file is provided [here](platemap.csv). @@ -97,4 +97,4 @@ We will also store position metadata within [ome-zarr metadata](https://github.c * The modalities (channels) contained in one acquisition folder are identical, i.e., all positions and calibration folders contain either labelfree, lightsheet, or labelfree + lightsheet stacks. * The names of Positions (`Pos`) may be renamed to reflect the condition or perturbation. -* Question: what constraints are imposed by recOrder and dexp analysis pipelines? \ No newline at end of file +* Question: what constraints are imposed by recOrder and dexp analysis pipelines? diff --git a/docs/mantis_usage.md b/docs/mantis_usage.md index 3add8d69..d81133f7 100644 --- a/docs/mantis_usage.md +++ b/docs/mantis_usage.md @@ -1,4 +1,4 @@ -## Overview +## Overview - unofficial Mantis microscope is a fast multimodal microscope capable of acquiring label-free and fluorescence measurments simultaneously via two remote-refocus based arms that quickly acquire volumetric information. --- diff --git a/docs/setup_guide.md b/docs/setup_guide.md index 70f0f3eb..ca140652 100644 --- a/docs/setup_guide.md +++ b/docs/setup_guide.md @@ -32,13 +32,18 @@ TODO: Update the setup instructions to reflect requirements for coPylot control. ## Install Micro-manager -The mantis acquisition currently works with Micro-manager nightly build 2023-03-12. +The Micro-manager nightly build tested and recommended for the mantis acquisition engine is declared in [`mantis/__init__.py`](../mantis/__init__.py) and can be obtained with: -* Download [Micro-Manager nightly build 2023-03-12](https://download.micro-manager.org/nightly/2.0/Windows/MMSetup_64bit_2.0.1_20230312.exe) and install following the installer prompts in the `C:\Program Files\Micro-Manager-2.0_03_12_2023` directory. +```python +import mantis +print(mantis.__mm_version__) +``` + +* Download the recommended [Micro-Manager nightly build](https://download.micro-manager.org/nightly/2.0/Windows/) and install following the installer prompts in the `C:\Program Files\Micro-Manager-2.0_YYYY_MM_DD` directory. * Copy the `Ti2_Mic_Driver.dll` device adapter located at `C:\Program Files\Nikon\Ti2-SDK\bin` to the Micro-manager install directory, as described [here](https://micro-manager.org/NikonTi2). -* Install another copy of [Micro-Manager nightly build 2023-03-12](https://download.micro-manager.org/nightly/2.0/Windows/MMSetup_64bit_2.0.1_20230312.exe) in the `C:\Program Files\Micro-Manager-nightly` directory. This copy of Micro-manager will be used by the headless light-sheet acquisition engine. +* Install another copy of the recommended [Micro-Manager nightly build](https://download.micro-manager.org/nightly/2.0/Windows/) in the `C:\Program Files\Micro-Manager-2.0_YYYY_MM_DD_2` directory. This copy of Micro-manager will be used by the headless light-sheet acquisition engine. ## Test the hardware setup diff --git a/mantis/__init__.py b/mantis/__init__.py index 3dc1f76b..a2a8c3da 100644 --- a/mantis/__init__.py +++ b/mantis/__init__.py @@ -1 +1,2 @@ __version__ = "0.1.0" +__mm_version__ = "2023-08-03" diff --git a/mantis/acquisition/acq_engine.py b/mantis/acquisition/acq_engine.py index 32fb146e..f80a712f 100644 --- a/mantis/acquisition/acq_engine.py +++ b/mantis/acquisition/acq_engine.py @@ -244,11 +244,11 @@ class MantisAcquisition(object): Directory where acquired data will be saved acquisition_name : str Name of the acquisition - mm_app_path : str, optional + mm_app_path : str Path to Micro-manager installation directory which runs the light-sheet - acquisition, by default 'C:\\Program Files\\Micro-Manager-nightly' - config_file : str, optional - Path to config file which runs the light-sheet acquisition, by default + acquisition, typically 'C:\\Program Files\\Micro-Manager-2.0_YYYY_MM_DD_2' + config_file : str + Path to config file which runs the light-sheet acquisition, typically 'C:\\CompMicro_MMConfigs\\mantis\\mantis-LS.cfg' enable_ls_acq : bool, optional Set to False if only acquiring label-free data, by default True @@ -279,8 +279,8 @@ def __init__( self, acquisition_directory: Union[str, os.PathLike], acquisition_name: str, - mm_app_path: str = r'C:\\Program Files\\Micro-Manager-nightly', - mm_config_file: str = r'C:\\CompMicro_MMConfigs\\mantis\\mantis-LS.cfg', + mm_app_path: str, + mm_config_file: str, enable_ls_acq: bool = True, enable_lf_acq: bool = True, demo_run: bool = False, diff --git a/mantis/acquisition/microscope_operations.py b/mantis/acquisition/microscope_operations.py index 7d6001e7..ca4b5e1e 100644 --- a/mantis/acquisition/microscope_operations.py +++ b/mantis/acquisition/microscope_operations.py @@ -69,6 +69,10 @@ def set_roi(mmc, roi: tuple): mmc.set_roi(*roi) + # patch until https://github.com/micro-manager/mmCoreAndDevices/pull/362 is + # merged + mmc.initialize_circular_buffer() + def get_position_list(mmStudio, z_stage_name): mm_pos_list = mmStudio.get_position_list_manager().get_position_list() diff --git a/mantis/acquisition/settings/demo_acquisition_settings.yaml b/mantis/acquisition/settings/demo_acquisition_settings.yaml index ef36984c..1a7a0a2e 100644 --- a/mantis/acquisition/settings/demo_acquisition_settings.yaml +++ b/mantis/acquisition/settings/demo_acquisition_settings.yaml @@ -19,11 +19,14 @@ lf_slice_settings: use_sequencing: True lf_microscope_settings: + # patch until https://github.com/micro-manager/mmCoreAndDevices/pull/362 is + # merged + roi: [0, 0, 1224, 1024] config_group_settings: - ['LightPath', 'Camera-left'] device_property_settings: - - ['Camera', 'OnCameraCCDXSize', '1024'] - - ['Camera', 'OnCameraCCDYSize', '1224'] + - ['Camera', 'OnCameraCCDXSize', '1224'] + - ['Camera', 'OnCameraCCDYSize', '1024'] - ['Camera', 'BitDepth', '12'] z_sequencing_settings: - ['Z', 'UseSequences', 'Yes'] diff --git a/mantis/cli/run_acquisition.py b/mantis/cli/run_acquisition.py index 2c5b1461..f9d243bc 100644 --- a/mantis/cli/run_acquisition.py +++ b/mantis/cli/run_acquisition.py @@ -3,15 +3,21 @@ import click import yaml +from mantis import __mm_version__ from mantis.cli.parsing import config_filepath, output_dirpath +default_mm_app_path = 'C:\\Program Files\\Micro-Manager-2.0_{}_{}_{}_2'.format( + *__mm_version__.split('-') +) +default_mm_config_filepath = 'C:\\CompMicro_MMConfigs\\mantis\\mantis-LS.cfg' + @click.command() @config_filepath() @output_dirpath() @click.option( "--mm-app-path", - default='C:\\Program Files\\Micro-Manager-nightly', + default=default_mm_app_path, type=click.Path(exists=True, file_okay=False, dir_okay=True), show_default=True, help='''Path to Micro-manager installation directory @@ -19,7 +25,7 @@ ) @click.option( "--mm-config-filepath", - default='C:\\CompMicro_MMConfigs\\mantis\\mantis-LS.cfg', + default=default_mm_config_filepath, type=click.Path(exists=True, file_okay=True, dir_okay=False), show_default=True, help='''Path to Micro-manager config file diff --git a/pyproject.toml b/pyproject.toml index 611ef7d9..13338cf7 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,5 +1,5 @@ [build-system] -requires = ["setuptools >= 42", "setuptools_scm[toml]>=3.4", "wheel"] +requires = ["setuptools >= 61", "setuptools_scm[toml]>=3.4", "wheel"] [project] name = "mantis" @@ -20,15 +20,16 @@ classifiers = [ # list package dependencies here dependencies = [ - "iohub==0.1.0.dev3", + "iohub==0.1.0.dev4", "matplotlib", "napari; 'arm64' in platform_machine", # without Qt5 and skimage "napari[all]; 'arm64' not in platform_machine", # with Qt5 and skimage "PyQt6; 'arm64' in platform_machine", "natsort", + "ndtiff>=2.0", "nidaqmx", "numpy", - "pycromanager==0.25.40", + "pycromanager==0.28.1", "pydantic", "pylablib==1.4.1", "scipy",