sem2surface 0.2.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.
@@ -0,0 +1,306 @@
1
+ Metadata-Version: 2.4
2
+ Name: sem2surface
3
+ Version: 0.2.0
4
+ Summary: 3D surface reconstruction from multi-detector SEM/BSE images
5
+ Author: Vladislav A. Yastrebov
6
+ License-Expression: BSD-3-Clause
7
+ Project-URL: Homepage, https://github.com/vyastreb/sem2surface
8
+ Project-URL: Repository, https://github.com/vyastreb/sem2surface
9
+ Project-URL: Issues, https://github.com/vyastreb/sem2surface/issues
10
+ Keywords: SEM,BSE,surface reconstruction,metrology,microscopy
11
+ Classifier: Development Status :: 4 - Beta
12
+ Classifier: Environment :: Console
13
+ Classifier: Environment :: X11 Applications
14
+ Classifier: Intended Audience :: Science/Research
15
+ Classifier: Operating System :: MacOS
16
+ Classifier: Operating System :: Microsoft :: Windows
17
+ Classifier: Operating System :: POSIX :: Linux
18
+ Classifier: Programming Language :: Python :: 3
19
+ Classifier: Programming Language :: Python :: 3.10
20
+ Classifier: Programming Language :: Python :: 3.11
21
+ Classifier: Programming Language :: Python :: 3.12
22
+ Classifier: Programming Language :: Python :: 3.13
23
+ Classifier: Topic :: Scientific/Engineering :: Image Processing
24
+ Requires-Python: >=3.10
25
+ Description-Content-Type: text/markdown
26
+ License-File: LICENSE
27
+ Requires-Dist: numpy>=1.23
28
+ Requires-Dist: matplotlib>=3.7
29
+ Requires-Dist: scipy>=1.10
30
+ Requires-Dist: scikit-image>=0.21
31
+ Requires-Dist: pillow>=9.0
32
+ Provides-Extra: vtk
33
+ Requires-Dist: vtk>=9.2; extra == "vtk"
34
+ Provides-Extra: test
35
+ Requires-Dist: build>=1.2; extra == "test"
36
+ Requires-Dist: pytest>=8; extra == "test"
37
+ Requires-Dist: twine>=5; extra == "test"
38
+ Dynamic: license-file
39
+
40
+ # sem2surface
41
+
42
+ `sem2surface` reconstructs a three-dimensional surface from three to five
43
+ multi-detector SEM/BSE images. It extracts two normalized principal images,
44
+ identifies their orientation with a Radon transform, and integrates the resulting
45
+ gradients using the Frankot-Chellappa FFT method.
46
+
47
+ <!-- PyPI cannot resolve repository-relative images. Keep this absolute URL. -->
48
+ ![3D surface reconstruction from multi-detector SEM images](https://raw.githubusercontent.com/vyastreb/sem2surface/master/img/explication.jpg)
49
+
50
+ The reconstruction can be used qualitatively with an arbitrary vertical scale.
51
+ Quantitative measurements require a calibrated Z scaling factor for the imaging
52
+ configuration. The included Vickers-indentation example demonstrates that
53
+ calibration procedure.
54
+
55
+ ## Installation
56
+
57
+ Python 3.10 or newer is required. An isolated virtual environment is strongly
58
+ recommended so the application does not conflict with system Python packages.
59
+
60
+ ### Linux and macOS
61
+
62
+ Create an environment and install a released version:
63
+
64
+ ```bash
65
+ python3 -m venv .venv
66
+ source .venv/bin/activate
67
+ python -m pip install --upgrade pip
68
+ python -m pip install sem2surface
69
+ sem2surface-gui
70
+ ```
71
+
72
+ Until a release is uploaded to PyPI, run the final installation command from
73
+ this source checkout instead:
74
+
75
+ ```bash
76
+ python -m pip install .
77
+ ```
78
+
79
+ On Linux, Tkinter may be packaged separately. For example, Ubuntu and Debian
80
+ users can install it with their system package manager as `python3-tk` before
81
+ creating the environment.
82
+
83
+ ### Windows
84
+
85
+ Install Python 3.10 or newer from
86
+ [python.org](https://www.python.org/downloads/windows/). Keep the standard
87
+ `pip`, Tcl/Tk, and Python Launcher components enabled. Then open PowerShell in
88
+ the folder where you want the environment and run:
89
+
90
+ ```powershell
91
+ py -3 -m venv .venv
92
+ .\.venv\Scripts\Activate.ps1
93
+ python -m pip install --upgrade pip
94
+ python -m pip install sem2surface
95
+ sem2surface-gui
96
+ ```
97
+
98
+ If PowerShell blocks the activation script, allow it only for the current
99
+ PowerShell process and retry activation:
100
+
101
+ ```powershell
102
+ Set-ExecutionPolicy -Scope Process -ExecutionPolicy Bypass
103
+ .\.venv\Scripts\Activate.ps1
104
+ ```
105
+
106
+ In Command Prompt, activate the same environment with:
107
+
108
+ ```bat
109
+ .venv\Scripts\activate.bat
110
+ ```
111
+
112
+ Activation is optional. The GUI can always be launched directly:
113
+
114
+ ```powershell
115
+ .\.venv\Scripts\sem2surface-gui.exe
116
+ ```
117
+
118
+ Before the PyPI release, install either from a source checkout with
119
+ `python -m pip install .` or from the provided wheel:
120
+
121
+ ```powershell
122
+ python -m pip install "C:\path\to\sem2surface-0.2.0-py3-none-any.whl"
123
+ ```
124
+
125
+ Use `deactivate` to leave the environment on any platform. Do not copy a
126
+ virtual environment between computers or move it after creation; create a new
127
+ one and reinstall the package instead.
128
+
129
+ VTK export is optional because VTK is a large dependency:
130
+
131
+ ```bash
132
+ python -m pip install "sem2surface[vtk]"
133
+ # From this source checkout instead: python -m pip install ".[vtk]"
134
+ ```
135
+
136
+ The application does not require ImageMagick or a LaTeX installation. Tkinter is
137
+ included with the standard Python installers on Windows and macOS.
138
+
139
+ ## Desktop application
140
+
141
+ After installation, launch the graphical interface from a terminal:
142
+
143
+ ```bash
144
+ sem2surface-gui
145
+ ```
146
+
147
+ Select three to five detector images, confirm the pixel size and scaling factor,
148
+ choose an output directory, and start the reconstruction. TIFF, PNG, JPEG, and
149
+ BMP images are supported. The work runs in the background so the window remains
150
+ responsive.
151
+
152
+ The GUI intentionally provides only the FFT reconstruction. Atomic-number
153
+ correction and direct profile integration have been removed.
154
+
155
+ ## Command line
156
+
157
+ Installation also provides a `sem2surface` executable:
158
+
159
+ ```bash
160
+ sem2surface detector_A.tif detector_B.tif detector_C.tif \
161
+ --z-scale 217.27243 \
162
+ --save npz \
163
+ --output-dir results
164
+ ```
165
+
166
+ Pixel size is read from the first TIFF by default. For images without compatible
167
+ SEM metadata, provide it in micrometres:
168
+
169
+ ```bash
170
+ sem2surface detector_A.png detector_B.png detector_C.png \
171
+ --pixel-size-um 0.325521 \
172
+ --curvature none
173
+ ```
174
+
175
+ Run `sem2surface --help` for the complete list of options. VTK output requires
176
+ the optional `vtk` installation described above.
177
+
178
+ ## Python API
179
+
180
+ ```python
181
+ from pathlib import Path
182
+
183
+ from sem2surface import construct_surface
184
+
185
+ images = [Path("detector_A.tif"), Path("detector_B.tif"), Path("detector_C.tif")]
186
+ preview, X, Y, Z, warning = construct_surface(
187
+ images,
188
+ z_scaling_factor_per_pixel=217.27243,
189
+ remove_curvature=True,
190
+ save_file_type="NPZ",
191
+ output_dir="results",
192
+ )
193
+ ```
194
+
195
+ Pixel size and manual curvature radii use metres in the Python API. Returned
196
+ coordinate and height arrays use micrometres. The old `constructSurface`
197
+ function remains as a compatibility wrapper for version 0.1 scripts, but only
198
+ FFT reconstruction is accepted and the old atomic-number arguments are ignored.
199
+
200
+ ## Outputs
201
+
202
+ Every reconstruction creates:
203
+
204
+ - a colour PNG of the reconstructed surface;
205
+ - a grayscale PNG suitable for further image analysis;
206
+ - a UTF-8 log containing parameters, input names, angles, and surface RMS.
207
+
208
+ Surface arrays can additionally be saved as CSV, compressed NumPy NPZ, or VTK
209
+ structured-grid data. Optional diagnostic output includes the detector/PCA
210
+ decomposition, Radon search, and oriented gradients.
211
+
212
+ When timestamps are disabled, an existing output with the same name is replaced.
213
+ Choose a dedicated output folder or enable timestamps when results must be kept.
214
+
215
+ ## Reference examples and scaling
216
+
217
+ The [examples directory](https://github.com/vyastreb/sem2surface/tree/master/examples)
218
+ contains the reference analyses:
219
+
220
+ - `Surface_1` and `Surface_2`: representative reconstructed surfaces;
221
+ - `Vickers_imprint`: reconstruction of a Vickers indentation;
222
+ - `Vickers_imprint_scaling`: identification of the Z scaling factor from the
223
+ known Vickers geometry.
224
+
225
+ After installing the package with the VTK extra, an example can be run from any
226
+ working directory:
227
+
228
+ ```bash
229
+ python examples/Surface_1/test_without_gui.py
230
+ ```
231
+
232
+ <!-- PyPI cannot resolve repository-relative images. Keep this absolute URL. -->
233
+ ![Reconstruction of the indented surface](https://raw.githubusercontent.com/vyastreb/sem2surface/master/img/indent_superposition.jpg)
234
+
235
+ ## Development
236
+
237
+ Create an isolated environment and install the editable project with its test
238
+ tools:
239
+
240
+ ```bash
241
+ python -m venv .venv
242
+ source .venv/bin/activate
243
+ python -m pip install -e ".[test]"
244
+ python -m pytest
245
+ python -m build
246
+ python -m twine check dist/*
247
+ ```
248
+
249
+ Continuous integration tests Python 3.10 and 3.13 on Linux, Windows, and macOS,
250
+ and verifies both the source distribution and universal wheel.
251
+
252
+ ### Maintainer release checklist
253
+
254
+ Use a clean virtual environment and update the version in both
255
+ `pyproject.toml` and `src/sem2surface.py`. PyPI does not allow an uploaded file
256
+ or release version to be replaced.
257
+
258
+ ```bash
259
+ python -m pytest -q
260
+ python -m build
261
+ python -m twine check dist/*
262
+ ```
263
+
264
+ For a first trial, create a separate account and API token on
265
+ [TestPyPI](https://test.pypi.org/), then upload only the files for the new
266
+ version:
267
+
268
+ ```bash
269
+ python -m twine upload --repository testpypi dist/sem2surface-0.2.0*
270
+ ```
271
+
272
+ When prompted, use `__token__` as the username and the complete TestPyPI token,
273
+ including its `pypi-` prefix, as the password. Test the uploaded wheel in a new
274
+ environment without resolving dependencies from TestPyPI:
275
+
276
+ ```bash
277
+ python -m pip install --index-url https://test.pypi.org/simple/ --no-deps sem2surface==0.2.0
278
+ sem2surface --version
279
+ ```
280
+
281
+ For the real release, create a PyPI account and API token at
282
+ [pypi.org](https://pypi.org/), then run:
283
+
284
+ ```bash
285
+ python -m twine upload dist/sem2surface-0.2.0*
286
+ ```
287
+
288
+ PyPI and TestPyPI use separate accounts and tokens. Never commit a token or put
289
+ one directly in a command. For later automated releases, prefer
290
+ [PyPI Trusted Publishing](https://docs.pypi.org/trusted-publishers/).
291
+
292
+ ## Method references
293
+
294
+ 1. Neggers, J. et al. (2021). Principal image decomposition for multi-detector
295
+ backscatter electron topography reconstruction. *Ultramicroscopy*, 227,
296
+ 113200. [DOI](https://doi.org/10.1016/j.ultramic.2020.113200)
297
+ 2. Frankot, R. T. and Chellappa, R. (1988). A method for enforcing integrability
298
+ in shape from shading algorithms. *IEEE Transactions on Pattern Analysis and
299
+ Machine Intelligence*, 10(4), 439-451.
300
+ [DOI](https://doi.org/10.1109/34.3909)
301
+
302
+ ## Author and license
303
+
304
+ Developed by Vladislav A. Yastrebov, CNRS, Mines Paris – PSL, Centre des
305
+ matériaux. Distributed under the
306
+ [BSD 3-Clause License](https://github.com/vyastreb/sem2surface/blob/master/LICENSE).
@@ -0,0 +1,9 @@
1
+ sem2surface.py,sha256=4ljdNNviCDDjWL9UXL8JThaX77RQ-UzwrMLfiQ0mSFM,27624
2
+ sem2surface_cli.py,sha256=oK8GpBk-qG7n4ZMU9bqv_OHH6Nt30CbMo3EDZXI6Ukk,3837
3
+ sem2surface_gui.py,sha256=ve5UA6-EL6EDNP0nN7YFaHyFhsRfE5DMmEwU7G9QpXc,19532
4
+ sem2surface-0.2.0.dist-info/licenses/LICENSE,sha256=xbGdCZI2sMLUxrYMyab0m47W1XlI7OVmJwabm8QMYWQ,1535
5
+ sem2surface-0.2.0.dist-info/METADATA,sha256=9zrNx_8lmmZhvaTPn1FcS9V66FvTOTATmo2QcKBKK1Y,10088
6
+ sem2surface-0.2.0.dist-info/WHEEL,sha256=YVMoNqKzERt-wjUZwJ33xBGAwnFl-4cqbYkTtWa4itE,91
7
+ sem2surface-0.2.0.dist-info/entry_points.txt,sha256=pqB91ZeRfuS7kvvNGM7_0FHtA0DGrR4Sw--okjm4Tgo,107
8
+ sem2surface-0.2.0.dist-info/top_level.txt,sha256=oVpC-uageerSOxA181csJl_6aiAZDsR2m4Al3ost0Jo,44
9
+ sem2surface-0.2.0.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: setuptools (84.0.0)
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
5
+
@@ -0,0 +1,5 @@
1
+ [console_scripts]
2
+ sem2surface = sem2surface_cli:main
3
+
4
+ [gui_scripts]
5
+ sem2surface-gui = sem2surface_gui:main
@@ -0,0 +1,30 @@
1
+ BSD 3-Clause License
2
+
3
+ Copyright (c) 2023-2026, Vladislav A. Yastrebov
4
+ All rights reserved.
5
+
6
+ Redistribution and use in source and binary forms, with or without
7
+ modification, are permitted provided that the following conditions are met:
8
+
9
+ 1. Redistributions of source code must retain the above copyright notice,
10
+ this list of conditions and the following disclaimer.
11
+
12
+ 2. Redistributions in binary form must reproduce the above copyright notice,
13
+ this list of conditions and the following disclaimer in the documentation
14
+ and/or other materials provided with the distribution.
15
+
16
+ 3. Neither the name of the copyright holder nor the names of its
17
+ contributors may be used to endorse or promote products derived from
18
+ this software without specific prior written permission.
19
+
20
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23
+ ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
24
+ LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
25
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
26
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
27
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
28
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
29
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
30
+ POSSIBILITY OF SUCH DAMAGE.
@@ -0,0 +1,3 @@
1
+ sem2surface
2
+ sem2surface_cli
3
+ sem2surface_gui