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.
- raftcorr/__init__.py +94 -0
- raftcorr/__main__.py +4 -0
- raftcorr/_version.py +1 -0
- raftcorr/analysis/__init__.py +52 -0
- raftcorr/analysis/engine.py +669 -0
- raftcorr/analysis/extract.py +104 -0
- raftcorr/analysis/geometry_edit.py +188 -0
- raftcorr/analysis/geometry_sampling.py +125 -0
- raftcorr/analysis/load_data.py +305 -0
- raftcorr/analysis/probes.py +440 -0
- raftcorr/analysis/series.py +86 -0
- raftcorr/callbacks.py +140 -0
- raftcorr/cli/__init__.py +1 -0
- raftcorr/cli/main.py +231 -0
- raftcorr/config.py +139 -0
- raftcorr/conventions.py +42 -0
- raftcorr/engine/__init__.py +5 -0
- raftcorr/engine/backend.py +124 -0
- raftcorr/engine/mapping.py +272 -0
- raftcorr/engine/memory.py +136 -0
- raftcorr/engine/pipeline.py +318 -0
- raftcorr/engine/tiling.py +175 -0
- raftcorr/export/__init__.py +27 -0
- raftcorr/export/figure_layout.py +164 -0
- raftcorr/export/figures.py +384 -0
- raftcorr/export/frame_csv.py +187 -0
- raftcorr/export/params.py +71 -0
- raftcorr/export/probes_csv.py +356 -0
- raftcorr/export/report.py +270 -0
- raftcorr/export/scientific.py +722 -0
- raftcorr/export/tables.py +105 -0
- raftcorr/gui/__init__.py +1 -0
- raftcorr/gui/app.py +980 -0
- raftcorr/gui/app_state.py +437 -0
- raftcorr/gui/arrows/combo_down_hover_light.svg +3 -0
- raftcorr/gui/arrows/spin_down.svg +3 -0
- raftcorr/gui/arrows/spin_down_hover.svg +3 -0
- raftcorr/gui/arrows/spin_down_light.svg +3 -0
- raftcorr/gui/arrows/spin_up.svg +3 -0
- raftcorr/gui/arrows/spin_up_hover.svg +3 -0
- raftcorr/gui/arrows/spin_up_light.svg +3 -0
- raftcorr/gui/assets/icon/RAFTcorr-256.png +0 -0
- raftcorr/gui/assets/icon/RAFTcorr.icns +0 -0
- raftcorr/gui/assets/icon/RAFTcorr.ico +0 -0
- raftcorr/gui/assets/icon/RAFTcorr.svg +7 -0
- raftcorr/gui/controllers/__init__.py +1 -0
- raftcorr/gui/controllers/image_controller.py +178 -0
- raftcorr/gui/controllers/pipeline_controller.py +271 -0
- raftcorr/gui/controllers/pipeline_messages.py +295 -0
- raftcorr/gui/controllers/roi_controller.py +73 -0
- raftcorr/gui/controllers/strain_controller.py +221 -0
- raftcorr/gui/controllers/viz_controller.py +164 -0
- raftcorr/gui/dialogs/__init__.py +1 -0
- raftcorr/gui/dialogs/batch_import_dialog.py +802 -0
- raftcorr/gui/dialogs/export_dialog.py +1007 -0
- raftcorr/gui/dialogs/export_jobs.py +379 -0
- raftcorr/gui/dialogs/export_preview.py +414 -0
- raftcorr/gui/dialogs/export_widgets.py +498 -0
- raftcorr/gui/dialogs/load_data_dialog.py +365 -0
- raftcorr/gui/file_association.py +149 -0
- raftcorr/gui/gc_guard.py +46 -0
- raftcorr/gui/icons.py +251 -0
- raftcorr/gui/panels/__init__.py +1 -0
- raftcorr/gui/panels/analysis/__init__.py +13 -0
- raftcorr/gui/panels/analysis/canvas_panel.py +215 -0
- raftcorr/gui/panels/analysis/chart_panel.py +660 -0
- raftcorr/gui/panels/analysis/probe_table.py +210 -0
- raftcorr/gui/panels/analysis/quantities.py +128 -0
- raftcorr/gui/panels/analysis/tab.py +767 -0
- raftcorr/gui/panels/analysis/text.py +221 -0
- raftcorr/gui/panels/canvas_area.py +1433 -0
- raftcorr/gui/panels/left_sidebar.py +350 -0
- raftcorr/gui/panels/probe_canvas.py +674 -0
- raftcorr/gui/panels/right_sidebar.py +549 -0
- raftcorr/gui/panels/strain_canvas.py +442 -0
- raftcorr/gui/project_bridge.py +116 -0
- raftcorr/gui/strain_window.py +1055 -0
- raftcorr/gui/support/__init__.py +1 -0
- raftcorr/gui/support/colormaps.py +155 -0
- raftcorr/gui/support/fields.py +84 -0
- raftcorr/gui/support/geometry.py +38 -0
- raftcorr/gui/support/io_compat.py +46 -0
- raftcorr/gui/support/locale_format.py +107 -0
- raftcorr/gui/support/matplotlib_fonts.py +75 -0
- raftcorr/gui/theme.py +820 -0
- raftcorr/gui/theme_manager.py +196 -0
- raftcorr/gui/widgets/__init__.py +5 -0
- raftcorr/gui/widgets/canvas_config_overlay.py +103 -0
- raftcorr/gui/widgets/chart_drawing.py +341 -0
- raftcorr/gui/widgets/collapsible_section.py +131 -0
- raftcorr/gui/widgets/color_range.py +118 -0
- raftcorr/gui/widgets/colorbar_overlay.py +240 -0
- raftcorr/gui/widgets/console_log.py +63 -0
- raftcorr/gui/widgets/double_spin.py +52 -0
- raftcorr/gui/widgets/field_selector.py +59 -0
- raftcorr/gui/widgets/frame_navigator.py +194 -0
- raftcorr/gui/widgets/image_list.py +477 -0
- raftcorr/gui/widgets/info_icon.py +63 -0
- raftcorr/gui/widgets/mpl_chart.py +237 -0
- raftcorr/gui/widgets/param_panel.py +198 -0
- raftcorr/gui/widgets/physical_units_widget.py +173 -0
- raftcorr/gui/widgets/range_mode.py +71 -0
- raftcorr/gui/widgets/roi_hint.py +97 -0
- raftcorr/gui/widgets/roi_toolbar.py +358 -0
- raftcorr/gui/widgets/sticky_headers_overlay.py +172 -0
- raftcorr/gui/widgets/strain_field_selector.py +335 -0
- raftcorr/gui/widgets/strain_navigator.py +228 -0
- raftcorr/gui/widgets/strain_param_panel.py +335 -0
- raftcorr/gui/widgets/strain_viz_panel.py +279 -0
- raftcorr/gui/widgets/velocity_settings.py +161 -0
- raftcorr/gui/widgets/workflow_type_panel.py +282 -0
- raftcorr/gui/window_chrome.py +53 -0
- raftcorr/gui/window_geometry.py +81 -0
- raftcorr/i18n/__init__.py +285 -0
- raftcorr/i18n/compiled/.gitkeep +2 -0
- raftcorr/i18n/compiled/raftcorr_de.qm +0 -0
- raftcorr/i18n/compiled/raftcorr_es.qm +0 -0
- raftcorr/i18n/compiled/raftcorr_fr.qm +0 -0
- raftcorr/i18n/compiled/raftcorr_ja.qm +0 -0
- raftcorr/i18n/compiled/raftcorr_ko.qm +0 -0
- raftcorr/i18n/compiled/raftcorr_zh_CN.qm +0 -0
- raftcorr/i18n/compiled/raftcorr_zh_TW.qm +0 -0
- raftcorr/i18n/source/.gitkeep +2 -0
- raftcorr/i18n/source/raftcorr_de.ts +4201 -0
- raftcorr/i18n/source/raftcorr_es.ts +4201 -0
- raftcorr/i18n/source/raftcorr_fr.ts +4201 -0
- raftcorr/i18n/source/raftcorr_ja.ts +4184 -0
- raftcorr/i18n/source/raftcorr_ko.ts +4184 -0
- raftcorr/i18n/source/raftcorr_zh_CN.ts +4184 -0
- raftcorr/i18n/source/raftcorr_zh_TW.ts +4184 -0
- raftcorr/io/__init__.py +29 -0
- raftcorr/io/images.py +236 -0
- raftcorr/io/project.py +386 -0
- raftcorr/models/__init__.py +41 -0
- raftcorr/models/advisor.py +71 -0
- raftcorr/models/loader.py +149 -0
- raftcorr/models/zoo.py +310 -0
- raftcorr/nn/LICENSE-RAFT +33 -0
- raftcorr/nn/__init__.py +26 -0
- raftcorr/nn/corr.py +91 -0
- raftcorr/nn/corr_otf.py +257 -0
- raftcorr/nn/extractor.py +192 -0
- raftcorr/nn/raft.py +190 -0
- raftcorr/nn/update.py +143 -0
- raftcorr/nn/utils.py +42 -0
- raftcorr/post/__init__.py +24 -0
- raftcorr/post/probes.py +183 -0
- raftcorr/post/quality.py +62 -0
- raftcorr/post/smoothing.py +43 -0
- raftcorr/post/strain.py +316 -0
- raftcorr/results.py +164 -0
- raftcorr/roi/__init__.py +39 -0
- raftcorr/roi/masks.py +169 -0
- raftcorr/roi/shapes.py +150 -0
- raftcorr/schedule.py +110 -0
- raftcorr/selftest.py +102 -0
- raftcorr/synthetic.py +110 -0
- raftcorr/viz/__init__.py +31 -0
- raftcorr/viz/colormaps.py +42 -0
- raftcorr/viz/fields.py +217 -0
- raftcorr/viz/render.py +121 -0
- raftcorr-2.0.0.dist-info/METADATA +299 -0
- raftcorr-2.0.0.dist-info/RECORD +166 -0
- raftcorr-2.0.0.dist-info/WHEEL +4 -0
- raftcorr-2.0.0.dist-info/entry_points.txt +5 -0
- 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
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
|
+
]
|