raftcorr 2.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 (166) hide show
  1. raftcorr/__init__.py +94 -0
  2. raftcorr/__main__.py +4 -0
  3. raftcorr/_version.py +1 -0
  4. raftcorr/analysis/__init__.py +52 -0
  5. raftcorr/analysis/engine.py +669 -0
  6. raftcorr/analysis/extract.py +104 -0
  7. raftcorr/analysis/geometry_edit.py +188 -0
  8. raftcorr/analysis/geometry_sampling.py +125 -0
  9. raftcorr/analysis/load_data.py +305 -0
  10. raftcorr/analysis/probes.py +440 -0
  11. raftcorr/analysis/series.py +86 -0
  12. raftcorr/callbacks.py +140 -0
  13. raftcorr/cli/__init__.py +1 -0
  14. raftcorr/cli/main.py +231 -0
  15. raftcorr/config.py +139 -0
  16. raftcorr/conventions.py +42 -0
  17. raftcorr/engine/__init__.py +5 -0
  18. raftcorr/engine/backend.py +124 -0
  19. raftcorr/engine/mapping.py +272 -0
  20. raftcorr/engine/memory.py +136 -0
  21. raftcorr/engine/pipeline.py +318 -0
  22. raftcorr/engine/tiling.py +175 -0
  23. raftcorr/export/__init__.py +27 -0
  24. raftcorr/export/figure_layout.py +164 -0
  25. raftcorr/export/figures.py +384 -0
  26. raftcorr/export/frame_csv.py +187 -0
  27. raftcorr/export/params.py +71 -0
  28. raftcorr/export/probes_csv.py +356 -0
  29. raftcorr/export/report.py +270 -0
  30. raftcorr/export/scientific.py +722 -0
  31. raftcorr/export/tables.py +105 -0
  32. raftcorr/gui/__init__.py +1 -0
  33. raftcorr/gui/app.py +980 -0
  34. raftcorr/gui/app_state.py +437 -0
  35. raftcorr/gui/arrows/combo_down_hover_light.svg +3 -0
  36. raftcorr/gui/arrows/spin_down.svg +3 -0
  37. raftcorr/gui/arrows/spin_down_hover.svg +3 -0
  38. raftcorr/gui/arrows/spin_down_light.svg +3 -0
  39. raftcorr/gui/arrows/spin_up.svg +3 -0
  40. raftcorr/gui/arrows/spin_up_hover.svg +3 -0
  41. raftcorr/gui/arrows/spin_up_light.svg +3 -0
  42. raftcorr/gui/assets/icon/RAFTcorr-256.png +0 -0
  43. raftcorr/gui/assets/icon/RAFTcorr.icns +0 -0
  44. raftcorr/gui/assets/icon/RAFTcorr.ico +0 -0
  45. raftcorr/gui/assets/icon/RAFTcorr.svg +7 -0
  46. raftcorr/gui/controllers/__init__.py +1 -0
  47. raftcorr/gui/controllers/image_controller.py +178 -0
  48. raftcorr/gui/controllers/pipeline_controller.py +271 -0
  49. raftcorr/gui/controllers/pipeline_messages.py +295 -0
  50. raftcorr/gui/controllers/roi_controller.py +73 -0
  51. raftcorr/gui/controllers/strain_controller.py +221 -0
  52. raftcorr/gui/controllers/viz_controller.py +164 -0
  53. raftcorr/gui/dialogs/__init__.py +1 -0
  54. raftcorr/gui/dialogs/batch_import_dialog.py +802 -0
  55. raftcorr/gui/dialogs/export_dialog.py +1007 -0
  56. raftcorr/gui/dialogs/export_jobs.py +379 -0
  57. raftcorr/gui/dialogs/export_preview.py +414 -0
  58. raftcorr/gui/dialogs/export_widgets.py +498 -0
  59. raftcorr/gui/dialogs/load_data_dialog.py +365 -0
  60. raftcorr/gui/file_association.py +149 -0
  61. raftcorr/gui/gc_guard.py +46 -0
  62. raftcorr/gui/icons.py +251 -0
  63. raftcorr/gui/panels/__init__.py +1 -0
  64. raftcorr/gui/panels/analysis/__init__.py +13 -0
  65. raftcorr/gui/panels/analysis/canvas_panel.py +215 -0
  66. raftcorr/gui/panels/analysis/chart_panel.py +660 -0
  67. raftcorr/gui/panels/analysis/probe_table.py +210 -0
  68. raftcorr/gui/panels/analysis/quantities.py +128 -0
  69. raftcorr/gui/panels/analysis/tab.py +767 -0
  70. raftcorr/gui/panels/analysis/text.py +221 -0
  71. raftcorr/gui/panels/canvas_area.py +1433 -0
  72. raftcorr/gui/panels/left_sidebar.py +350 -0
  73. raftcorr/gui/panels/probe_canvas.py +674 -0
  74. raftcorr/gui/panels/right_sidebar.py +549 -0
  75. raftcorr/gui/panels/strain_canvas.py +442 -0
  76. raftcorr/gui/project_bridge.py +116 -0
  77. raftcorr/gui/strain_window.py +1055 -0
  78. raftcorr/gui/support/__init__.py +1 -0
  79. raftcorr/gui/support/colormaps.py +155 -0
  80. raftcorr/gui/support/fields.py +84 -0
  81. raftcorr/gui/support/geometry.py +38 -0
  82. raftcorr/gui/support/io_compat.py +46 -0
  83. raftcorr/gui/support/locale_format.py +107 -0
  84. raftcorr/gui/support/matplotlib_fonts.py +75 -0
  85. raftcorr/gui/theme.py +820 -0
  86. raftcorr/gui/theme_manager.py +196 -0
  87. raftcorr/gui/widgets/__init__.py +5 -0
  88. raftcorr/gui/widgets/canvas_config_overlay.py +103 -0
  89. raftcorr/gui/widgets/chart_drawing.py +341 -0
  90. raftcorr/gui/widgets/collapsible_section.py +131 -0
  91. raftcorr/gui/widgets/color_range.py +118 -0
  92. raftcorr/gui/widgets/colorbar_overlay.py +240 -0
  93. raftcorr/gui/widgets/console_log.py +63 -0
  94. raftcorr/gui/widgets/double_spin.py +52 -0
  95. raftcorr/gui/widgets/field_selector.py +59 -0
  96. raftcorr/gui/widgets/frame_navigator.py +194 -0
  97. raftcorr/gui/widgets/image_list.py +477 -0
  98. raftcorr/gui/widgets/info_icon.py +63 -0
  99. raftcorr/gui/widgets/mpl_chart.py +237 -0
  100. raftcorr/gui/widgets/param_panel.py +198 -0
  101. raftcorr/gui/widgets/physical_units_widget.py +173 -0
  102. raftcorr/gui/widgets/range_mode.py +71 -0
  103. raftcorr/gui/widgets/roi_hint.py +97 -0
  104. raftcorr/gui/widgets/roi_toolbar.py +358 -0
  105. raftcorr/gui/widgets/sticky_headers_overlay.py +172 -0
  106. raftcorr/gui/widgets/strain_field_selector.py +335 -0
  107. raftcorr/gui/widgets/strain_navigator.py +228 -0
  108. raftcorr/gui/widgets/strain_param_panel.py +335 -0
  109. raftcorr/gui/widgets/strain_viz_panel.py +279 -0
  110. raftcorr/gui/widgets/velocity_settings.py +161 -0
  111. raftcorr/gui/widgets/workflow_type_panel.py +282 -0
  112. raftcorr/gui/window_chrome.py +53 -0
  113. raftcorr/gui/window_geometry.py +81 -0
  114. raftcorr/i18n/__init__.py +285 -0
  115. raftcorr/i18n/compiled/.gitkeep +2 -0
  116. raftcorr/i18n/compiled/raftcorr_de.qm +0 -0
  117. raftcorr/i18n/compiled/raftcorr_es.qm +0 -0
  118. raftcorr/i18n/compiled/raftcorr_fr.qm +0 -0
  119. raftcorr/i18n/compiled/raftcorr_ja.qm +0 -0
  120. raftcorr/i18n/compiled/raftcorr_ko.qm +0 -0
  121. raftcorr/i18n/compiled/raftcorr_zh_CN.qm +0 -0
  122. raftcorr/i18n/compiled/raftcorr_zh_TW.qm +0 -0
  123. raftcorr/i18n/source/.gitkeep +2 -0
  124. raftcorr/i18n/source/raftcorr_de.ts +4201 -0
  125. raftcorr/i18n/source/raftcorr_es.ts +4201 -0
  126. raftcorr/i18n/source/raftcorr_fr.ts +4201 -0
  127. raftcorr/i18n/source/raftcorr_ja.ts +4184 -0
  128. raftcorr/i18n/source/raftcorr_ko.ts +4184 -0
  129. raftcorr/i18n/source/raftcorr_zh_CN.ts +4184 -0
  130. raftcorr/i18n/source/raftcorr_zh_TW.ts +4184 -0
  131. raftcorr/io/__init__.py +29 -0
  132. raftcorr/io/images.py +236 -0
  133. raftcorr/io/project.py +386 -0
  134. raftcorr/models/__init__.py +41 -0
  135. raftcorr/models/advisor.py +71 -0
  136. raftcorr/models/loader.py +149 -0
  137. raftcorr/models/zoo.py +310 -0
  138. raftcorr/nn/LICENSE-RAFT +33 -0
  139. raftcorr/nn/__init__.py +26 -0
  140. raftcorr/nn/corr.py +91 -0
  141. raftcorr/nn/corr_otf.py +257 -0
  142. raftcorr/nn/extractor.py +192 -0
  143. raftcorr/nn/raft.py +190 -0
  144. raftcorr/nn/update.py +143 -0
  145. raftcorr/nn/utils.py +42 -0
  146. raftcorr/post/__init__.py +24 -0
  147. raftcorr/post/probes.py +183 -0
  148. raftcorr/post/quality.py +62 -0
  149. raftcorr/post/smoothing.py +43 -0
  150. raftcorr/post/strain.py +316 -0
  151. raftcorr/results.py +164 -0
  152. raftcorr/roi/__init__.py +39 -0
  153. raftcorr/roi/masks.py +169 -0
  154. raftcorr/roi/shapes.py +150 -0
  155. raftcorr/schedule.py +110 -0
  156. raftcorr/selftest.py +102 -0
  157. raftcorr/synthetic.py +110 -0
  158. raftcorr/viz/__init__.py +31 -0
  159. raftcorr/viz/colormaps.py +42 -0
  160. raftcorr/viz/fields.py +217 -0
  161. raftcorr/viz/render.py +121 -0
  162. raftcorr-2.0.0.dist-info/METADATA +299 -0
  163. raftcorr-2.0.0.dist-info/RECORD +166 -0
  164. raftcorr-2.0.0.dist-info/WHEEL +4 -0
  165. raftcorr-2.0.0.dist-info/entry_points.txt +5 -0
  166. raftcorr-2.0.0.dist-info/licenses/LICENSE.md +117 -0
raftcorr/__init__.py ADDED
@@ -0,0 +1,94 @@
1
+ """RAFTcorr: learned digital image correlation (desktop application, command line, Python library).
2
+
3
+ Three lines from an image folder to displacement and strain::
4
+
5
+ import raftcorr
6
+ series = raftcorr.track("images/", roi="roi.png", model="s4")
7
+ strain = raftcorr.compute_strain(series)
8
+
9
+ Conventions (:mod:`raftcorr.conventions`): ``(u, v)`` = reference -> deformed displacement, +u right,
10
+ +v down, in pixels, stored in frame-0 (Lagrangian) coordinates; frame ``k`` of a result is image
11
+ ``k`` of the sequence.
12
+ """
13
+
14
+ from __future__ import annotations
15
+
16
+ from pathlib import Path
17
+ from typing import Any, Sequence
18
+
19
+ import numpy as np
20
+
21
+ from ._version import __version__
22
+ from .callbacks import Callbacks, ConsoleCallbacks, FunctionCallbacks, NullCallbacks, StopRequested
23
+ from .config import PAPER_STRAIN, RunConfig, StrainConfig, TilingConfig, TrackingConfig
24
+ from .results import DisplacementSeries, RunInfo, StrainSeries
25
+ from .schedule import FrameSchedule
26
+
27
+
28
+ def track(
29
+ images: str | Path | Sequence[np.ndarray] | Any,
30
+ roi: str | Path | np.ndarray | None = None,
31
+ model: str = "s4",
32
+ config: RunConfig | None = None,
33
+ frame_masks: dict[int, np.ndarray] | None = None,
34
+ callbacks: Callbacks | None = None,
35
+ ) -> DisplacementSeries:
36
+ """Displacement of every frame relative to frame 0.
37
+
38
+ ``images``: a folder, a list of image files, an :class:`~raftcorr.io.ImageSequence` or a list
39
+ of 2-D arrays (grey levels 0-255). ``roi``: a mask image path, a boolean array, or None (whole
40
+ image). ``model``: ``s1``, ``s2``, ``s4``, ``s8`` or a checkpoint path (ignored when ``config``
41
+ is given).
42
+ """
43
+ from .engine.pipeline import Pipeline
44
+ from .io.images import ImageSequence
45
+ from .roi.masks import load_mask
46
+
47
+ if isinstance(images, (str, Path)):
48
+ seq: Any = ImageSequence.from_folder(images)
49
+ elif isinstance(images, (list, tuple)) and images and isinstance(images[0], (str, Path)):
50
+ seq = ImageSequence(list(images))
51
+ else:
52
+ seq = images
53
+ shape = np.asarray(seq[0]).shape
54
+ mask = load_mask(roi, shape) if isinstance(roi, (str, Path)) else roi
55
+ cfg = config or RunConfig(model=model)
56
+ return Pipeline(cfg, callbacks).run(seq, mask, frame_masks=frame_masks)
57
+
58
+
59
+ def compute_strain(series: DisplacementSeries, config: StrainConfig | None = None,
60
+ callbacks: Callbacks | None = None) -> StrainSeries:
61
+ """Strain of every computed frame (paper settings by default)."""
62
+ from .post.strain import compute_strain as _cs
63
+
64
+ return _cs(series, config or PAPER_STRAIN, callbacks=callbacks)
65
+
66
+
67
+ def load_model(key_or_path: str = "s4", device: str = "auto"):
68
+ """A released model (``s1`` ... ``s8``) or a checkpoint, ready for inference."""
69
+ from .models import load_model as _lm
70
+ from .models import resolve_weights
71
+
72
+ return _lm(resolve_weights(key_or_path), device)
73
+
74
+
75
+ __all__ = [
76
+ "Callbacks",
77
+ "ConsoleCallbacks",
78
+ "DisplacementSeries",
79
+ "FrameSchedule",
80
+ "FunctionCallbacks",
81
+ "NullCallbacks",
82
+ "PAPER_STRAIN",
83
+ "RunConfig",
84
+ "RunInfo",
85
+ "StopRequested",
86
+ "StrainConfig",
87
+ "StrainSeries",
88
+ "TilingConfig",
89
+ "TrackingConfig",
90
+ "__version__",
91
+ "compute_strain",
92
+ "load_model",
93
+ "track",
94
+ ]
raftcorr/__main__.py ADDED
@@ -0,0 +1,4 @@
1
+ from .cli.main import main
2
+
3
+ if __name__ == "__main__":
4
+ raise SystemExit(main())
raftcorr/_version.py ADDED
@@ -0,0 +1 @@
1
+ __version__ = "2.0.0"
@@ -0,0 +1,52 @@
1
+ """Probe-based post-processing analysis of RAFTcorr's dense results.
2
+
3
+ Core layer: no Qt, no ``tr()``. The GUI in ``raftcorr.gui.panels.analysis``
4
+ is one consumer; a script holding a ``DisplacementSeries`` is another.
5
+ """
6
+
7
+ from raftcorr.analysis.engine import (
8
+ AnalysisEngine,
9
+ Kymograph,
10
+ Profile,
11
+ SampleStatus,
12
+ )
13
+ from raftcorr.analysis.extract import extract_series, field_values, frame_count
14
+ from raftcorr.analysis.load_data import (
15
+ LoadData,
16
+ LoadSync,
17
+ LoadTable,
18
+ parse_load_table,
19
+ read_load_table,
20
+ )
21
+ from raftcorr.analysis.probes import (
22
+ AreaGeom,
23
+ LineGeom,
24
+ PointGeom,
25
+ Probe,
26
+ ProbeSet,
27
+ allowed_reductions,
28
+ )
29
+ from raftcorr.analysis.series import FrameStatus, TimeSeries
30
+
31
+ __all__ = [
32
+ "AnalysisEngine",
33
+ "AreaGeom",
34
+ "FrameStatus",
35
+ "Kymograph",
36
+ "LineGeom",
37
+ "LoadData",
38
+ "LoadSync",
39
+ "LoadTable",
40
+ "PointGeom",
41
+ "Probe",
42
+ "ProbeSet",
43
+ "Profile",
44
+ "SampleStatus",
45
+ "TimeSeries",
46
+ "allowed_reductions",
47
+ "extract_series",
48
+ "field_values",
49
+ "frame_count",
50
+ "parse_load_table",
51
+ "read_load_table",
52
+ ]