subsetdic 0.1.0__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.
- subsetdic-0.1.0/.github/workflows/publish-pypi.yml +75 -0
- subsetdic-0.1.0/.github/workflows/wheels.yml +52 -0
- subsetdic-0.1.0/.gitignore +237 -0
- subsetdic-0.1.0/CMakeLists.txt +24 -0
- subsetdic-0.1.0/LICENSE +21 -0
- subsetdic-0.1.0/PKG-INFO +286 -0
- subsetdic-0.1.0/README.md +253 -0
- subsetdic-0.1.0/case/ring/001.bmp +0 -0
- subsetdic-0.1.0/case/ring/002.bmp +0 -0
- subsetdic-0.1.0/case/ring/003.bmp +0 -0
- subsetdic-0.1.0/case/star/001.bmp +0 -0
- subsetdic-0.1.0/case/star/002.bmp +0 -0
- subsetdic-0.1.0/case/star/003.bmp +0 -0
- subsetdic-0.1.0/config/default.yaml +26 -0
- subsetdic-0.1.0/pyproject.toml +38 -0
- subsetdic-0.1.0/src/cpp/bindings.cpp +289 -0
- subsetdic-0.1.0/src/cpp/extrapolate.cpp +139 -0
- subsetdic-0.1.0/src/cpp/interpolation.cpp +28 -0
- subsetdic-0.1.0/src/cpp/region.cpp +823 -0
- subsetdic-0.1.0/src/cpp/rgdic.cpp +524 -0
- subsetdic-0.1.0/src/cpp/seeds.cpp +618 -0
- subsetdic-0.1.0/src/cpp/solver.cpp +52 -0
- subsetdic-0.1.0/src/cpp/strain.cpp +146 -0
- subsetdic-0.1.0/src/cpp/types.hpp +92 -0
- subsetdic-0.1.0/src/subsetdic/__init__.py +7 -0
- subsetdic-0.1.0/src/subsetdic/bcoef.py +78 -0
- subsetdic-0.1.0/src/subsetdic/config.py +64 -0
- subsetdic-0.1.0/src/subsetdic/dic.py +269 -0
- subsetdic-0.1.0/src/subsetdic/qk.py +121 -0
- subsetdic-0.1.0/src/subsetdic/sift_seeds.py +60 -0
- subsetdic-0.1.0/tests/run_cases.py +105 -0
- subsetdic-0.1.0/tests/test_dic.py +55 -0
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
name: Publish to PyPI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
tags:
|
|
6
|
+
- "v*"
|
|
7
|
+
workflow_dispatch:
|
|
8
|
+
|
|
9
|
+
permissions:
|
|
10
|
+
contents: read
|
|
11
|
+
id-token: write
|
|
12
|
+
|
|
13
|
+
jobs:
|
|
14
|
+
build:
|
|
15
|
+
name: Build ${{ matrix.os }} distributions
|
|
16
|
+
runs-on: ${{ matrix.os }}
|
|
17
|
+
strategy:
|
|
18
|
+
fail-fast: false
|
|
19
|
+
matrix:
|
|
20
|
+
os: [ubuntu-latest, windows-latest]
|
|
21
|
+
|
|
22
|
+
steps:
|
|
23
|
+
- uses: actions/checkout@v4
|
|
24
|
+
|
|
25
|
+
- uses: actions/setup-python@v5
|
|
26
|
+
with:
|
|
27
|
+
python-version: "3.12"
|
|
28
|
+
|
|
29
|
+
- name: Build wheels
|
|
30
|
+
uses: pypa/cibuildwheel@v4.1.0
|
|
31
|
+
|
|
32
|
+
- uses: actions/upload-artifact@v4
|
|
33
|
+
with:
|
|
34
|
+
name: wheels-${{ matrix.os }}
|
|
35
|
+
path: wheelhouse/*.whl
|
|
36
|
+
|
|
37
|
+
sdist:
|
|
38
|
+
name: Build source distribution
|
|
39
|
+
runs-on: ubuntu-latest
|
|
40
|
+
|
|
41
|
+
steps:
|
|
42
|
+
- uses: actions/checkout@v4
|
|
43
|
+
|
|
44
|
+
- uses: actions/setup-python@v5
|
|
45
|
+
with:
|
|
46
|
+
python-version: "3.12"
|
|
47
|
+
|
|
48
|
+
- name: Build sdist
|
|
49
|
+
run: |
|
|
50
|
+
python -m pip install --upgrade build
|
|
51
|
+
python -m build --sdist
|
|
52
|
+
|
|
53
|
+
- uses: actions/upload-artifact@v4
|
|
54
|
+
with:
|
|
55
|
+
name: sdist
|
|
56
|
+
path: dist/*.tar.gz
|
|
57
|
+
|
|
58
|
+
publish:
|
|
59
|
+
name: Publish distributions to PyPI
|
|
60
|
+
needs: [build, sdist]
|
|
61
|
+
runs-on: ubuntu-latest
|
|
62
|
+
environment:
|
|
63
|
+
name: pypi
|
|
64
|
+
url: https://pypi.org/p/subsetdic
|
|
65
|
+
|
|
66
|
+
steps:
|
|
67
|
+
- uses: actions/download-artifact@v4
|
|
68
|
+
with:
|
|
69
|
+
path: dist
|
|
70
|
+
merge-multiple: true
|
|
71
|
+
|
|
72
|
+
- name: Publish to PyPI
|
|
73
|
+
uses: pypa/gh-action-pypi-publish@release/v1
|
|
74
|
+
with:
|
|
75
|
+
packages-dir: dist
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
name: Build wheels
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [main]
|
|
6
|
+
pull_request:
|
|
7
|
+
workflow_dispatch:
|
|
8
|
+
|
|
9
|
+
jobs:
|
|
10
|
+
build:
|
|
11
|
+
name: Build ${{ matrix.os }} wheels
|
|
12
|
+
runs-on: ${{ matrix.os }}
|
|
13
|
+
strategy:
|
|
14
|
+
fail-fast: false
|
|
15
|
+
matrix:
|
|
16
|
+
os: [ubuntu-latest, windows-latest]
|
|
17
|
+
|
|
18
|
+
steps:
|
|
19
|
+
- uses: actions/checkout@v4
|
|
20
|
+
|
|
21
|
+
- uses: actions/setup-python@v5
|
|
22
|
+
with:
|
|
23
|
+
python-version: "3.12"
|
|
24
|
+
|
|
25
|
+
- name: Build wheels
|
|
26
|
+
uses: pypa/cibuildwheel@v4.1.0
|
|
27
|
+
|
|
28
|
+
- uses: actions/upload-artifact@v4
|
|
29
|
+
with:
|
|
30
|
+
name: wheels-${{ matrix.os }}
|
|
31
|
+
path: wheelhouse/*.whl
|
|
32
|
+
|
|
33
|
+
sdist:
|
|
34
|
+
name: Build source distribution
|
|
35
|
+
runs-on: ubuntu-latest
|
|
36
|
+
|
|
37
|
+
steps:
|
|
38
|
+
- uses: actions/checkout@v4
|
|
39
|
+
|
|
40
|
+
- uses: actions/setup-python@v5
|
|
41
|
+
with:
|
|
42
|
+
python-version: "3.12"
|
|
43
|
+
|
|
44
|
+
- name: Build sdist
|
|
45
|
+
run: |
|
|
46
|
+
python -m pip install --upgrade build
|
|
47
|
+
python -m build --sdist
|
|
48
|
+
|
|
49
|
+
- uses: actions/upload-artifact@v4
|
|
50
|
+
with:
|
|
51
|
+
name: sdist
|
|
52
|
+
path: dist/*.tar.gz
|
|
@@ -0,0 +1,237 @@
|
|
|
1
|
+
# Byte-compiled / optimized / DLL files
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[codz]
|
|
4
|
+
*$py.class
|
|
5
|
+
|
|
6
|
+
# C extensions
|
|
7
|
+
*.so
|
|
8
|
+
|
|
9
|
+
# Distribution / packaging
|
|
10
|
+
.Python
|
|
11
|
+
build/
|
|
12
|
+
develop-eggs/
|
|
13
|
+
dist/
|
|
14
|
+
downloads/
|
|
15
|
+
eggs/
|
|
16
|
+
.eggs/
|
|
17
|
+
lib/
|
|
18
|
+
lib64/
|
|
19
|
+
parts/
|
|
20
|
+
sdist/
|
|
21
|
+
var/
|
|
22
|
+
wheels/
|
|
23
|
+
share/python-wheels/
|
|
24
|
+
*.egg-info/
|
|
25
|
+
.installed.cfg
|
|
26
|
+
*.egg
|
|
27
|
+
MANIFEST
|
|
28
|
+
|
|
29
|
+
# PyInstaller
|
|
30
|
+
# Usually these files are written by a python script from a template
|
|
31
|
+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
|
32
|
+
*.manifest
|
|
33
|
+
*.spec
|
|
34
|
+
|
|
35
|
+
# Installer logs
|
|
36
|
+
pip-log.txt
|
|
37
|
+
pip-delete-this-directory.txt
|
|
38
|
+
|
|
39
|
+
# Unit test / coverage reports
|
|
40
|
+
htmlcov/
|
|
41
|
+
.tox/
|
|
42
|
+
.nox/
|
|
43
|
+
.coverage
|
|
44
|
+
.coverage.*
|
|
45
|
+
.cache
|
|
46
|
+
nosetests.xml
|
|
47
|
+
coverage.xml
|
|
48
|
+
*.cover
|
|
49
|
+
*.py.cover
|
|
50
|
+
.hypothesis/
|
|
51
|
+
.pytest_cache/
|
|
52
|
+
cover/
|
|
53
|
+
|
|
54
|
+
# Translations
|
|
55
|
+
*.mo
|
|
56
|
+
*.pot
|
|
57
|
+
|
|
58
|
+
# Django stuff:
|
|
59
|
+
*.log
|
|
60
|
+
local_settings.py
|
|
61
|
+
db.sqlite3
|
|
62
|
+
db.sqlite3-journal
|
|
63
|
+
|
|
64
|
+
# Flask stuff:
|
|
65
|
+
instance/
|
|
66
|
+
.webassets-cache
|
|
67
|
+
|
|
68
|
+
# Scrapy stuff:
|
|
69
|
+
.scrapy
|
|
70
|
+
|
|
71
|
+
# Sphinx documentation
|
|
72
|
+
docs/_build/
|
|
73
|
+
|
|
74
|
+
# PyBuilder
|
|
75
|
+
.pybuilder/
|
|
76
|
+
target/
|
|
77
|
+
|
|
78
|
+
# Jupyter Notebook
|
|
79
|
+
.ipynb_checkpoints
|
|
80
|
+
|
|
81
|
+
# IPython
|
|
82
|
+
profile_default/
|
|
83
|
+
ipython_config.py
|
|
84
|
+
|
|
85
|
+
# pyenv
|
|
86
|
+
# For a library or package, you might want to ignore these files since the code is
|
|
87
|
+
# intended to run in multiple environments; otherwise, check them in:
|
|
88
|
+
# .python-version
|
|
89
|
+
|
|
90
|
+
# pipenv
|
|
91
|
+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
|
|
92
|
+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
|
|
93
|
+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
|
|
94
|
+
# install all needed dependencies.
|
|
95
|
+
# Pipfile.lock
|
|
96
|
+
|
|
97
|
+
# UV
|
|
98
|
+
# Similar to Pipfile.lock, it is generally recommended to include uv.lock in version control.
|
|
99
|
+
# This is especially recommended for binary packages to ensure reproducibility, and is more
|
|
100
|
+
# commonly ignored for libraries.
|
|
101
|
+
# uv.lock
|
|
102
|
+
|
|
103
|
+
# poetry
|
|
104
|
+
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
|
|
105
|
+
# This is especially recommended for binary packages to ensure reproducibility, and is more
|
|
106
|
+
# commonly ignored for libraries.
|
|
107
|
+
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
|
|
108
|
+
# poetry.lock
|
|
109
|
+
# poetry.toml
|
|
110
|
+
|
|
111
|
+
# pdm
|
|
112
|
+
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
|
|
113
|
+
# pdm recommends including project-wide configuration in pdm.toml, but excluding .pdm-python.
|
|
114
|
+
# https://pdm-project.org/en/latest/usage/project/#working-with-version-control
|
|
115
|
+
# pdm.lock
|
|
116
|
+
# pdm.toml
|
|
117
|
+
.pdm-python
|
|
118
|
+
.pdm-build/
|
|
119
|
+
|
|
120
|
+
# pixi
|
|
121
|
+
# Similar to Pipfile.lock, it is generally recommended to include pixi.lock in version control.
|
|
122
|
+
# pixi.lock
|
|
123
|
+
# Pixi creates a virtual environment in the .pixi directory, just like venv module creates one
|
|
124
|
+
# in the .venv directory. It is recommended not to include this directory in version control.
|
|
125
|
+
.pixi
|
|
126
|
+
|
|
127
|
+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
|
|
128
|
+
__pypackages__/
|
|
129
|
+
|
|
130
|
+
# Celery stuff
|
|
131
|
+
celerybeat-schedule
|
|
132
|
+
celerybeat.pid
|
|
133
|
+
|
|
134
|
+
# Redis
|
|
135
|
+
*.rdb
|
|
136
|
+
*.aof
|
|
137
|
+
*.pid
|
|
138
|
+
|
|
139
|
+
# RabbitMQ
|
|
140
|
+
mnesia/
|
|
141
|
+
rabbitmq/
|
|
142
|
+
rabbitmq-data/
|
|
143
|
+
|
|
144
|
+
# ActiveMQ
|
|
145
|
+
activemq-data/
|
|
146
|
+
|
|
147
|
+
# SageMath parsed files
|
|
148
|
+
*.sage.py
|
|
149
|
+
|
|
150
|
+
# Environments
|
|
151
|
+
.env
|
|
152
|
+
.envrc
|
|
153
|
+
.venv
|
|
154
|
+
env/
|
|
155
|
+
venv/
|
|
156
|
+
ENV/
|
|
157
|
+
env.bak/
|
|
158
|
+
venv.bak/
|
|
159
|
+
|
|
160
|
+
# Spyder project settings
|
|
161
|
+
.spyderproject
|
|
162
|
+
.spyproject
|
|
163
|
+
|
|
164
|
+
# Rope project settings
|
|
165
|
+
.ropeproject
|
|
166
|
+
|
|
167
|
+
# mkdocs documentation
|
|
168
|
+
/site
|
|
169
|
+
|
|
170
|
+
# mypy
|
|
171
|
+
.mypy_cache/
|
|
172
|
+
.dmypy.json
|
|
173
|
+
dmypy.json
|
|
174
|
+
|
|
175
|
+
# Pyre type checker
|
|
176
|
+
.pyre/
|
|
177
|
+
|
|
178
|
+
# pytype static type analyzer
|
|
179
|
+
.pytype/
|
|
180
|
+
|
|
181
|
+
# Cython debug symbols
|
|
182
|
+
cython_debug/
|
|
183
|
+
|
|
184
|
+
# PyCharm
|
|
185
|
+
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
|
|
186
|
+
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
|
|
187
|
+
# and can be added to the global gitignore or merged into this file. For a more nuclear
|
|
188
|
+
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
|
|
189
|
+
# .idea/
|
|
190
|
+
|
|
191
|
+
# Abstra
|
|
192
|
+
# Abstra is an AI-powered process automation framework.
|
|
193
|
+
# Ignore directories containing user credentials, local state, and settings.
|
|
194
|
+
# Learn more at https://abstra.io/docs
|
|
195
|
+
.abstra/
|
|
196
|
+
|
|
197
|
+
# Visual Studio Code
|
|
198
|
+
# Visual Studio Code specific template is maintained in a separate VisualStudioCode.gitignore
|
|
199
|
+
# that can be found at https://github.com/github/gitignore/blob/main/Global/VisualStudioCode.gitignore
|
|
200
|
+
# and can be added to the global gitignore or merged into this file. However, if you prefer,
|
|
201
|
+
# you could uncomment the following to ignore the entire vscode folder
|
|
202
|
+
# .vscode/
|
|
203
|
+
# Temporary file for partial code execution
|
|
204
|
+
tempCodeRunnerFile.py
|
|
205
|
+
|
|
206
|
+
# Ruff stuff:
|
|
207
|
+
.ruff_cache/
|
|
208
|
+
|
|
209
|
+
# PyPI configuration file
|
|
210
|
+
.pypirc
|
|
211
|
+
|
|
212
|
+
# Marimo
|
|
213
|
+
marimo/_static/
|
|
214
|
+
marimo/_lsp/
|
|
215
|
+
__marimo__/
|
|
216
|
+
|
|
217
|
+
# Streamlit
|
|
218
|
+
.streamlit/secrets.toml
|
|
219
|
+
|
|
220
|
+
# Native extension / CMake build artifacts
|
|
221
|
+
_skbuild/
|
|
222
|
+
CMakeFiles/
|
|
223
|
+
CMakeCache.txt
|
|
224
|
+
cmake_install.cmake
|
|
225
|
+
compile_commands.json
|
|
226
|
+
*.cmake
|
|
227
|
+
*.vcxproj
|
|
228
|
+
*.vcxproj.filters
|
|
229
|
+
*.sln
|
|
230
|
+
*.pyd
|
|
231
|
+
*.pdb
|
|
232
|
+
*.ilk
|
|
233
|
+
*.exp
|
|
234
|
+
|
|
235
|
+
# Generated DIC case outputs
|
|
236
|
+
case/**/result/
|
|
237
|
+
reference_code/
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
cmake_minimum_required(VERSION 3.21)
|
|
2
|
+
project(subsetdic VERSION 0.1.0 LANGUAGES CXX)
|
|
3
|
+
|
|
4
|
+
set(CMAKE_CXX_STANDARD 17)
|
|
5
|
+
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
|
6
|
+
|
|
7
|
+
find_package(Python REQUIRED COMPONENTS Interpreter Development.Module)
|
|
8
|
+
find_package(pybind11 CONFIG REQUIRED)
|
|
9
|
+
|
|
10
|
+
pybind11_add_module(_core
|
|
11
|
+
src/cpp/bindings.cpp
|
|
12
|
+
src/cpp/interpolation.cpp
|
|
13
|
+
src/cpp/solver.cpp
|
|
14
|
+
src/cpp/region.cpp
|
|
15
|
+
src/cpp/seeds.cpp
|
|
16
|
+
src/cpp/rgdic.cpp
|
|
17
|
+
src/cpp/strain.cpp
|
|
18
|
+
src/cpp/extrapolate.cpp
|
|
19
|
+
)
|
|
20
|
+
|
|
21
|
+
target_include_directories(_core PRIVATE src/cpp)
|
|
22
|
+
target_compile_definitions(_core PRIVATE VERSION_INFO="0.1.0")
|
|
23
|
+
|
|
24
|
+
install(TARGETS _core DESTINATION subsetdic)
|
subsetdic-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 LeeBDa
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
subsetdic-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,286 @@
|
|
|
1
|
+
Metadata-Version: 2.2
|
|
2
|
+
Name: subsetdic
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: C++ implementation of Subset-DIC algorithms with Python bindings
|
|
5
|
+
License: MIT License
|
|
6
|
+
|
|
7
|
+
Copyright (c) 2026 LeeBDa
|
|
8
|
+
|
|
9
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
10
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
11
|
+
in the Software without restriction, including without limitation the rights
|
|
12
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
13
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
14
|
+
furnished to do so, subject to the following conditions:
|
|
15
|
+
|
|
16
|
+
The above copyright notice and this permission notice shall be included in all
|
|
17
|
+
copies or substantial portions of the Software.
|
|
18
|
+
|
|
19
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
20
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
21
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
22
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
23
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
24
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
25
|
+
SOFTWARE.
|
|
26
|
+
|
|
27
|
+
Requires-Python: >=3.9
|
|
28
|
+
Requires-Dist: numpy>=1.20
|
|
29
|
+
Requires-Dist: opencv-python>=4.5
|
|
30
|
+
Requires-Dist: opencv-contrib-python>=4.5
|
|
31
|
+
Requires-Dist: pyyaml>=6.0
|
|
32
|
+
Description-Content-Type: text/markdown
|
|
33
|
+
|
|
34
|
+
# SubsetDIC
|
|
35
|
+
|
|
36
|
+
SubsetDIC is a Python package for 2D subset-based digital image correlation
|
|
37
|
+
(DIC). The performance-critical algorithms are implemented in C++ and exposed
|
|
38
|
+
to Python through pybind11.
|
|
39
|
+
|
|
40
|
+
This project is based on the algorithm flow of Ncorr and keeps the original
|
|
41
|
+
Ncorr reference source under `reference_code/` for comparison.
|
|
42
|
+
|
|
43
|
+
## Features
|
|
44
|
+
|
|
45
|
+
- Subset-based 2D DIC for grayscale image pairs.
|
|
46
|
+
- C++ core with Python API.
|
|
47
|
+
- ROI-based region extraction.
|
|
48
|
+
- SIFT or manual seed selection.
|
|
49
|
+
- Region-growing DIC propagation.
|
|
50
|
+
- Optional displacement-gradient / strain-field calculation.
|
|
51
|
+
- Example `ring` and `star` cases under `case/`.
|
|
52
|
+
|
|
53
|
+
## Project Layout
|
|
54
|
+
|
|
55
|
+
```text
|
|
56
|
+
SubsetDIC/
|
|
57
|
+
|-- src/
|
|
58
|
+
| |-- subsetdic/ # Python API and configuration helpers
|
|
59
|
+
| `-- cpp/ # C++ DIC core and pybind11 bindings
|
|
60
|
+
|-- config/
|
|
61
|
+
| `-- default.yaml # Default DIC parameters
|
|
62
|
+
|-- case/
|
|
63
|
+
| |-- ring/ # Example ring images and ROI
|
|
64
|
+
| `-- star/ # Example star displacement images and ROI
|
|
65
|
+
|-- tests/
|
|
66
|
+
| |-- test_dic.py # Synthetic translation integration test
|
|
67
|
+
| `-- run_cases.py # Run bundled ring/star cases
|
|
68
|
+
`-- reference_code/ # Ncorr MATLAB/C++ reference implementation
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
## Installation
|
|
72
|
+
|
|
73
|
+
Requirements:
|
|
74
|
+
|
|
75
|
+
- Python 3.9+
|
|
76
|
+
- CMake 3.21+
|
|
77
|
+
- A C++17 compiler
|
|
78
|
+
- Visual Studio C++ Build Tools on Windows
|
|
79
|
+
|
|
80
|
+
Install in editable mode:
|
|
81
|
+
|
|
82
|
+
```powershell
|
|
83
|
+
python -m pip install -e .
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
This compiles the C++ extension module `_core`. In editable mode, Python source
|
|
87
|
+
files are loaded from this repository, while the compiled extension may be
|
|
88
|
+
installed into your Python environment's `site-packages`, for example:
|
|
89
|
+
|
|
90
|
+
```text
|
|
91
|
+
C:\Users\<user>\miniconda3\Lib\site-packages\subsetdic\_core.cp312-win_amd64.pyd
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
After changing files in `src/cpp/`, run the install command again to rebuild
|
|
95
|
+
the extension.
|
|
96
|
+
|
|
97
|
+
## Quick Start
|
|
98
|
+
|
|
99
|
+
```python
|
|
100
|
+
import numpy as np
|
|
101
|
+
from PIL import Image
|
|
102
|
+
from subsetdic import SubsetDIC
|
|
103
|
+
|
|
104
|
+
ref = np.array(Image.open("case/star/001.bmp")).astype(np.float64)
|
|
105
|
+
cur = np.array(Image.open("case/star/002.bmp")).astype(np.float64)
|
|
106
|
+
roi = (np.array(Image.open("case/star/003.bmp")) > 128).astype(np.uint8)
|
|
107
|
+
|
|
108
|
+
dic = SubsetDIC({
|
|
109
|
+
"dic": {
|
|
110
|
+
"radius": 5,
|
|
111
|
+
"spacing": 1,
|
|
112
|
+
"cutoff_diffnorm": 1e-6,
|
|
113
|
+
"cutoff_iteration": 50,
|
|
114
|
+
"subsettrunc": False,
|
|
115
|
+
},
|
|
116
|
+
"seeds": {
|
|
117
|
+
"method": "manual",
|
|
118
|
+
"n_seeds": 1,
|
|
119
|
+
"manual_positions": [(512, 128)],
|
|
120
|
+
},
|
|
121
|
+
"strain": {
|
|
122
|
+
"enabled": True,
|
|
123
|
+
"radius": 15,
|
|
124
|
+
},
|
|
125
|
+
"border": {
|
|
126
|
+
"bcoef": 5,
|
|
127
|
+
"interp": 5,
|
|
128
|
+
"extrap": 5,
|
|
129
|
+
},
|
|
130
|
+
})
|
|
131
|
+
|
|
132
|
+
result = dic.run(ref, cur, roi)
|
|
133
|
+
|
|
134
|
+
print(result.success)
|
|
135
|
+
print(result.u.shape, result.v.shape)
|
|
136
|
+
print(result.valid.sum())
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
## API
|
|
140
|
+
|
|
141
|
+
The main entry point is:
|
|
142
|
+
|
|
143
|
+
```python
|
|
144
|
+
from subsetdic import SubsetDIC
|
|
145
|
+
|
|
146
|
+
dic = SubsetDIC(config)
|
|
147
|
+
result = dic.run(ref_img, def_img, roi_mask=None)
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
Inputs:
|
|
151
|
+
|
|
152
|
+
- `ref_img`: reference image, 2D array.
|
|
153
|
+
- `def_img`: deformed/current image, 2D array with the same shape.
|
|
154
|
+
- `roi_mask`: optional 2D mask. Non-zero pixels are included in DIC.
|
|
155
|
+
|
|
156
|
+
`DicResult` fields:
|
|
157
|
+
|
|
158
|
+
- `success`: whether DIC produced a result.
|
|
159
|
+
- `u`, `v`: displacement fields.
|
|
160
|
+
- `corrcoef`: correlation residual field.
|
|
161
|
+
- `valid`: valid point mask.
|
|
162
|
+
- `dudx`, `dudy`, `dvdx`, `dvdy`: displacement gradients, available when
|
|
163
|
+
strain calculation is enabled.
|
|
164
|
+
- `points_computed`: number of propagated valid points.
|
|
165
|
+
- `regions`: ROI regions generated from the mask.
|
|
166
|
+
|
|
167
|
+
## Configuration
|
|
168
|
+
|
|
169
|
+
Default parameters live in `config/default.yaml`.
|
|
170
|
+
|
|
171
|
+
```yaml
|
|
172
|
+
dic:
|
|
173
|
+
radius: 20
|
|
174
|
+
spacing: 1
|
|
175
|
+
cutoff_diffnorm: 1.0e-6
|
|
176
|
+
cutoff_iteration: 50
|
|
177
|
+
subsettrunc: true
|
|
178
|
+
direct_seed_grid: false
|
|
179
|
+
|
|
180
|
+
seeds:
|
|
181
|
+
method: sift
|
|
182
|
+
n_seeds: 1
|
|
183
|
+
|
|
184
|
+
strain:
|
|
185
|
+
enabled: true
|
|
186
|
+
radius: 5
|
|
187
|
+
|
|
188
|
+
postprocess:
|
|
189
|
+
enabled: true
|
|
190
|
+
max_iterations: 8
|
|
191
|
+
min_neighbors: 3
|
|
192
|
+
corrcoef_threshold: 2.0
|
|
193
|
+
|
|
194
|
+
border:
|
|
195
|
+
bcoef: 20
|
|
196
|
+
interp: 20
|
|
197
|
+
extrap: 20
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
Important parameters:
|
|
201
|
+
|
|
202
|
+
- `dic.radius`: subset radius in pixels.
|
|
203
|
+
- `dic.spacing`: grid spacing between calculated DIC points.
|
|
204
|
+
- `dic.cutoff_diffnorm`: IC-GN convergence threshold.
|
|
205
|
+
- `dic.cutoff_iteration`: maximum IC-GN iterations.
|
|
206
|
+
- `dic.subsettrunc`: whether to truncate subsets near ROI boundaries.
|
|
207
|
+
- `dic.direct_seed_grid`: solve each grid point with seed-style local search
|
|
208
|
+
instead of region-growing propagation. This is slower but more robust for
|
|
209
|
+
periodic or highly nonuniform displacement fields such as the star case.
|
|
210
|
+
- `seeds.method`: `sift` for automatic seeds or `manual` for fixed positions.
|
|
211
|
+
- `seeds.manual_positions`: list of `(x, y)` seed coordinates when using
|
|
212
|
+
manual seeds.
|
|
213
|
+
- `strain.enabled`: whether to compute displacement gradients.
|
|
214
|
+
- `strain.radius`: radius used for gradient fitting.
|
|
215
|
+
- `postprocess.enabled`: interpolate bad displacement points from neighboring
|
|
216
|
+
valid points before strain calculation.
|
|
217
|
+
- `postprocess.max_iterations`: maximum neighbor-growing fill iterations.
|
|
218
|
+
- `postprocess.min_neighbors`: minimum valid 8-neighbors required to fill a bad
|
|
219
|
+
point.
|
|
220
|
+
- `postprocess.corrcoef_threshold`: points with larger correlation residual are
|
|
221
|
+
treated as bad during interpolation.
|
|
222
|
+
|
|
223
|
+
You can also override selected DIC parameters when calling `run`:
|
|
224
|
+
|
|
225
|
+
```python
|
|
226
|
+
result = dic.run(ref, cur, roi, radius=15, spacing=3, compute_strain=False)
|
|
227
|
+
```
|
|
228
|
+
|
|
229
|
+
## Running Tests
|
|
230
|
+
|
|
231
|
+
Run the synthetic translation test:
|
|
232
|
+
|
|
233
|
+
```powershell
|
|
234
|
+
python tests\test_dic.py
|
|
235
|
+
```
|
|
236
|
+
|
|
237
|
+
Expected output includes:
|
|
238
|
+
|
|
239
|
+
```text
|
|
240
|
+
PASSED
|
|
241
|
+
All tests passed!
|
|
242
|
+
```
|
|
243
|
+
|
|
244
|
+
If `pytest` is installed, the same test can be run with:
|
|
245
|
+
|
|
246
|
+
```powershell
|
|
247
|
+
python -m pytest -q
|
|
248
|
+
```
|
|
249
|
+
|
|
250
|
+
## Running Example Cases
|
|
251
|
+
|
|
252
|
+
Run bundled cases:
|
|
253
|
+
|
|
254
|
+
```powershell
|
|
255
|
+
python tests\run_cases.py
|
|
256
|
+
```
|
|
257
|
+
|
|
258
|
+
This runs:
|
|
259
|
+
|
|
260
|
+
- `case/ring`
|
|
261
|
+
- `case/star`
|
|
262
|
+
|
|
263
|
+
Generated outputs are saved under each case's `result/` directory:
|
|
264
|
+
|
|
265
|
+
- `u.npy`
|
|
266
|
+
- `v.npy`
|
|
267
|
+
- `corrcoef.npy`
|
|
268
|
+
- `valid.npy`
|
|
269
|
+
- `dudx.npy`, `dudy.npy`, `dvdx.npy`, `dvdy.npy` when strain is enabled
|
|
270
|
+
- `overview.png`
|
|
271
|
+
|
|
272
|
+
The `result/` directories are ignored by Git because they are generated files.
|
|
273
|
+
|
|
274
|
+
## Development Notes
|
|
275
|
+
|
|
276
|
+
- Python files under `src/subsetdic/` are used directly in editable installs.
|
|
277
|
+
- C++ changes under `src/cpp/` require rebuilding with `python -m pip install -e .`.
|
|
278
|
+
- The extension module is named `subsetdic._core`.
|
|
279
|
+
- Arrays passed to the C++ core are stored in column-major/Fortran layout to
|
|
280
|
+
match the Ncorr-style indexing.
|
|
281
|
+
- `reference_code/` contains the original Ncorr source used to check algorithm
|
|
282
|
+
behavior and edge cases.
|
|
283
|
+
|
|
284
|
+
## License
|
|
285
|
+
|
|
286
|
+
See `LICENSE`.
|