Commit 69945bc
Video stream modifications via a new
* Add `ClickDispatcher` architecture and setup one in `VideoStreamFrame`
* Add `VideoStreamService` architecture and setup one in `VideoStreamFrame`
* Rename `VideoStreamEnhancers` to `Overlays`, make `ImageDrawOverlay` editable
* `ClickListener`: make `callback` optional and allow activating via `with` context
* `MediaGrabber`: fix bug: `get_media` cleared `continuousCollectionEvent`
* `calibrate_beamshift.py`: make imports absolute, allow float beamshift
* Instamatic GUI: temporarily print coords of clicked point, revert later
* Move `instamatic.typing` to `typing_` to avoid import conflicts
* `stage`: Add `get_rotation_speed`, improve typing
* Add `instamatic.calibrate_stage_rotation` for greater rotation control
* Add `instamatic.calibrate_stage_rotation` for greater rotation control 2
* Add first ideas for RATS-like generalized data collection frame
* `ImageDrawOverlay`: Don't print `self.operations` on every redraw
* GUI: FIX couldn't initialize with non-steamable camera
* `VideoStream`: Generalize real & fake streams under common base class
* GUI: Allow VideoStreamFrame for non-streamable cameras via the fake
* Allow customizing `NoOverwriteDict`'s `KeyOverwriteError` message
* Add `ClickDispatcher` architecture and setup one in `VideoStreamFrame`
* `ClickListener`: make `callback` optional and allow activating via `with` context
* Add `typing_extensions` as a dependency
* Move potential `typing_extensions` types to `instamatic._typing`
* Feature usefulness of new `instamatic._typing.Self`
* Move potential `typing_extensions` types to `instamatic._typing`
* Feature usefulness of new `instamatic._typing.Self`
* Exclude changes irrelevant to the `click_service` branch
* Add a custom `ClickEvent.__repr__`
* Add a custom `ClickEvent.__repr__`
* Move `instamatic.collections` to `instamatic._collections`
* Move `instamatic.collections` to `instamatic._collections`
* `ClickListener`: call `callback` only after putting event in `self.queue`
* `ClickListener`: call `callback` only after putting event in `self.queue`
* `_VS`: rename type variable to a more conventional `VideoStream_T`
* `_VS`: rename type variable to a more conventional `VideoStream_T`
* `typing_extensions`: uses typing if available so import directly, not via `instamatic._typing`
* `typing_extensions`: uses typing if available so import directly, not via `instamatic._typing`
* Do not pass numpy objects to the microscope.
* `CameraSimu.get_movie`: convert into `Generator`
* `VideoStream.get_movie`: convert into `Generator`
* `VideoStream.get_movie`: Optimize thread release, remove unused event = best fps yet
* `VideoStream.get_movie`: Optimize thread release, remove unused event = best fps yet 2
* `TEMController.get_movie`: convert into `Generator`
* `ctrl.get_image`: fix `header_keys` could hold only 1 key as `str` not `tuple`
* `CalibMovieRate`: first draft of the movie delay calibration
* `TEMController.get_movie`: collect common metadata before the main loop for time precision
* `TEMController`: move ugly explicit `self.cam` check to a method decorator
* `CalibMovieDelays`: simplify and add multi-attempt mechanism
* `CalibMovieDelaysMapping`: add a common class for reading/writing mappings
* `CalibMovieDelaysMapping`: fix I/O, script, bugs, add custom `CalibError`
* FEI Tecnai upper speed limit seem to be around 0.2
* `CameraServal.get_movie`: rewrite as generator, streamline by PIL->tifffile
* `CameraBase.get_movie`: rewrite as generator
* `CameraMerlin.get_movie`: rewrite as generator
* `showcase_movie.py`: Add a temp script to feature get_movie streaming feature
* `CameraServal.get_movie`: Actually replace previous implementation this time
* `CalibMovieDelays`: vastly simplify, do for specific exposure only
* `CalibMovieDelays`: fix documentation, warning criteria
* Register `instamatic.calibrate.calibrate_movie_delays` as script
* Fix bugs, typos
* Adapt `test_get_movie` to the new structure
* Add Daniel Tchoń to `CITATION.cff`
* Implement simple cRED protocol in rats frame using `get_movie`
* Fix `write_tiff` raising when writing to non-existing directory
* Fix `DiffractionRun.middles` off-by-one error
* Wrap generators in `try/finally` to correctly close them when not exhausted
* RATS cRED: find and rotate with closest possible rotation speed
* Reorganize rats frame, lock unusable buttons
* `RatsFrame`: clean code formatting
* `RatsFrame`: make `Run.experiments` a property
* `RatsFrame`: can now extend/collect experiments in parts
* These things don't work on Tecnai (fix better)
* WHen using center, convert numpy types to python
* Disable plotting until its fixed.
* Adapt RATS experiment to updated movie calibration
* Add typing, align `stage.rotating_speed` to `stage.rotation_speed` to match already-used wording
* Fix beamshift deflector so that it passes `int` or `float` instead of `np.int`
* Fix wrong definitions of goniometer speed vs pace
* Fix mismatched axes order for the purpose of crystal tracking
* Generalize image, tracking, diffraction config re/store
* Correctly change config during RATS experiment
* Add docstrings, streamline blanking
* Add `with Beam().blanked()` and `with Beam().unblanked()`
* Apply the new beam `un/blanked` context in various places
* Various RATS frame fixes needed to run cRED on Tecnai
* New console print of carriage return, with debug statements
* Remove ANSI ESCAPE characters after all; this version handles tqdm
* Remove debug statements
* Improve RATS experiment: go to 0 at start, end, also collect image
* Add beam blank button, block can when collecting stills,
* Systematize `setStagePosition` signature, make `None` a sentinel for speed
* Fix TEMController alignments being incorrectly stored and restored
* Add generalized handling for PETS input using a dedicated factory
* Since we need to support python 3.7 and 3.8, move csv file inside py
* Produce just a single PETS file in RATS experiment
* Add generalized handling for PETS input using a dedicated factory
* Since we need to support python 3.7 and 3.8, move csv file inside py
* Fix name of produced pets file to `pets.pts`
* Fix name of produced pets file to `pets.pts`
* Fix creating `pets.pts` if prefix or suffix are not defined
* Fix creating `pets.pts` if prefix or suffix are not defined
* Split PETS affix to blocks pre-adding: rejects only duplicate lines, not all affix
* Split PETS affix to blocks pre-adding: rejects only duplicate lines, not all affix
* Add doc, tests, move csv to resources, bump min Python version to 3.9
* GitHub tests fail for Python 3.13, may be not supported by some libraries yet
* Simplify, accelerate the video provider, now `VideoServiceProcessor`
* Further simplify, make faster, allow `VideoStreamProcessor` to display figures
* Remove `[tool.setuptools.package-data]` from `pyproject.toml`
Co-authored-by: Stef Smeets <stefsmeets@users.noreply.github.com>
* Fix typo in src/instamatic/processing/ImgConversion.py
Co-authored-by: Stef Smeets <stefsmeets@users.noreply.github.com>
* Move `PetsInputWarning` to the top of the `PETS_input_factory.py` file
* Make `PETS_KEYWORDS` uppercase, fix `PetsKeywords.from_file` type hint
* Bump the suggested conda-forge Python version to 3.12
* Improve docstrings in `DeferredImageDraw` & `VideoStreamProcessor`
* `on_frame`: scale 2-fold, clear a bunch of empty lines
* `ExperimentalRats`: fix beam un/blanker
* `ExperimentalRats`: export tracking to its own function
* Merge `fix_pets_input` into `video_services`
* Revert code unrelated to strictly stream processor updates
* Improve `stream.processor.temporary_*`, docstring, add example code
* Fix bug: clicking on VideoStreamFrame.panel.image was 2px off
* Remove debug timing instructions
* Fix clicked point was incorrect if window scrolled or partially visible
* Rename `save_image` -> `save_frame`, new `save_image` job saves edited as PNG, remove unused imports
* Remove discontinued showcase script
* Fix incorrect yield placement in `processor.temporary` context
* Make `DeferredImageDraw.Instruction` mutable dataclass (& .5% slower)
* Make `DeferredImageDraw.Instruction` mutable dataclass (& .2% slower)
* Forcing keyword args here for safety.
Co-authored-by: Stef Smeets <stefsmeets@users.noreply.github.com>
* Rewrite `VideoStreamProcessor.frame` return into a bit neater one-liner
* Fix unsightly docstring, remove unused import
* Improve type hints, docstrings
* Revert "Forcing keyword args here for safety."
This reverts commit 08806ff.
* Remove code left "ONLY FOR DEVELOPMENT SHOWCASE PURPOSES"
---------
Co-authored-by: Stef Smeets <stefsmeets@users.noreply.github.com>VideoStreamProcessor (#135)1 parent e714b68 commit 69945bc
File tree
4 files changed
+241
-45
lines changed- src/instamatic
- gui
- microscope/components
4 files changed
+241
-45
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
| 12 | + | |
| 13 | + | |
12 | 14 | | |
| 15 | + | |
13 | 16 | | |
14 | 17 | | |
15 | 18 | | |
| |||
31 | 34 | | |
32 | 35 | | |
33 | 36 | | |
34 | | - | |
| 37 | + | |
35 | 38 | | |
36 | 39 | | |
37 | 40 | | |
38 | 41 | | |
39 | 42 | | |
40 | 43 | | |
41 | 44 | | |
42 | | - | |
43 | | - | |
44 | | - | |
| 45 | + | |
45 | 46 | | |
46 | 47 | | |
47 | 48 | | |
| |||
55 | 56 | | |
56 | 57 | | |
57 | 58 | | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
58 | 68 | | |
59 | 69 | | |
60 | 70 | | |
| |||
85 | 95 | | |
86 | 96 | | |
87 | 97 | | |
| 98 | + | |
88 | 99 | | |
89 | 100 | | |
90 | 101 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
5 | | - | |
6 | 5 | | |
| 6 | + | |
7 | 7 | | |
| 8 | + | |
8 | 9 | | |
9 | 10 | | |
10 | | - | |
| 11 | + | |
| 12 | + | |
11 | 13 | | |
12 | | - | |
13 | 14 | | |
14 | 15 | | |
15 | | - | |
| 16 | + | |
16 | 17 | | |
17 | 18 | | |
18 | 19 | | |
| |||
69 | 70 | | |
70 | 71 | | |
71 | 72 | | |
| 73 | + | |
72 | 74 | | |
73 | 75 | | |
74 | 76 | | |
| |||
92 | 94 | | |
93 | 95 | | |
94 | 96 | | |
95 | | - | |
96 | | - | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
97 | 108 | | |
98 | 109 | | |
99 | 110 | | |
| |||
169 | 180 | | |
170 | 181 | | |
171 | 182 | | |
172 | | - | |
173 | | - | |
| 183 | + | |
174 | 184 | | |
175 | 185 | | |
176 | 186 | | |
177 | | - | |
178 | | - | |
179 | | - | |
180 | 187 | | |
181 | 188 | | |
182 | 189 | | |
| |||
214 | 221 | | |
215 | 222 | | |
216 | 223 | | |
217 | | - | |
218 | | - | |
219 | | - | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
220 | 232 | | |
221 | 233 | | |
222 | 234 | | |
| |||
234 | 246 | | |
235 | 247 | | |
236 | 248 | | |
237 | | - | |
238 | | - | |
239 | | - | |
240 | | - | |
241 | | - | |
242 | | - | |
243 | | - | |
244 | | - | |
245 | | - | |
246 | | - | |
247 | | - | |
248 | | - | |
249 | | - | |
250 | | - | |
251 | | - | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
252 | 252 | | |
253 | | - | |
254 | | - | |
| 253 | + | |
| 254 | + | |
255 | 255 | | |
256 | | - | |
257 | 256 | | |
258 | 257 | | |
259 | 258 | | |
260 | | - | |
261 | 259 | | |
262 | | - | |
263 | | - | |
264 | 260 | | |
265 | 261 | | |
266 | 262 | | |
| |||
290 | 286 | | |
291 | 287 | | |
292 | 288 | | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
293 | 294 | | |
294 | | - | |
295 | | - | |
296 | 295 | | |
297 | | - | |
298 | | - | |
299 | | - | |
| 296 | + | |
| 297 | + | |
300 | 298 | | |
301 | 299 | | |
302 | 300 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
76 | 76 | | |
77 | 77 | | |
78 | 78 | | |
79 | | - | |
| 79 | + | |
80 | 80 | | |
81 | 81 | | |
82 | 82 | | |
| |||
0 commit comments