mbo_utilities 0.0.8__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (34) hide show
  1. mbo_utilities-0.0.8/LICENSE.md +38 -0
  2. mbo_utilities-0.0.8/PKG-INFO +85 -0
  3. mbo_utilities-0.0.8/README.md +29 -0
  4. mbo_utilities-0.0.8/mbo_utilities/VERSION +1 -0
  5. mbo_utilities-0.0.8/mbo_utilities/__init__.py +47 -0
  6. mbo_utilities-0.0.8/mbo_utilities/__main__.py +79 -0
  7. mbo_utilities-0.0.8/mbo_utilities/assembly.py +551 -0
  8. mbo_utilities-0.0.8/mbo_utilities/binary.py +136 -0
  9. mbo_utilities-0.0.8/mbo_utilities/binary_s2p.py +25 -0
  10. mbo_utilities-0.0.8/mbo_utilities/file_io.py +596 -0
  11. mbo_utilities-0.0.8/mbo_utilities/graphics/__init__.py +33 -0
  12. mbo_utilities-0.0.8/mbo_utilities/graphics/general.py +28 -0
  13. mbo_utilities-0.0.8/mbo_utilities/graphics/imgui.py +425 -0
  14. mbo_utilities-0.0.8/mbo_utilities/graphics/qt.py +55 -0
  15. mbo_utilities-0.0.8/mbo_utilities/graphics/run_gui.py +59 -0
  16. mbo_utilities-0.0.8/mbo_utilities/image.py +214 -0
  17. mbo_utilities-0.0.8/mbo_utilities/metadata.py +344 -0
  18. mbo_utilities-0.0.8/mbo_utilities/scanreader/__init__.py +1 -0
  19. mbo_utilities-0.0.8/mbo_utilities/scanreader/core.py +125 -0
  20. mbo_utilities-0.0.8/mbo_utilities/scanreader/exceptions.py +15 -0
  21. mbo_utilities-0.0.8/mbo_utilities/scanreader/multiroi.py +318 -0
  22. mbo_utilities-0.0.8/mbo_utilities/scanreader/scans.py +932 -0
  23. mbo_utilities-0.0.8/mbo_utilities/scanreader/utils.py +117 -0
  24. mbo_utilities-0.0.8/mbo_utilities/transfer.py +151 -0
  25. mbo_utilities-0.0.8/mbo_utilities/util.py +247 -0
  26. mbo_utilities-0.0.8/mbo_utilities.egg-info/PKG-INFO +85 -0
  27. mbo_utilities-0.0.8/mbo_utilities.egg-info/SOURCES.txt +32 -0
  28. mbo_utilities-0.0.8/mbo_utilities.egg-info/dependency_links.txt +1 -0
  29. mbo_utilities-0.0.8/mbo_utilities.egg-info/entry_points.txt +3 -0
  30. mbo_utilities-0.0.8/mbo_utilities.egg-info/requires.txt +45 -0
  31. mbo_utilities-0.0.8/mbo_utilities.egg-info/top_level.txt +1 -0
  32. mbo_utilities-0.0.8/pyproject.toml +138 -0
  33. mbo_utilities-0.0.8/setup.cfg +4 -0
  34. mbo_utilities-0.0.8/tests/test_file_io.py +29 -0
@@ -0,0 +1,38 @@
1
+ This software license is the 3-clause BSD license plus a fourth clause that
2
+ prohibits redistribution for commercial purposes without further permission.
3
+
4
+ BSD 3-Clause License
5
+
6
+ Copyright (c) 2024, Miller Brain Observatory.
7
+
8
+ Redistribution and use in source and binary forms, with or without
9
+ modification, are permitted provided that the following conditions are met:
10
+
11
+ 1. Redistributions of source code must retain the above copyright notice, this
12
+ list of conditions and the following disclaimer.
13
+
14
+ 2. Redistributions in binary form must reproduce the above copyright notice,
15
+ this list of conditions and the following disclaimer in the documentation
16
+ and/or other materials provided with the distribution.
17
+
18
+ 3. Neither the name of the copyright holder nor the names of its
19
+ contributors may be used to endorse or promote products derived from
20
+ this software without specific prior written permission.
21
+
22
+ 4. Redistributions for commercial purposes are not permitted without the
23
+ written permission of the code owner Kushal Kolar.
24
+ For purposes of this license, commercial purposes is the incorporation of
25
+ mesmerize-core into anything for which you will charge fees or other
26
+ compensation. Contact kushalkolar@alumni.ubc.ca for more information.
27
+
28
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
29
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
30
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
31
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
32
+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
33
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
34
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
35
+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
36
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
37
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
38
+
@@ -0,0 +1,85 @@
1
+ Metadata-Version: 2.4
2
+ Name: mbo_utilities
3
+ Version: 0.0.8
4
+ Summary: Various utilities for the Miller Brain Observatory
5
+ License-Expression: BSD-3-Clause
6
+ Project-URL: Homepage, https://github.com/millerbrainobservatory/mbo_utilities
7
+ Project-URL: Documentation, https://millerbrainobservatory.github.io/mbo_utilities/index.html
8
+ Project-URL: Repository, https://github.com/millerbrainobservatory/mbo_utilities
9
+ Project-URL: Issues, https://github.com/MillerBrainObservatory/mbo_utilities/issues
10
+ Keywords: Microscopy,ScanImage,multiROI,Tiff
11
+ Requires-Python: <3.13,>=3.11
12
+ Description-Content-Type: text/markdown
13
+ License-File: LICENSE.md
14
+ Requires-Dist: tifffile>=2025.3.30
15
+ Requires-Dist: scikit-image
16
+ Requires-Dist: zarr>=2.18.3
17
+ Requires-Dist: dask>=2025.3.0
18
+ Requires-Dist: mkl-fft>=1.3.13
19
+ Requires-Dist: imageio[ffmpeg]
20
+ Requires-Dist: ffmpeg-python
21
+ Requires-Dist: matplotlib>=3.10.1
22
+ Requires-Dist: h5py
23
+ Requires-Dist: tqdm
24
+ Provides-Extra: gui
25
+ Requires-Dist: cmake; extra == "gui"
26
+ Requires-Dist: imgui-bundle; extra == "gui"
27
+ Requires-Dist: pyqt5==5.15.11; extra == "gui"
28
+ Requires-Dist: pyqt5-qt5==5.15.2; extra == "gui"
29
+ Requires-Dist: glfw; extra == "gui"
30
+ Provides-Extra: notebook
31
+ Requires-Dist: jupyter_rfb>=0.5.1; extra == "notebook"
32
+ Requires-Dist: fastplotlib; extra == "notebook"
33
+ Requires-Dist: pygfx; extra == "notebook"
34
+ Requires-Dist: jupyterlab; extra == "notebook"
35
+ Requires-Dist: sidecar; extra == "notebook"
36
+ Requires-Dist: ipykernel; extra == "notebook"
37
+ Requires-Dist: ipywidgets<9,>=8.0.0; extra == "notebook"
38
+ Requires-Dist: anywidget; extra == "notebook"
39
+ Provides-Extra: napari
40
+ Requires-Dist: napari; extra == "napari"
41
+ Provides-Extra: all
42
+ Requires-Dist: imgui-bundle; extra == "all"
43
+ Requires-Dist: pyqt5==5.15.11; extra == "all"
44
+ Requires-Dist: pyqt5-qt5==5.15.2; extra == "all"
45
+ Requires-Dist: glfw; extra == "all"
46
+ Requires-Dist: jupyter_rfb>=0.5.1; extra == "all"
47
+ Requires-Dist: fastplotlib; extra == "all"
48
+ Requires-Dist: pygfx; extra == "all"
49
+ Requires-Dist: jupyterlab; extra == "all"
50
+ Requires-Dist: sidecar; extra == "all"
51
+ Requires-Dist: ipykernel; extra == "all"
52
+ Requires-Dist: ipywidgets<9,>=8.0.0; extra == "all"
53
+ Requires-Dist: anywidget; extra == "all"
54
+ Requires-Dist: napari; extra == "all"
55
+ Dynamic: license-file
56
+
57
+ # MBO utilities
58
+ General python/shell utilities and environment/config files.
59
+
60
+ ## Installation
61
+ ```bash
62
+ conda create -n mbo_util python=3.10 imgui-bundle
63
+ conda activate mbo_util
64
+ pip install git+https://github.com/MillerBrainObservatory/mbo_utilities.git@master
65
+ ```
66
+
67
+ ## Usage
68
+
69
+ Open a terminal and run the following commands:
70
+
71
+ ``` bash
72
+ # make sure the conda environment is activated
73
+ mbo --path ~/data/session/
74
+
75
+ # or open a dialog to select the folder
76
+ mbo --gui
77
+ ```
78
+
79
+ or in Jupyter notebook:
80
+
81
+ ```python
82
+ from mbo_utilities import run_gui
83
+
84
+ run_gui()
85
+ ```
@@ -0,0 +1,29 @@
1
+ # MBO utilities
2
+ General python/shell utilities and environment/config files.
3
+
4
+ ## Installation
5
+ ```bash
6
+ conda create -n mbo_util python=3.10 imgui-bundle
7
+ conda activate mbo_util
8
+ pip install git+https://github.com/MillerBrainObservatory/mbo_utilities.git@master
9
+ ```
10
+
11
+ ## Usage
12
+
13
+ Open a terminal and run the following commands:
14
+
15
+ ``` bash
16
+ # make sure the conda environment is activated
17
+ mbo --path ~/data/session/
18
+
19
+ # or open a dialog to select the folder
20
+ mbo --gui
21
+ ```
22
+
23
+ or in Jupyter notebook:
24
+
25
+ ```python
26
+ from mbo_utilities import run_gui
27
+
28
+ run_gui()
29
+ ```
@@ -0,0 +1 @@
1
+ 0.0.8
@@ -0,0 +1,47 @@
1
+ from pathlib import Path
2
+
3
+ from .file_io import (
4
+ get_files,
5
+ zstack_from_files,
6
+ npy_to_dask,
7
+ read_scan,
8
+ save_png,
9
+ save_mp4,
10
+ zarr_to_dask,
11
+ expand_paths,
12
+ )
13
+ from .assembly import save_as
14
+ from .metadata import is_raw_scanimage, get_metadata, params_from_metadata
15
+ from .image import fix_scan_phase, return_scan_offset
16
+ from .util import norm_minmax, smooth_data, is_running_jupyter
17
+
18
+ from .graphics import run_gui
19
+
20
+ __version__ = (Path(__file__).parent / "VERSION").read_text().strip()
21
+
22
+ __all__ = [
23
+ "run_gui",
24
+ # image processing
25
+ "fix_scan_phase",
26
+ "return_scan_offset",
27
+ # file_io
28
+ "scanreader",
29
+ "npy_to_dask",
30
+ "zarr_to_dask",
31
+ "get_files",
32
+ "zstack_from_files",
33
+ "read_scan",
34
+ "save_png",
35
+ "save_mp4",
36
+ "expand_paths",
37
+ # metadata
38
+ "is_raw_scanimage",
39
+ "get_metadata",
40
+ "params_from_metadata",
41
+ # util
42
+ "norm_minmax",
43
+ "smooth_data",
44
+ "is_running_jupyter",
45
+ # assembly
46
+ "save_as",
47
+ ]
@@ -0,0 +1,79 @@
1
+ from __future__ import annotations
2
+
3
+ import argparse
4
+ from pathlib import Path
5
+
6
+ import fastplotlib as fpl
7
+
8
+ from mbo_utilities import run_gui
9
+
10
+
11
+ def add_args(parser: argparse.ArgumentParser):
12
+ """
13
+ Add command-line arguments to the parser, dynamically adding arguments
14
+ for each key in the `ops` dictionary.
15
+
16
+ Parameters
17
+ ----------
18
+ parser : argparse.ArgumentParser
19
+ The argument parser to which arguments are added.
20
+
21
+ Returns
22
+ -------
23
+ argparse.ArgumentParser
24
+ The parser with added arguments.
25
+ """
26
+ parser.add_argument(
27
+ "--path",
28
+ type=str,
29
+ default=None,
30
+ help="Path to a directory containing raw scanimage tiff files for a single session.",
31
+ )
32
+ parser.add_argument("--gui", action="store_true", help="Run the GUI.")
33
+ parser.add_argument(
34
+ "--version", action="store_true", help="Print the version of the package."
35
+ )
36
+ return parser
37
+
38
+
39
+ def main():
40
+ parser = argparse.ArgumentParser(
41
+ description="Preview a scanimage imaging session."
42
+ "This will display 3D [Tyx] or 4D [Tzyx] data in a GUI."
43
+ "The path must be a directory containing raw or assembled scanimage tiff files."
44
+ )
45
+ parser = add_args(parser)
46
+ args = parser.parse_args()
47
+
48
+ # Handle version
49
+ if args.version:
50
+ import mbo_utilities as mbo
51
+
52
+ print("lbm_caiman_python v{}".format(mbo.__version__))
53
+ return
54
+
55
+ if args.gui:
56
+ run_gui()
57
+ return
58
+ if not args.path or args.path == "":
59
+ run_gui()
60
+ return
61
+ else:
62
+ data_path = Path(args.path).expanduser().resolve()
63
+ print(f"Reading data from '{data_path}'")
64
+ if not data_path.exists():
65
+ raise FileNotFoundError(
66
+ f"Path '{data_path}' does not exist as a file or directory."
67
+ )
68
+ if data_path.is_dir():
69
+ run_gui(data_path)
70
+ else:
71
+ raise FileNotFoundError(f"Path '{data_path}' is not a directory.")
72
+
73
+
74
+ if __name__ == "__main__":
75
+ main()
76
+ if fpl.__version__ == "0.2.0":
77
+ raise NotImplementedError("fastplotlib version 0.2.0 does not support GUIs.")
78
+ elif fpl.__version__ == "0.3.0":
79
+ fpl.loop.run()