tomwer 1.2.0a2__py3-none-any.whl → 1.2.0a4__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 (34) hide show
  1. orangecontrib/tomwer/widgets/control/SingleTomoObjOW.py +0 -6
  2. orangecontrib/tomwer/widgets/reconstruction/DarkRefAndCopyOW.py +6 -2
  3. orangecontrib/tomwer/widgets/reconstruction/NabuHelicalPrepareWeightsDoubleOW.py +169 -169
  4. tomwer/app/canvas_launcher/mainwindow.py +0 -3
  5. tomwer/app/imagekeyeditor.py +1 -0
  6. tomwer/app/imagekeyupgrader.py +2 -0
  7. tomwer/app/nxtomoeditor.py +2 -0
  8. tomwer/app/zstitching.py +1 -0
  9. tomwer/core/process/reconstruction/nabu/nabucommon.py +57 -12
  10. tomwer/core/process/reconstruction/nabu/nabuscores.py +3 -2
  11. tomwer/core/process/reconstruction/nabu/nabuslices.py +7 -9
  12. tomwer/core/process/reconstruction/nabu/nabuvolume.py +10 -9
  13. tomwer/core/process/reconstruction/nabu/utils.py +10 -36
  14. tomwer/core/process/test/test_nabu.py +5 -5
  15. tomwer/gui/visualization/reconstructionparameters.py +9 -1
  16. tomwer/gui/visualization/volumeviewer.py +2 -0
  17. tomwer/resources/gui/icons/esrf_1.svg +307 -0
  18. tomwer/resources/gui/icons/triangle.svg +80 -0
  19. tomwer/version.py +1 -1
  20. {tomwer-1.2.0a2.dist-info → tomwer-1.2.0a4.dist-info}/METADATA +1 -1
  21. {tomwer-1.2.0a2.dist-info → tomwer-1.2.0a4.dist-info}/RECORD +27 -32
  22. tomwer/third_party/__init__.py +0 -0
  23. tomwer/third_party/nabu/__init__.py +0 -0
  24. tomwer/third_party/nabu/preproc/__init__.py +0 -0
  25. tomwer/third_party/nabu/preproc/phase.py +0 -387
  26. tomwer/third_party/nabu/utils.py +0 -201
  27. tomwer/third_party/tango/__init__.py +0 -0
  28. tomwer/third_party/tango/device.py +0 -15
  29. /tomwer-1.2.0a2-py3.11-nspkg.pth → /tomwer-1.2.0a4-py3.11-nspkg.pth +0 -0
  30. {tomwer-1.2.0a2.dist-info → tomwer-1.2.0a4.dist-info}/LICENSE +0 -0
  31. {tomwer-1.2.0a2.dist-info → tomwer-1.2.0a4.dist-info}/WHEEL +0 -0
  32. {tomwer-1.2.0a2.dist-info → tomwer-1.2.0a4.dist-info}/entry_points.txt +0 -0
  33. {tomwer-1.2.0a2.dist-info → tomwer-1.2.0a4.dist-info}/namespace_packages.txt +0 -0
  34. {tomwer-1.2.0a2.dist-info → tomwer-1.2.0a4.dist-info}/top_level.txt +0 -0
@@ -1,201 +0,0 @@
1
- import os
2
- import numpy as np
3
- from time import time
4
- from itertools import product
5
-
6
- _warnings = {}
7
-
8
-
9
- def nextpow2(N):
10
- p = 1
11
- while p < N:
12
- p *= 2
13
- return p
14
-
15
-
16
- def updiv(a, b):
17
- return (a + (b - 1)) // b
18
-
19
-
20
- def get_folder_path(foldername=""):
21
- _file_dir = os.path.dirname(os.path.realpath(__file__))
22
- package_dir = _file_dir
23
- return os.path.join(package_dir, foldername)
24
-
25
-
26
- def get_cuda_srcfile(filename):
27
- src_relpath = os.path.join("cuda", "src")
28
- cuda_src_folder = get_folder_path(foldername=src_relpath)
29
- return os.path.join(cuda_src_folder, filename)
30
-
31
-
32
- def _sizeof(Type):
33
- """
34
- return the size (in bytes) of a scalar type, like the C behavior
35
- """
36
- return np.dtype(Type).itemsize
37
-
38
-
39
- class FFTShift(object):
40
- def __init__(self, N):
41
- self._init_shape(N)
42
-
43
- def _init_shape(self, N):
44
- self.N = N
45
- self.N2 = N // 2
46
- self.N2b = N - self.N2 # N = N2 + N2b
47
-
48
- def fftshift_coord(self, i):
49
- if i < self.N2:
50
- return i + self.N2b
51
- else:
52
- return i - self.N2
53
-
54
- def fftshift_coords(self, coords):
55
- N2 = self.N2
56
- N2b = self.N2b
57
- res = np.zeros_like(coords)
58
- mask = coords < N2
59
- res[:N2] = coords[mask] + N2b
60
- res[N2:] = coords[np.logical_not(mask)] - N2
61
- return res
62
-
63
-
64
- def generate_powers():
65
- """
66
- Generate a list of powers of [2, 3, 5, 7],
67
- up to (2**15)*(3**9)*(5**6)*(7**5).
68
- """
69
- primes = [2, 3, 5, 7]
70
- maxpow = {2: 15, 3: 9, 5: 6, 7: 5}
71
- valuations = []
72
- for prime in primes:
73
- # disallow any odd number (for R2C transform), and any number
74
- # not multiple of 4 (Ram-Lak filter behaves strangely when
75
- # dwidth_padded/2 is not even)
76
- minval = 2 if prime == 2 else 0
77
- valuations.append(range(minval, maxpow[prime] + 1))
78
- powers = product(*valuations)
79
- res = []
80
- for pw in powers:
81
- res.append(np.prod(list(map(lambda x: x[0] ** x[1], zip(primes, pw)))))
82
- return np.unique(res)
83
-
84
-
85
- def calc_padding_lengths1D(length, length_padded):
86
- """
87
- Compute the padding lengths at both side along one dimension.
88
-
89
- Parameters
90
- ----------
91
- length: int
92
- Number of elements along one dimension of the original array
93
- length_padded: tuple
94
- Number of elements along one dimension of the padded array
95
-
96
- Returns
97
- -------
98
- pad_lengths: tuple
99
- A tuple under the form (padding_left, padding_right). These are the
100
- lengths needed to pad the original array.
101
- """
102
- pad_left = (length_padded - length) // 2
103
- pad_right = length_padded - length - pad_left
104
- return (pad_left, pad_right)
105
-
106
-
107
- def calc_padding_lengths(shape, shape_padded):
108
- """
109
- Multi-dimensional version of calc_padding_lengths1D.
110
- Please refer to the documentation of calc_padding_lengths1D.
111
- """
112
- assert len(shape) == len(shape_padded)
113
- padding_lengths = []
114
- for dim_len, dim_len_padded in zip(shape, shape_padded):
115
- pad0, pad1 = calc_padding_lengths1D(dim_len, dim_len_padded)
116
- padding_lengths.append((pad0, pad1))
117
- return tuple(padding_lengths)
118
-
119
-
120
- # ------------------------------------------------------------------------------
121
- # ------------------------ Image (move elsewhere ?) ----------------------------
122
- # ------------------------------------------------------------------------------
123
-
124
-
125
- def generate_coords(img_shp, center=None):
126
- l_r, l_c = float(img_shp[0]), float(img_shp[1])
127
- R, C = np.mgrid[:l_r, :l_c] # np.indices is faster
128
- if center is None:
129
- center0, center1 = l_r / 2.0, l_c / 2.0
130
- else:
131
- center0, center1 = center
132
- R += 0.5 - center0
133
- C += 0.5 - center1
134
- return R, C
135
-
136
-
137
- def clip_circle(img, center=None, radius=None):
138
- R, C = generate_coords(img.shape, center)
139
- M = R**2 + C**2
140
- res = np.zeros_like(img)
141
- res[M < radius**2] = img[M < radius**2]
142
- return res
143
-
144
-
145
- def apply_along_z(vol, func, res):
146
- for i in range(vol.shape[0]):
147
- res[i] = func(vol[i])
148
- return res
149
-
150
-
151
- # ------------------------------------------------------------------------------
152
- # ---------------------------- Decorators --------------------------------------
153
- # ------------------------------------------------------------------------------
154
-
155
-
156
- def measure_time(func):
157
- def wrapper(*args, **kwargs):
158
- t0 = time()
159
- res = func(*args, **kwargs)
160
- el = time() - t0
161
- return el, res
162
-
163
- return wrapper
164
-
165
-
166
- def wip(func):
167
- def wrapper(*args, **kwargs):
168
- func_name = func.__name__
169
- if func_name not in _warnings:
170
- _warnings[func_name] = 1
171
- print(
172
- "Warning: function %s is a work in progress, it is likely to change in the future"
173
- )
174
- return func(*args, **kwargs)
175
-
176
- return wrapper
177
-
178
-
179
- def warning(msg):
180
- def decorator(func):
181
- def wrapper(*args, **kwargs):
182
- func_name = func.__name__
183
- if func_name not in _warnings:
184
- _warnings[func_name] = 1
185
- print(msg)
186
- res = func(*args, **kwargs)
187
- return res
188
-
189
- return wrapper
190
-
191
- return decorator
192
-
193
-
194
- def log_work(func):
195
- def wrapper(*args, **kwargs):
196
- print("[%d] Executing %s ..." % (os.getpid(), func.__name__)) #  TODO in file ?
197
- res = func(*args, **kwargs)
198
- print("[%d] ... done" % os.getpid())
199
- return res
200
-
201
- return wrapper
File without changes
@@ -1,15 +0,0 @@
1
- class DeviceProxy:
2
- def ScanNumber(self):
3
- pass
4
-
5
- def State(self):
6
- pass
7
-
8
- def SequenceScanNumber(self):
9
- pass
10
-
11
- def SavingFile(self):
12
- pass
13
-
14
- def ScanTitle(self):
15
- pass