waveorder 2.2.1b0__py3-none-any.whl → 3.0.0__py3-none-any.whl

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 (58) hide show
  1. waveorder/_version.py +16 -3
  2. waveorder/acq/__init__.py +0 -0
  3. waveorder/acq/acq_functions.py +166 -0
  4. waveorder/assets/HSV_legend.png +0 -0
  5. waveorder/assets/JCh_legend.png +0 -0
  6. waveorder/assets/waveorder_plugin_logo.png +0 -0
  7. waveorder/calib/Calibration.py +1512 -0
  8. waveorder/calib/Optimization.py +470 -0
  9. waveorder/calib/__init__.py +0 -0
  10. waveorder/calib/calibration_workers.py +464 -0
  11. waveorder/cli/apply_inverse_models.py +328 -0
  12. waveorder/cli/apply_inverse_transfer_function.py +379 -0
  13. waveorder/cli/compute_transfer_function.py +432 -0
  14. waveorder/cli/gui_widget.py +58 -0
  15. waveorder/cli/main.py +39 -0
  16. waveorder/cli/monitor.py +163 -0
  17. waveorder/cli/option_eat_all.py +47 -0
  18. waveorder/cli/parsing.py +122 -0
  19. waveorder/cli/printing.py +16 -0
  20. waveorder/cli/reconstruct.py +67 -0
  21. waveorder/cli/settings.py +187 -0
  22. waveorder/cli/utils.py +175 -0
  23. waveorder/filter.py +1 -2
  24. waveorder/focus.py +136 -25
  25. waveorder/io/__init__.py +0 -0
  26. waveorder/io/_reader.py +61 -0
  27. waveorder/io/core_functions.py +272 -0
  28. waveorder/io/metadata_reader.py +195 -0
  29. waveorder/io/utils.py +175 -0
  30. waveorder/io/visualization.py +160 -0
  31. waveorder/models/inplane_oriented_thick_pol3d_vector.py +3 -3
  32. waveorder/models/isotropic_fluorescent_thick_3d.py +92 -0
  33. waveorder/models/isotropic_fluorescent_thin_3d.py +331 -0
  34. waveorder/models/isotropic_thin_3d.py +73 -72
  35. waveorder/models/phase_thick_3d.py +103 -4
  36. waveorder/napari.yaml +36 -0
  37. waveorder/plugin/__init__.py +9 -0
  38. waveorder/plugin/gui.py +1094 -0
  39. waveorder/plugin/gui.ui +1440 -0
  40. waveorder/plugin/job_manager.py +42 -0
  41. waveorder/plugin/main_widget.py +1605 -0
  42. waveorder/plugin/tab_recon.py +3294 -0
  43. waveorder/scripts/__init__.py +0 -0
  44. waveorder/scripts/launch_napari.py +13 -0
  45. waveorder/scripts/repeat-cal-acq-rec.py +147 -0
  46. waveorder/scripts/repeat-calibration.py +31 -0
  47. waveorder/scripts/samples.py +85 -0
  48. waveorder/scripts/simulate_zarr_acq.py +204 -0
  49. waveorder/util.py +1 -1
  50. waveorder/visuals/napari_visuals.py +1 -1
  51. waveorder-3.0.0.dist-info/METADATA +350 -0
  52. waveorder-3.0.0.dist-info/RECORD +69 -0
  53. {waveorder-2.2.1b0.dist-info → waveorder-3.0.0.dist-info}/WHEEL +1 -1
  54. waveorder-3.0.0.dist-info/entry_points.txt +5 -0
  55. {waveorder-2.2.1b0.dist-info → waveorder-3.0.0.dist-info/licenses}/LICENSE +13 -1
  56. waveorder-2.2.1b0.dist-info/METADATA +0 -187
  57. waveorder-2.2.1b0.dist-info/RECORD +0 -27
  58. {waveorder-2.2.1b0.dist-info → waveorder-3.0.0.dist-info}/top_level.txt +0 -0
waveorder/_version.py CHANGED
@@ -1,7 +1,14 @@
1
1
  # file generated by setuptools-scm
2
2
  # don't change, don't track in version control
3
3
 
4
- __all__ = ["__version__", "__version_tuple__", "version", "version_tuple"]
4
+ __all__ = [
5
+ "__version__",
6
+ "__version_tuple__",
7
+ "version",
8
+ "version_tuple",
9
+ "__commit_id__",
10
+ "commit_id",
11
+ ]
5
12
 
6
13
  TYPE_CHECKING = False
7
14
  if TYPE_CHECKING:
@@ -9,13 +16,19 @@ if TYPE_CHECKING:
9
16
  from typing import Union
10
17
 
11
18
  VERSION_TUPLE = Tuple[Union[int, str], ...]
19
+ COMMIT_ID = Union[str, None]
12
20
  else:
13
21
  VERSION_TUPLE = object
22
+ COMMIT_ID = object
14
23
 
15
24
  version: str
16
25
  __version__: str
17
26
  __version_tuple__: VERSION_TUPLE
18
27
  version_tuple: VERSION_TUPLE
28
+ commit_id: COMMIT_ID
29
+ __commit_id__: COMMIT_ID
19
30
 
20
- __version__ = version = '2.2.1b0'
21
- __version_tuple__ = version_tuple = (2, 2, 1)
31
+ __version__ = version = '3.0.0'
32
+ __version_tuple__ = version_tuple = (3, 0, 0)
33
+
34
+ __commit_id__ = commit_id = None
File without changes
@@ -0,0 +1,166 @@
1
+ import glob
2
+ import json
3
+ import os
4
+ import time
5
+
6
+ import numpy as np
7
+ from iohub.mmstack import MMStack
8
+
9
+ try:
10
+ from pycromanager import Studio
11
+ except:
12
+ pass
13
+
14
+
15
+ def generate_acq_settings(
16
+ mm,
17
+ channel_group,
18
+ channels=None,
19
+ zstart=None,
20
+ zend=None,
21
+ zstep=None,
22
+ save_dir=None,
23
+ prefix=None,
24
+ keep_shutter_open_channels=False,
25
+ keep_shutter_open_slices=False,
26
+ ):
27
+ """
28
+ This function generates a json file specific to the Micro-Manager SequenceSettings.
29
+ It has default parameters for a multi-channels z-stack acquisition but does not yet
30
+ support multi-position or multi-frame acquisitions.
31
+
32
+ This also has default values for QLIPP Acquisition. Can be used as a framework for other types
33
+ of acquisitions
34
+
35
+ Parameters
36
+ ----------
37
+ mm: (object) MM Studio API object
38
+ scheme: (str) '4-State' or '5-State'
39
+ zstart: (float) relative starting position for the z-stack
40
+ zend: (float) relative ending position for the z-stack
41
+ zstep: (float) step size for the z-stack
42
+ save_dir: (str) path to save directory
43
+ prefix: (str) name to save the data under
44
+
45
+ Returns
46
+ -------
47
+ settings: (json) json dictionary conforming to MM SequenceSettings
48
+ """
49
+
50
+ # Get API Objects
51
+ am = mm.getAcquisitionManager()
52
+ ss = am.getAcquisitionSettings()
53
+ app = mm.app()
54
+
55
+ # Get current SequenceSettings to modify
56
+ original_ss = ss.toJSONStream(ss)
57
+ original_json = json.loads(original_ss).copy()
58
+
59
+ if zstart:
60
+ do_z = True
61
+ else:
62
+ do_z = False
63
+
64
+ # Structure of the channel properties
65
+ channel_dict = {
66
+ "channelGroup": channel_group,
67
+ "config": None,
68
+ "exposure": None,
69
+ "zOffset": 0,
70
+ "doZStack": do_z,
71
+ "color": {"value": -16747854, "falpha": 0.0},
72
+ "skipFactorFrame": 0,
73
+ "useChannel": True if channels else False,
74
+ }
75
+
76
+ channel_list = None
77
+ if channels:
78
+ # Append all the channels with their current exposure settings
79
+ channel_list = []
80
+ for chan in channels:
81
+ # todo: think about how to deal with missing exposure
82
+ exposure = app.getChannelExposureTime(
83
+ channel_group, chan, 10
84
+ ) # sets exposure to 10 if not found
85
+ channel = channel_dict.copy()
86
+ channel["config"] = chan
87
+ channel["exposure"] = exposure
88
+
89
+ channel_list.append(channel)
90
+
91
+ # set other parameters
92
+ original_json["numFrames"] = 1
93
+ original_json["intervalMs"] = 0
94
+ original_json["relativeZSlice"] = True
95
+ original_json["slicesFirst"] = True
96
+ original_json["timeFirst"] = False
97
+ original_json["keepShutterOpenSlices"] = keep_shutter_open_slices
98
+ original_json["keepShutterOpenChannels"] = keep_shutter_open_channels
99
+ original_json["useAutofocus"] = False
100
+ original_json["saveMode"] = "MULTIPAGE_TIFF"
101
+ original_json["save"] = True if save_dir else False
102
+ original_json["root"] = save_dir if save_dir else ""
103
+ original_json["prefix"] = prefix if prefix else "Untitled"
104
+ original_json["channels"] = channel_list
105
+ original_json["zReference"] = 0.0
106
+ original_json["channelGroup"] = channel_group
107
+ original_json["usePositionList"] = False
108
+ original_json["shouldDisplayImages"] = True
109
+ original_json["useSlices"] = do_z
110
+ original_json["useFrames"] = False
111
+ original_json["useChannels"] = True if channels else False
112
+ original_json["slices"] = (
113
+ list(np.arange(float(zstart), float(zend + zstep), float(zstep)))
114
+ if zstart
115
+ else []
116
+ )
117
+ original_json["sliceZStepUm"] = zstep
118
+ original_json["sliceZBottomUm"] = zstart
119
+ original_json["sliceZTopUm"] = zend
120
+ original_json["acqOrderMode"] = 1
121
+
122
+ return original_json
123
+
124
+
125
+ def acquire_from_settings(
126
+ mm: Studio,
127
+ settings: dict,
128
+ grab_images: bool = True,
129
+ restore_settings: bool = True,
130
+ ) -> np.typing.NDArray:
131
+ """Function to acquire an MDA acquisition with the native MM MDA Engine.
132
+ Assumes single position acquisition.
133
+
134
+ Parameters
135
+ ----------
136
+ mm : Studio
137
+ settings : dict
138
+ JSON dictionary conforming to MM SequenceSettings
139
+ grab_images : bool, optional
140
+ return the acquired array, by default True
141
+ restore_settings : bool, optional
142
+ restore MDA settings before acquisition, by default True
143
+
144
+ Returns
145
+ -------
146
+ NDArray
147
+ acquired images
148
+ """
149
+ am = mm.getAcquisitionManager()
150
+ ss = am.getAcquisitionSettings()
151
+
152
+ ss_new = ss.fromJSONStream(json.dumps(settings))
153
+ am.runAcquisitionWithSettings(ss_new, True)
154
+
155
+ time.sleep(3)
156
+
157
+ if restore_settings:
158
+ am.setAcquisitionSettings(ss)
159
+
160
+ # TODO: speed improvements in reading the data with pycromanager acquisition?
161
+ if grab_images:
162
+ # get the most recent acquisition if multiple
163
+ path = os.path.join(settings["root"], settings["prefix"])
164
+ files = glob.glob(path + "*")
165
+ index = max([int(x.split(path + "_")[1]) for x in files])
166
+ return MMStack(path + f"_{index}")[0].xdata.to_numpy()
Binary file
Binary file