senoquant 1.0.0b1__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 (148) hide show
  1. senoquant/__init__.py +6 -0
  2. senoquant/_reader.py +7 -0
  3. senoquant/_widget.py +33 -0
  4. senoquant/napari.yaml +83 -0
  5. senoquant/reader/__init__.py +5 -0
  6. senoquant/reader/core.py +369 -0
  7. senoquant/tabs/__init__.py +15 -0
  8. senoquant/tabs/batch/__init__.py +10 -0
  9. senoquant/tabs/batch/backend.py +641 -0
  10. senoquant/tabs/batch/config.py +270 -0
  11. senoquant/tabs/batch/frontend.py +1283 -0
  12. senoquant/tabs/batch/io.py +326 -0
  13. senoquant/tabs/batch/layers.py +86 -0
  14. senoquant/tabs/quantification/__init__.py +1 -0
  15. senoquant/tabs/quantification/backend.py +228 -0
  16. senoquant/tabs/quantification/features/__init__.py +80 -0
  17. senoquant/tabs/quantification/features/base.py +142 -0
  18. senoquant/tabs/quantification/features/marker/__init__.py +5 -0
  19. senoquant/tabs/quantification/features/marker/config.py +69 -0
  20. senoquant/tabs/quantification/features/marker/dialog.py +437 -0
  21. senoquant/tabs/quantification/features/marker/export.py +879 -0
  22. senoquant/tabs/quantification/features/marker/feature.py +119 -0
  23. senoquant/tabs/quantification/features/marker/morphology.py +285 -0
  24. senoquant/tabs/quantification/features/marker/rows.py +654 -0
  25. senoquant/tabs/quantification/features/marker/thresholding.py +46 -0
  26. senoquant/tabs/quantification/features/roi.py +346 -0
  27. senoquant/tabs/quantification/features/spots/__init__.py +5 -0
  28. senoquant/tabs/quantification/features/spots/config.py +62 -0
  29. senoquant/tabs/quantification/features/spots/dialog.py +477 -0
  30. senoquant/tabs/quantification/features/spots/export.py +1292 -0
  31. senoquant/tabs/quantification/features/spots/feature.py +112 -0
  32. senoquant/tabs/quantification/features/spots/morphology.py +279 -0
  33. senoquant/tabs/quantification/features/spots/rows.py +241 -0
  34. senoquant/tabs/quantification/frontend.py +815 -0
  35. senoquant/tabs/segmentation/__init__.py +1 -0
  36. senoquant/tabs/segmentation/backend.py +131 -0
  37. senoquant/tabs/segmentation/frontend.py +1009 -0
  38. senoquant/tabs/segmentation/models/__init__.py +5 -0
  39. senoquant/tabs/segmentation/models/base.py +146 -0
  40. senoquant/tabs/segmentation/models/cpsam/details.json +65 -0
  41. senoquant/tabs/segmentation/models/cpsam/model.py +150 -0
  42. senoquant/tabs/segmentation/models/default_2d/details.json +69 -0
  43. senoquant/tabs/segmentation/models/default_2d/model.py +664 -0
  44. senoquant/tabs/segmentation/models/default_3d/details.json +69 -0
  45. senoquant/tabs/segmentation/models/default_3d/model.py +682 -0
  46. senoquant/tabs/segmentation/models/hf.py +71 -0
  47. senoquant/tabs/segmentation/models/nuclear_dilation/__init__.py +1 -0
  48. senoquant/tabs/segmentation/models/nuclear_dilation/details.json +26 -0
  49. senoquant/tabs/segmentation/models/nuclear_dilation/model.py +96 -0
  50. senoquant/tabs/segmentation/models/perinuclear_rings/__init__.py +1 -0
  51. senoquant/tabs/segmentation/models/perinuclear_rings/details.json +34 -0
  52. senoquant/tabs/segmentation/models/perinuclear_rings/model.py +132 -0
  53. senoquant/tabs/segmentation/stardist_onnx_utils/__init__.py +2 -0
  54. senoquant/tabs/segmentation/stardist_onnx_utils/_csbdeep/csbdeep/__init__.py +3 -0
  55. senoquant/tabs/segmentation/stardist_onnx_utils/_csbdeep/csbdeep/data/__init__.py +6 -0
  56. senoquant/tabs/segmentation/stardist_onnx_utils/_csbdeep/csbdeep/data/generate.py +470 -0
  57. senoquant/tabs/segmentation/stardist_onnx_utils/_csbdeep/csbdeep/data/prepare.py +273 -0
  58. senoquant/tabs/segmentation/stardist_onnx_utils/_csbdeep/csbdeep/data/rawdata.py +112 -0
  59. senoquant/tabs/segmentation/stardist_onnx_utils/_csbdeep/csbdeep/data/transform.py +384 -0
  60. senoquant/tabs/segmentation/stardist_onnx_utils/_csbdeep/csbdeep/internals/__init__.py +0 -0
  61. senoquant/tabs/segmentation/stardist_onnx_utils/_csbdeep/csbdeep/internals/blocks.py +184 -0
  62. senoquant/tabs/segmentation/stardist_onnx_utils/_csbdeep/csbdeep/internals/losses.py +79 -0
  63. senoquant/tabs/segmentation/stardist_onnx_utils/_csbdeep/csbdeep/internals/nets.py +165 -0
  64. senoquant/tabs/segmentation/stardist_onnx_utils/_csbdeep/csbdeep/internals/predict.py +467 -0
  65. senoquant/tabs/segmentation/stardist_onnx_utils/_csbdeep/csbdeep/internals/probability.py +67 -0
  66. senoquant/tabs/segmentation/stardist_onnx_utils/_csbdeep/csbdeep/internals/train.py +148 -0
  67. senoquant/tabs/segmentation/stardist_onnx_utils/_csbdeep/csbdeep/io/__init__.py +163 -0
  68. senoquant/tabs/segmentation/stardist_onnx_utils/_csbdeep/csbdeep/models/__init__.py +52 -0
  69. senoquant/tabs/segmentation/stardist_onnx_utils/_csbdeep/csbdeep/models/base_model.py +329 -0
  70. senoquant/tabs/segmentation/stardist_onnx_utils/_csbdeep/csbdeep/models/care_isotropic.py +160 -0
  71. senoquant/tabs/segmentation/stardist_onnx_utils/_csbdeep/csbdeep/models/care_projection.py +178 -0
  72. senoquant/tabs/segmentation/stardist_onnx_utils/_csbdeep/csbdeep/models/care_standard.py +446 -0
  73. senoquant/tabs/segmentation/stardist_onnx_utils/_csbdeep/csbdeep/models/care_upsampling.py +54 -0
  74. senoquant/tabs/segmentation/stardist_onnx_utils/_csbdeep/csbdeep/models/config.py +254 -0
  75. senoquant/tabs/segmentation/stardist_onnx_utils/_csbdeep/csbdeep/models/pretrained.py +119 -0
  76. senoquant/tabs/segmentation/stardist_onnx_utils/_csbdeep/csbdeep/scripts/__init__.py +0 -0
  77. senoquant/tabs/segmentation/stardist_onnx_utils/_csbdeep/csbdeep/scripts/care_predict.py +180 -0
  78. senoquant/tabs/segmentation/stardist_onnx_utils/_csbdeep/csbdeep/utils/__init__.py +5 -0
  79. senoquant/tabs/segmentation/stardist_onnx_utils/_csbdeep/csbdeep/utils/plot_utils.py +159 -0
  80. senoquant/tabs/segmentation/stardist_onnx_utils/_csbdeep/csbdeep/utils/six.py +18 -0
  81. senoquant/tabs/segmentation/stardist_onnx_utils/_csbdeep/csbdeep/utils/tf.py +644 -0
  82. senoquant/tabs/segmentation/stardist_onnx_utils/_csbdeep/csbdeep/utils/utils.py +272 -0
  83. senoquant/tabs/segmentation/stardist_onnx_utils/_csbdeep/csbdeep/version.py +1 -0
  84. senoquant/tabs/segmentation/stardist_onnx_utils/_csbdeep/docs/source/conf.py +368 -0
  85. senoquant/tabs/segmentation/stardist_onnx_utils/_csbdeep/setup.py +68 -0
  86. senoquant/tabs/segmentation/stardist_onnx_utils/_csbdeep/tests/test_datagen.py +169 -0
  87. senoquant/tabs/segmentation/stardist_onnx_utils/_csbdeep/tests/test_models.py +462 -0
  88. senoquant/tabs/segmentation/stardist_onnx_utils/_csbdeep/tests/test_utils.py +166 -0
  89. senoquant/tabs/segmentation/stardist_onnx_utils/_csbdeep/tools/create_zip_contents.py +34 -0
  90. senoquant/tabs/segmentation/stardist_onnx_utils/_stardist/__init__.py +30 -0
  91. senoquant/tabs/segmentation/stardist_onnx_utils/_stardist/big.py +624 -0
  92. senoquant/tabs/segmentation/stardist_onnx_utils/_stardist/bioimageio_utils.py +494 -0
  93. senoquant/tabs/segmentation/stardist_onnx_utils/_stardist/data/__init__.py +39 -0
  94. senoquant/tabs/segmentation/stardist_onnx_utils/_stardist/geometry/__init__.py +10 -0
  95. senoquant/tabs/segmentation/stardist_onnx_utils/_stardist/geometry/geom2d.py +215 -0
  96. senoquant/tabs/segmentation/stardist_onnx_utils/_stardist/geometry/geom3d.py +349 -0
  97. senoquant/tabs/segmentation/stardist_onnx_utils/_stardist/matching.py +483 -0
  98. senoquant/tabs/segmentation/stardist_onnx_utils/_stardist/models/__init__.py +28 -0
  99. senoquant/tabs/segmentation/stardist_onnx_utils/_stardist/models/base.py +1217 -0
  100. senoquant/tabs/segmentation/stardist_onnx_utils/_stardist/models/model2d.py +594 -0
  101. senoquant/tabs/segmentation/stardist_onnx_utils/_stardist/models/model3d.py +696 -0
  102. senoquant/tabs/segmentation/stardist_onnx_utils/_stardist/nms.py +384 -0
  103. senoquant/tabs/segmentation/stardist_onnx_utils/_stardist/plot/__init__.py +2 -0
  104. senoquant/tabs/segmentation/stardist_onnx_utils/_stardist/plot/plot.py +74 -0
  105. senoquant/tabs/segmentation/stardist_onnx_utils/_stardist/plot/render.py +298 -0
  106. senoquant/tabs/segmentation/stardist_onnx_utils/_stardist/rays3d.py +373 -0
  107. senoquant/tabs/segmentation/stardist_onnx_utils/_stardist/sample_patches.py +65 -0
  108. senoquant/tabs/segmentation/stardist_onnx_utils/_stardist/scripts/__init__.py +0 -0
  109. senoquant/tabs/segmentation/stardist_onnx_utils/_stardist/scripts/predict2d.py +90 -0
  110. senoquant/tabs/segmentation/stardist_onnx_utils/_stardist/scripts/predict3d.py +93 -0
  111. senoquant/tabs/segmentation/stardist_onnx_utils/_stardist/utils.py +408 -0
  112. senoquant/tabs/segmentation/stardist_onnx_utils/_stardist/version.py +1 -0
  113. senoquant/tabs/segmentation/stardist_onnx_utils/onnx_framework/__init__.py +45 -0
  114. senoquant/tabs/segmentation/stardist_onnx_utils/onnx_framework/convert/__init__.py +17 -0
  115. senoquant/tabs/segmentation/stardist_onnx_utils/onnx_framework/convert/cli.py +55 -0
  116. senoquant/tabs/segmentation/stardist_onnx_utils/onnx_framework/convert/core.py +285 -0
  117. senoquant/tabs/segmentation/stardist_onnx_utils/onnx_framework/inspect/__init__.py +15 -0
  118. senoquant/tabs/segmentation/stardist_onnx_utils/onnx_framework/inspect/cli.py +36 -0
  119. senoquant/tabs/segmentation/stardist_onnx_utils/onnx_framework/inspect/divisibility.py +193 -0
  120. senoquant/tabs/segmentation/stardist_onnx_utils/onnx_framework/inspect/probe.py +100 -0
  121. senoquant/tabs/segmentation/stardist_onnx_utils/onnx_framework/inspect/receptive_field.py +182 -0
  122. senoquant/tabs/segmentation/stardist_onnx_utils/onnx_framework/inspect/rf_cli.py +48 -0
  123. senoquant/tabs/segmentation/stardist_onnx_utils/onnx_framework/inspect/valid_sizes.py +278 -0
  124. senoquant/tabs/segmentation/stardist_onnx_utils/onnx_framework/post/__init__.py +8 -0
  125. senoquant/tabs/segmentation/stardist_onnx_utils/onnx_framework/post/core.py +157 -0
  126. senoquant/tabs/segmentation/stardist_onnx_utils/onnx_framework/pre/__init__.py +17 -0
  127. senoquant/tabs/segmentation/stardist_onnx_utils/onnx_framework/pre/core.py +226 -0
  128. senoquant/tabs/segmentation/stardist_onnx_utils/onnx_framework/predict/__init__.py +5 -0
  129. senoquant/tabs/segmentation/stardist_onnx_utils/onnx_framework/predict/core.py +401 -0
  130. senoquant/tabs/settings/__init__.py +1 -0
  131. senoquant/tabs/settings/backend.py +29 -0
  132. senoquant/tabs/settings/frontend.py +19 -0
  133. senoquant/tabs/spots/__init__.py +1 -0
  134. senoquant/tabs/spots/backend.py +139 -0
  135. senoquant/tabs/spots/frontend.py +800 -0
  136. senoquant/tabs/spots/models/__init__.py +5 -0
  137. senoquant/tabs/spots/models/base.py +94 -0
  138. senoquant/tabs/spots/models/rmp/details.json +61 -0
  139. senoquant/tabs/spots/models/rmp/model.py +499 -0
  140. senoquant/tabs/spots/models/udwt/details.json +103 -0
  141. senoquant/tabs/spots/models/udwt/model.py +482 -0
  142. senoquant/utils.py +25 -0
  143. senoquant-1.0.0b1.dist-info/METADATA +193 -0
  144. senoquant-1.0.0b1.dist-info/RECORD +148 -0
  145. senoquant-1.0.0b1.dist-info/WHEEL +5 -0
  146. senoquant-1.0.0b1.dist-info/entry_points.txt +2 -0
  147. senoquant-1.0.0b1.dist-info/licenses/LICENSE +28 -0
  148. senoquant-1.0.0b1.dist-info/top_level.txt +1 -0
@@ -0,0 +1,272 @@
1
+ from __future__ import print_function, unicode_literals, absolute_import, division
2
+
3
+ import os
4
+ import numpy as np
5
+ import json
6
+ import collections
7
+ import platform
8
+ import random
9
+ from six.moves import range, zip, map, reduce, filter
10
+ from .six import Path
11
+
12
+ ###
13
+
14
+
15
+ def is_tf_backend():
16
+ from .tf import BACKEND as K
17
+ return K.backend() == 'tensorflow'
18
+
19
+
20
+ def backend_channels_last():
21
+ from .tf import BACKEND as K
22
+ assert K.image_data_format() in ('channels_first','channels_last')
23
+ return K.image_data_format() == 'channels_last'
24
+
25
+
26
+ def move_channel_for_backend(X,channel):
27
+ if backend_channels_last():
28
+ return np.moveaxis(X, channel, -1)
29
+ else:
30
+ return np.moveaxis(X, channel, 1)
31
+
32
+
33
+ ###
34
+
35
+
36
+ def load_json(fpath):
37
+ with open(fpath,'r') as f:
38
+ return json.load(f)
39
+
40
+
41
+ def save_json(data,fpath,**kwargs):
42
+ with open(fpath,'w') as f:
43
+ f.write(json.dumps(data,**kwargs))
44
+
45
+
46
+ ###
47
+
48
+
49
+ def normalize(x, pmin=3, pmax=99.8, axis=None, clip=False, eps=1e-20, dtype=np.float32):
50
+ """Percentile-based image normalization."""
51
+
52
+ mi = np.percentile(x,pmin,axis=axis,keepdims=True)
53
+ ma = np.percentile(x,pmax,axis=axis,keepdims=True)
54
+ return normalize_mi_ma(x, mi, ma, clip=clip, eps=eps, dtype=dtype)
55
+
56
+
57
+ def normalize_mi_ma(x, mi, ma, clip=False, eps=1e-20, dtype=np.float32):
58
+ if dtype is not None:
59
+ x = x.astype(dtype,copy=False)
60
+ mi = dtype(mi) if np.isscalar(mi) else mi.astype(dtype,copy=False)
61
+ ma = dtype(ma) if np.isscalar(ma) else ma.astype(dtype,copy=False)
62
+ eps = dtype(eps)
63
+
64
+ try:
65
+ import numexpr
66
+ x = numexpr.evaluate("(x - mi) / ( ma - mi + eps )")
67
+ except ImportError:
68
+ x = (x - mi) / ( ma - mi + eps )
69
+
70
+ if clip:
71
+ x = np.clip(x,0,1)
72
+
73
+ return x
74
+
75
+
76
+ def normalize_minmse(x, target):
77
+ """Affine rescaling of x, such that the mean squared error to target is minimal."""
78
+ cov = np.cov(x.flatten(),target.flatten())
79
+ alpha = cov[0,1] / (cov[0,0]+1e-10)
80
+ beta = target.mean() - alpha*x.mean()
81
+ return alpha*x + beta
82
+
83
+
84
+ ###
85
+
86
+
87
+ def _raise(e):
88
+ if isinstance(e, BaseException):
89
+ raise e
90
+ else:
91
+ raise ValueError(e)
92
+
93
+
94
+ # https://docs.python.org/3/library/itertools.html#itertools-recipes
95
+ def consume(iterator):
96
+ collections.deque(iterator, maxlen=0)
97
+
98
+
99
+ def compose(*funcs):
100
+ return lambda x: reduce(lambda f,g: g(f), funcs, x)
101
+
102
+
103
+ ###
104
+
105
+
106
+ def download_and_extract_zip_file(url, targetdir='.', verbose=True):
107
+ import csv
108
+ from six.moves.urllib.request import urlretrieve
109
+ from six.moves.urllib.parse import urlparse
110
+ from zipfile import ZipFile
111
+
112
+ res = urlparse(url)
113
+ if res.scheme in ('','file'):
114
+ url = Path(res.path).resolve().as_uri()
115
+ # local file, 'urlretrieve' will not make a copy
116
+ # -> don't delete 'downloaded' file
117
+ delete = False
118
+ else:
119
+ delete = True
120
+
121
+ # verbosity levels:
122
+ # - 0: no messages
123
+ # - 1: status messages
124
+ # - 2: status messages and list of all files
125
+ if isinstance(verbose,bool):
126
+ verbose *= 2
127
+
128
+ log = (print) if verbose else (lambda *a,**k: None)
129
+
130
+ targetdir = Path(targetdir)
131
+ if not targetdir.is_dir():
132
+ targetdir.mkdir(parents=True,exist_ok=True)
133
+
134
+ provided = []
135
+
136
+ def content_is_missing():
137
+ try:
138
+ filepath, http_msg = urlretrieve(url+'.contents')
139
+ with open(filepath,'r') as contents_file:
140
+ contents = list(csv.reader(contents_file,delimiter='\t'))
141
+ except:
142
+ return True
143
+ finally:
144
+ if delete:
145
+ try: os.unlink(filepath)
146
+ except: pass
147
+
148
+ for size, relpath in contents:
149
+ size, relpath = int(size.strip()), relpath.strip()
150
+ entry = targetdir / relpath
151
+ if not entry.exists():
152
+ return True
153
+ if entry.is_dir():
154
+ if not relpath.endswith('/'): return True
155
+ elif entry.is_file():
156
+ if relpath.endswith('/') or entry.stat().st_size != size: return True
157
+ else:
158
+ return True
159
+ provided.append(relpath)
160
+
161
+ return False
162
+
163
+
164
+ if content_is_missing():
165
+ try:
166
+ log('Files missing, downloading...',end='')
167
+ filepath, http_msg = urlretrieve(url)
168
+ with ZipFile(filepath,'r') as zip_file:
169
+ log(' extracting...',end='')
170
+ zip_file.extractall(str(targetdir))
171
+ provided = zip_file.namelist()
172
+ log(' done.')
173
+ finally:
174
+ if delete:
175
+ try: os.unlink(filepath)
176
+ except: pass
177
+ else:
178
+ log('Files found, nothing to download.')
179
+
180
+ if verbose > 1:
181
+ log('\n'+str(targetdir)+':')
182
+ consume(map(lambda x: log('-',Path(x)), provided))
183
+
184
+
185
+ ###
186
+
187
+
188
+ def axes_check_and_normalize(axes,length=None,disallowed=None,return_allowed=False):
189
+ """
190
+ S(ample), T(ime), C(hannel), Z, Y, X
191
+ """
192
+ allowed = 'STCZYX'
193
+ axes is not None or _raise(ValueError('axis cannot be None.'))
194
+ axes = str(axes).upper()
195
+ consume(a in allowed or _raise(ValueError("invalid axis '%s', must be one of %s."%(a,list(allowed)))) for a in axes)
196
+ disallowed is None or consume(a not in disallowed or _raise(ValueError("disallowed axis '%s'."%a)) for a in axes)
197
+ consume(axes.count(a)==1 or _raise(ValueError("axis '%s' occurs more than once."%a)) for a in axes)
198
+ length is None or len(axes)==length or _raise(ValueError('axes (%s) must be of length %d.' % (axes,length)))
199
+ return (axes,allowed) if return_allowed else axes
200
+
201
+
202
+ def axes_dict(axes):
203
+ """
204
+ from axes string to dict
205
+ """
206
+ axes, allowed = axes_check_and_normalize(axes,return_allowed=True)
207
+ return { a: None if axes.find(a) == -1 else axes.find(a) for a in allowed }
208
+ # return collections.namedtuple('Axes',list(allowed))(*[None if axes.find(a) == -1 else axes.find(a) for a in allowed ])
209
+
210
+
211
+ def move_image_axes(x, fr, to, adjust_singletons=False):
212
+ """
213
+ x: ndarray
214
+ fr,to: axes string (see `axes_dict`)
215
+ """
216
+ fr = axes_check_and_normalize(fr, length=x.ndim)
217
+ to = axes_check_and_normalize(to)
218
+
219
+ fr_initial = fr
220
+ x_shape_initial = x.shape
221
+ adjust_singletons = bool(adjust_singletons)
222
+ if adjust_singletons:
223
+ # remove axes not present in 'to'
224
+ slices = [slice(None) for _ in x.shape]
225
+ for i,a in enumerate(fr):
226
+ if (a not in to) and (x.shape[i]==1):
227
+ # remove singleton axis
228
+ slices[i] = 0
229
+ fr = fr.replace(a,'')
230
+ x = x[tuple(slices)]
231
+ # add dummy axes present in 'to'
232
+ for i,a in enumerate(to):
233
+ if (a not in fr):
234
+ # add singleton axis
235
+ x = np.expand_dims(x,-1)
236
+ fr += a
237
+
238
+ if set(fr) != set(to):
239
+ _adjusted = '(adjusted to %s and %s) ' % (x.shape, fr) if adjust_singletons else ''
240
+ raise ValueError(
241
+ 'image with shape %s and axes %s %snot compatible with target axes %s.'
242
+ % (x_shape_initial, fr_initial, _adjusted, to)
243
+ )
244
+
245
+ ax_from, ax_to = axes_dict(fr), axes_dict(to)
246
+ if fr == to:
247
+ return x
248
+ return np.moveaxis(x, [ax_from[a] for a in fr], [ax_to[a] for a in fr])
249
+
250
+
251
+ ###
252
+
253
+
254
+ def choice(population, k=1, replace=True):
255
+ ver = platform.sys.version_info
256
+ if replace and (ver.major,ver.minor) in [(2,7),(3,5)]: # python 2.7 or 3.5
257
+ # slow if population is large and not a np.ndarray
258
+ return list(np.random.choice(population, k, replace=replace))
259
+ else:
260
+ try:
261
+ # save state of 'random' and set seed using 'np.random'
262
+ state = random.getstate()
263
+ random.seed(int(np.random.randint(0, np.iinfo(np.uint32).max, dtype=np.uint32)))
264
+ if replace:
265
+ # sample with replacement
266
+ return random.choices(population, k=k)
267
+ else:
268
+ # sample without replacement
269
+ return random.sample(population, k=k)
270
+ finally:
271
+ # restore state of 'random'
272
+ random.setstate(state)
@@ -0,0 +1 @@
1
+ __version__ = '0.8.2'
@@ -0,0 +1,368 @@
1
+ # -*- coding: utf-8 -*-
2
+ #
3
+ # This file is execfile()d with the current directory set to its
4
+ # containing dir.
5
+ #
6
+ # Note that not all possible configuration values are present in this
7
+ # autogenerated file.
8
+ #
9
+ # All configuration values have a default; values that are commented out
10
+ # serve to show the default.
11
+
12
+ import sys
13
+ import os
14
+ from datetime import datetime
15
+
16
+ # If extensions (or modules to document with autodoc) are in another directory,
17
+ # add these directories to sys.path here. If the directory is relative to the
18
+ # documentation root, use os.path.abspath to make it absolute, like shown here.
19
+ #sys.path.insert(0, os.path.abspath('.'))
20
+
21
+ # -- General configuration ------------------------------------------------
22
+
23
+ # If your documentation needs a minimal Sphinx version, state it here.
24
+ #needs_sphinx = '1.0'
25
+
26
+ # Add any Sphinx extension module names here, as strings. They can be
27
+ # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
28
+ # ones.
29
+ extensions = [
30
+ 'sphinx.ext.autodoc',
31
+ 'sphinx.ext.napoleon',
32
+ 'sphinx.ext.imgmath',
33
+ 'sphinx.ext.intersphinx',
34
+ 'sphinx.ext.todo',
35
+ # 'sphinx.ext.doctest',
36
+ 'sphinx.ext.viewcode',
37
+ # 'sphinx.ext.linkcode',
38
+ ]
39
+
40
+ def linkcode_resolve(domain, info):
41
+ if domain != 'py':
42
+ return None
43
+ if not info['module']:
44
+ return None
45
+ filename = info['module'].replace('.', '/')
46
+ return "https://github.com/csbdeep/csbdeep/tree/main/%s.py" % filename
47
+
48
+ # Add any paths that contain templates here, relative to this directory.
49
+ templates_path = ['_templates']
50
+
51
+ # The suffix(es) of source filenames.
52
+ # You can specify multiple suffix as a list of string:
53
+ # source_suffix = ['.rst', '.md']
54
+ source_suffix = '.rst'
55
+
56
+ # The encoding of source files.
57
+ #source_encoding = 'utf-8-sig'
58
+
59
+ # The master toctree document.
60
+ master_doc = 'index'
61
+
62
+ # General information about the project.
63
+ project = u'CSBDeep'
64
+ copyright = u'2018–{}, CSBD'.format(datetime.now().year)
65
+ author = u'Uwe Schmidt, Martin Weigert'
66
+
67
+ # The version info for the project you're documenting, acts as replacement for
68
+ # |version| and |release|, also used in various other places throughout the
69
+ # built documents.
70
+ #
71
+ # The short X.Y version.
72
+ # version = u'0.1.0'
73
+ # The full version, including alpha/beta/rc tags.
74
+ # release = u'0.1.0'
75
+ from csbdeep import __version__ as version
76
+ release = version
77
+
78
+ # The language for content autogenerated by Sphinx. Refer to documentation
79
+ # for a list of supported languages.
80
+ #
81
+ # This is also used if you do content translation via gettext catalogs.
82
+ # Usually you set "language" from the command line for these cases.
83
+ language = None
84
+
85
+ # There are two options for replacing |today|: either, you set today to some
86
+ # non-false value, then it is used:
87
+ #today = ''
88
+ # Else, today_fmt is used as the format for a strftime call.
89
+ #today_fmt = '%B %d, %Y'
90
+
91
+ # List of patterns, relative to source directory, that match files and
92
+ # directories to ignore when looking for source files.
93
+ exclude_patterns = []
94
+
95
+ # The reST default role (used for this markup: `text`) to use for all
96
+ # documents.
97
+ #default_role = None
98
+
99
+ # If true, '()' will be appended to :func: etc. cross-reference text.
100
+ #add_function_parentheses = True
101
+
102
+ # If true, the current module name will be prepended to all description
103
+ # unit titles (such as .. function::).
104
+ #add_module_names = True
105
+
106
+ # If true, sectionauthor and moduleauthor directives will be shown in the
107
+ # output. They are ignored by default.
108
+ #show_authors = False
109
+
110
+ # The name of the Pygments (syntax highlighting) style to use.
111
+ pygments_style = 'sphinx'
112
+
113
+ # A list of ignored prefixes for module index sorting.
114
+ #modindex_common_prefix = []
115
+
116
+ # If true, keep warnings as "system message" paragraphs in the built documents.
117
+ #keep_warnings = False
118
+
119
+ # If true, `todo` and `todoList` produce output, else they produce nothing.
120
+ # todo_include_todos = True
121
+
122
+ intersphinx_mapping = {'python': ('https://docs.python.org/3', None),
123
+ 'numpy': ('https://docs.scipy.org/doc/numpy/', None),
124
+ 'scipy': ('https://docs.scipy.org/doc/scipy/reference/', None),
125
+ 'matplotlib': ('https://matplotlib.org/', None),
126
+ # 'keras': ('https://keras.io/', None), # doesn't work for keras
127
+ }
128
+
129
+ # -- Options for HTML output ----------------------------------------------
130
+
131
+ # The theme to use for HTML and HTML Help pages. See the documentation for
132
+ # a list of builtin themes.
133
+ # html_theme = 'alabaster'
134
+ html_theme = 'sphinx_rtd_theme'
135
+
136
+ # Theme options are theme-specific and customize the look and feel of a theme
137
+ # further. For a list of options available for each theme, see the
138
+ # documentation.
139
+
140
+ # Add any paths that contain custom themes here, relative to this directory.
141
+ #html_theme_path = []
142
+
143
+ # The name for this set of Sphinx documents. If None, it defaults to
144
+ # "<project> v<release> documentation".
145
+ #html_title = None
146
+
147
+ # A shorter title for the navigation bar. Default is the same as html_title.
148
+ #html_short_title = None
149
+
150
+ # The name of an image file (relative to this directory) to place at the top
151
+ # of the sidebar.
152
+ #html_logo = None
153
+
154
+ # The name of an image file (relative to this directory) to use as a favicon of
155
+ # the docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32
156
+ # pixels large.
157
+ #html_favicon = None
158
+
159
+ # Add any paths that contain custom static files (such as style sheets) here,
160
+ # relative to this directory. They are copied after the builtin static files,
161
+ # so a file named "default.css" will overwrite the builtin "default.css".
162
+ # html_static_path = ['_static']
163
+
164
+ # Add any extra paths that contain custom files (such as robots.txt or
165
+ # .htaccess) here, relative to this directory. These files are copied
166
+ # directly to the root of the documentation.
167
+ #html_extra_path = []
168
+
169
+ # If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
170
+ # using the given strftime format.
171
+ html_last_updated_fmt = '%b %d, %Y'
172
+
173
+ # If true, SmartyPants will be used to convert quotes and dashes to
174
+ # typographically correct entities.
175
+ html_use_smartypants = True
176
+
177
+ # Custom sidebar templates, maps document names to template names.
178
+ #html_sidebars = {}
179
+ html_sidebars = {
180
+ '**': [
181
+ 'about.html',
182
+ #'linkbar.html',
183
+ 'navigation.html',
184
+ #'relations.html',
185
+ 'searchbox.html',
186
+ ]
187
+ }
188
+
189
+
190
+
191
+ # Additional templates that should be rendered to pages, maps page names to
192
+ # template names.
193
+ #html_additional_pages = {}
194
+
195
+ # If false, no module index is generated.
196
+ #html_domain_indices = True
197
+
198
+ # If false, no index is generated.
199
+ #html_use_index = True
200
+
201
+ # If true, the index is split into individual pages for each letter.
202
+ #html_split_index = False
203
+
204
+ # If true, links to the reST sources are added to the pages.
205
+ html_show_sourcelink = False
206
+
207
+ # If true, "Created using Sphinx" is shown in the HTML footer. Default is True.
208
+ #html_show_sphinx = True
209
+
210
+ # If true, "(C) Copyright ..." is shown in the HTML footer. Default is True.
211
+ #html_show_copyright = True
212
+
213
+ # If true, an OpenSearch description file will be output, and all pages will
214
+ # contain a <link> tag referring to it. The value of this option must be the
215
+ # base URL from which the finished HTML is served.
216
+ #html_use_opensearch = ''
217
+
218
+ # This is the file name suffix for HTML files (e.g. ".xhtml").
219
+ # html_file_suffix = None
220
+
221
+ # Language to be used for generating the HTML full-text search index.
222
+ # Sphinx supports the following languages:
223
+ # 'da', 'de', 'en', 'es', 'fi', 'fr', 'hu', 'it', 'ja'
224
+ # 'nl', 'no', 'pt', 'ro', 'ru', 'sv', 'tr'
225
+ #html_search_language = 'en'
226
+
227
+ # A dictionary with options for the search language support, empty by default.
228
+ # Now only 'ja' uses this config value
229
+ #html_search_options = {'type': 'default'}
230
+
231
+ # The name of a javascript file (relative to the configuration directory) that
232
+ # implements a search results scorer. If empty, the default will be used.
233
+ #html_search_scorer = 'scorer.js'
234
+
235
+ # Output file base name for HTML help builder.
236
+ htmlhelp_basename = 'csbdeepdoc'
237
+
238
+ # -- Options for LaTeX output ---------------------------------------------
239
+
240
+ latex_elements = {
241
+ # The paper size ('letterpaper' or 'a4paper').
242
+ 'papersize': 'a4paper',
243
+
244
+ # The font size ('10pt', '11pt' or '12pt').
245
+ 'pointsize': '10pt',
246
+
247
+ # Additional stuff for the LaTeX preamble.
248
+ #'preamble': '',
249
+
250
+ # Latex figure (float) alignment
251
+ #'figure_align': 'htbp',
252
+ }
253
+
254
+
255
+ # For "manual" documents, if this is true, then toplevel headings are parts,
256
+ # not chapters.
257
+ #latex_use_parts = False
258
+
259
+
260
+ latex_toplevel_sectioning = "section"
261
+
262
+ # If true, show page references after internal links.
263
+ #latex_show_pagerefs = False
264
+
265
+ # If true, show URL addresses after external links.
266
+ #latex_show_urls = False
267
+
268
+ # Documents to append as an appendix to all manuals.
269
+ #latex_appendices = []
270
+
271
+ # If false, no module index is generated.
272
+ #latex_domain_indices = True
273
+
274
+
275
+ # -- Options for manual page output ---------------------------------------
276
+
277
+
278
+ # If true, show URL addresses after external links.
279
+ #man_show_urls = False
280
+
281
+
282
+ # -- Options for Texinfo output -------------------------------------------
283
+
284
+ # Grouping the document tree into Texinfo files. List of tuples
285
+ # (source start file, target name, title, author,
286
+ # dir menu entry, description, category)
287
+
288
+ # Documents to append as an appendix to all manuals.
289
+ #texinfo_appendices = []
290
+
291
+ # If false, no module index is generated.
292
+ #texinfo_domain_indices = True
293
+
294
+ # How to display URL addresses: 'footnote', 'no', or 'inline'.
295
+ #texinfo_show_urls = 'footnote'
296
+
297
+ # If true, do not generate a @detailmenu in the "Top" node's menu.
298
+ #texinfo_no_detailmenu = False
299
+
300
+
301
+ # -- Options for Epub output ----------------------------------------------
302
+
303
+ # Bibliographic Dublin Core info.
304
+ epub_title = project
305
+ epub_author = author
306
+ epub_publisher = author
307
+ epub_copyright = copyright
308
+
309
+ # The basename for the epub file. It defaults to the project name.
310
+ #epub_basename = project
311
+
312
+ # The HTML theme for the epub output. Since the default themes are not
313
+ # optimized for small screen space, using the same theme for HTML and epub
314
+ # output is usually not wise. This defaults to 'epub', a theme designed to save
315
+ # visual space.
316
+ #epub_theme = 'epub'
317
+
318
+ # The language of the text. It defaults to the language option
319
+ # or 'en' if the language is not set.
320
+ #epub_language = ''
321
+
322
+ # The scheme of the identifier. Typical schemes are ISBN or URL.
323
+ #epub_scheme = ''
324
+
325
+ # The unique identifier of the text. This can be a ISBN number
326
+ # or the project homepage.
327
+ #epub_identifier = ''
328
+
329
+ # A unique identification for the text.
330
+ #epub_uid = ''
331
+
332
+ # A tuple containing the cover image and cover page html template filenames.
333
+ #epub_cover = ()
334
+
335
+ # A sequence of (type, uri, title) tuples for the guide element of content.opf.
336
+ #epub_guide = ()
337
+
338
+ # HTML files that should be inserted before the pages created by sphinx.
339
+ # The format is a list of tuples containing the path and title.
340
+ #epub_pre_files = []
341
+
342
+ # HTML files that should be inserted after the pages created by sphinx.
343
+ # The format is a list of tuples containing the path and title.
344
+ #epub_post_files = []
345
+
346
+ # A list of files that should not be packed into the epub file.
347
+ epub_exclude_files = ['search.html']
348
+
349
+ # The depth of the table of contents in toc.ncx.
350
+ #epub_tocdepth = 3
351
+
352
+ # Allow duplicate toc entries.
353
+ #epub_tocdup = True
354
+
355
+ # Choose between 'default' and 'includehidden'.
356
+ #epub_tocscope = 'default'
357
+
358
+ # Fix unsupported image types using the Pillow.
359
+ #epub_fix_images = False
360
+
361
+ # Scale large images.
362
+ #epub_max_image_width = 0
363
+
364
+ # How to display URL addresses: 'footnote', 'no', or 'inline'.
365
+ #epub_show_urls = 'inline'
366
+
367
+ # If false, no index is generated.
368
+ #epub_use_index = True
@@ -0,0 +1,68 @@
1
+ from __future__ import absolute_import
2
+ from setuptools import setup, find_packages
3
+ from os import path
4
+
5
+ _dir = path.abspath(path.dirname(__file__))
6
+
7
+ with open(path.join(_dir,'csbdeep','version.py')) as f:
8
+ exec(f.read())
9
+
10
+ with open(path.join(_dir,'README.md')) as f:
11
+ long_description = f.read()
12
+
13
+
14
+ setup(name='csbdeep',
15
+ version=__version__,
16
+ description='CSBDeep - a toolbox for Content-aware Image Restoration (CARE)',
17
+ long_description=long_description,
18
+ long_description_content_type='text/markdown',
19
+ url='http://csbdeep.bioimagecomputing.com/',
20
+ author='Uwe Schmidt, Martin Weigert',
21
+ author_email='research@uweschmidt.org, martin.weigert@epfl.ch',
22
+ license='BSD 3-Clause License',
23
+ packages=find_packages(),
24
+ python_requires='>=3.6',
25
+
26
+ project_urls={
27
+ 'Documentation': 'http://csbdeep.bioimagecomputing.com/doc/',
28
+ 'Repository': 'https://github.com/csbdeep/csbdeep',
29
+ },
30
+
31
+ classifiers=[
32
+ 'Development Status :: 4 - Beta',
33
+ 'Intended Audience :: Science/Research',
34
+ 'Topic :: Scientific/Engineering',
35
+ 'License :: OSI Approved :: BSD License',
36
+
37
+ 'Programming Language :: Python :: 3.6',
38
+ 'Programming Language :: Python :: 3.7',
39
+ 'Programming Language :: Python :: 3.8',
40
+ 'Programming Language :: Python :: 3.9',
41
+ 'Programming Language :: Python :: 3.10',
42
+ 'Programming Language :: Python :: 3.11',
43
+ 'Programming Language :: Python :: 3.12',
44
+ 'Programming Language :: Python :: 3.13',
45
+ ],
46
+
47
+ install_requires=[
48
+ "numpy",
49
+ "scipy",
50
+ "matplotlib",
51
+ "six",
52
+ "tifffile",
53
+ "tqdm",
54
+ "packaging",
55
+ ],
56
+
57
+ extras_require={
58
+ "tf1": ["keras>=2.1.2,<2.4","protobuf<3.21","h5py<3","numpy<2"],
59
+ "test": ["pytest"],
60
+ "docs": ["sphinx","sphinx-rtd-theme"],
61
+ },
62
+
63
+ entry_points={
64
+ 'console_scripts': [
65
+ 'care_predict = csbdeep.scripts.care_predict:main'
66
+ ]
67
+ }
68
+ )