impy-array 2.4.8__py3-none-any.whl → 2.4.9__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.
impy/__init__.py CHANGED
@@ -1,4 +1,4 @@
1
- __version__ = "2.4.8"
1
+ __version__ = "2.4.9"
2
2
  __author__ = "Hanjin Liu"
3
3
  __email__ = "liuhanjin-sc@g.ecc.u-tokyo.ac.jp"
4
4
 
@@ -52,6 +52,8 @@ binary_closing = get_func("binary_closing")
52
52
  closing = get_func("grey_closing")
53
53
  gaussian_filter = get_func("gaussian_filter")
54
54
  median_filter = get_func("median_filter")
55
+ min_filter = get_func("minimum_filter")
56
+ max_filter = get_func("maximum_filter")
55
57
  spline_filter = get_func("spline_filter")
56
58
  convolve = get_func("convolve")
57
59
  white_tophat = get_func("white_tophat")
@@ -69,6 +71,8 @@ if TYPE_CHECKING:
69
71
  closing = scipy_ndi.grey_closing
70
72
  gaussian_filter = scipy_ndi.gaussian_filter
71
73
  median_filter = scipy_ndi.median_filter
74
+ min_filter = scipy_ndi.minimum_filter
75
+ max_filter = scipy_ndi.maximum_filter
72
76
  spline_filter = scipy_ndi.spline_filter
73
77
  convolve = scipy_ndi.convolve
74
78
  white_tophat = scipy_ndi.white_tophat
impy/arrays/imgarray.py CHANGED
@@ -708,8 +708,7 @@ class ImgArray(LabeledArray):
708
708
  @dims_to_spatial_axes
709
709
  @check_input_and_output
710
710
  def structure_tensor_eig(self, sigma: nDFloat = 1, *, dims: Dims = None)-> tuple[ImgArray, ImgArray]:
711
- """
712
- Calculate structure tensor's eigenvalues and eigenvectors.
711
+ """Calculate structure tensor's eigenvalues and eigenvectors.
713
712
 
714
713
  Parameters
715
714
  ----------
@@ -749,8 +748,7 @@ class ImgArray(LabeledArray):
749
748
  dims: Dims = None,
750
749
  update: bool = False
751
750
  ) -> ImgArray:
752
- """
753
- Sobel filter. This filter is useful for edge detection.
751
+ """Edge detection such as Sobel filter.
754
752
 
755
753
  Parameters
756
754
  ----------
@@ -785,8 +783,7 @@ class ImgArray(LabeledArray):
785
783
  dims: Dims = None,
786
784
  update: bool = False,
787
785
  ) -> ImgArray:
788
- """
789
- Butterworth low-pass filter.
786
+ """Butterworth low-pass filter.
790
787
 
791
788
  Parameters
792
789
  ----------
@@ -831,9 +828,10 @@ class ImgArray(LabeledArray):
831
828
  dims: Dims = None,
832
829
  update: bool = False
833
830
  ) -> ImgArray:
834
- """
835
- Butterworth low-pass filter in real space. Butterworth kernel is created first using inverse
836
- Fourier transform of weight function.
831
+ """Butterworth low-pass filter in real space.
832
+
833
+ Butterworth kernel is created first using inverse Fourier transform of weight
834
+ function.
837
835
 
838
836
  Parameters
839
837
  ----------
@@ -876,8 +874,7 @@ class ImgArray(LabeledArray):
876
874
  dims: Dims = None,
877
875
  update: bool = False
878
876
  ) -> ImgArray:
879
- """
880
- Butterworth high-pass filter.
877
+ """Butterworth high-pass filter.
881
878
 
882
879
  Parameters
883
880
  ----------
@@ -918,8 +915,7 @@ class ImgArray(LabeledArray):
918
915
  dims: Dims = None,
919
916
  update: bool = False
920
917
  ):
921
- """
922
- Butterworth band-pass filter.
918
+ """Butterworth band-pass filter.
923
919
 
924
920
  Parameters
925
921
  ----------
@@ -963,8 +959,7 @@ class ImgArray(LabeledArray):
963
959
  dims: Dims = None,
964
960
  update: bool = False,
965
961
  ) -> ImgArray:
966
- """
967
- General linear convolution by running kernel filtering.
962
+ """General linear convolution by running kernel filtering.
968
963
 
969
964
  Parameters
970
965
  ----------
@@ -998,8 +993,7 @@ class ImgArray(LabeledArray):
998
993
  dims: Dims = None,
999
994
  update: bool = False,
1000
995
  ) -> ImgArray:
1001
- """
1002
- Morphological erosion.
996
+ """Morphological erosion.
1003
997
 
1004
998
  If input is binary image, the running function will automatically switched to
1005
999
  ``binary_erosion`` to speed up calculation.
@@ -1039,8 +1033,9 @@ class ImgArray(LabeledArray):
1039
1033
  dims: Dims = None,
1040
1034
  update: bool = False,
1041
1035
  ) -> ImgArray:
1042
- """
1043
- Morphological dilation. If input is binary image, the running function will automatically switched to
1036
+ """Morphological dilation.
1037
+
1038
+ If input is binary image, the running function will automatically switched to
1044
1039
  ``binary_dilation`` to speed up calculation.
1045
1040
 
1046
1041
  Parameters
@@ -1078,8 +1073,9 @@ class ImgArray(LabeledArray):
1078
1073
  dims: Dims = None,
1079
1074
  update: bool = False,
1080
1075
  ) -> ImgArray:
1081
- """
1082
- Morphological opening. If input is binary image, the running function will automatically switched to
1076
+ """Morphological opening.
1077
+
1078
+ If input is binary image, the running function will automatically switched to
1083
1079
  ``binary_opening`` to speed up calculation.
1084
1080
 
1085
1081
  Parameters
@@ -1117,8 +1113,7 @@ class ImgArray(LabeledArray):
1117
1113
  dims: Dims = None,
1118
1114
  update: bool = False,
1119
1115
  ) -> ImgArray:
1120
- """
1121
- Morphological closing.
1116
+ """Morphological closing.
1122
1117
 
1123
1118
  If input is binary image, the running function will automatically switched to
1124
1119
  ``binary_closing`` to speed up calculation.
@@ -1158,8 +1153,7 @@ class ImgArray(LabeledArray):
1158
1153
  dims: Dims = None,
1159
1154
  update: bool = False,
1160
1155
  ) -> ImgArray:
1161
- """
1162
- Tophat morphological image processing. This is useful for background subtraction.
1156
+ """Tophat morphological image processing. This is useful for background subtraction.
1163
1157
 
1164
1158
  Parameters
1165
1159
  ----------
@@ -1190,8 +1184,7 @@ class ImgArray(LabeledArray):
1190
1184
  *,
1191
1185
  dims: Dims = None
1192
1186
  ) -> ImgArray:
1193
- """
1194
- Smoothen binary mask image at its edges. This is useful to make a "soft mask".
1187
+ """Smoothen binary mask image at its edges. This is useful to make a "soft mask".
1195
1188
 
1196
1189
  This method applies erosion/dilation to a binary image and then smooth its edges by Gaussian.
1197
1190
  The total value is always larger after Gaussian smoothing.
@@ -1243,8 +1236,7 @@ class ImgArray(LabeledArray):
1243
1236
  cval: float = 0.0,
1244
1237
  dims: Dims = None,
1245
1238
  update: bool = False) -> ImgArray:
1246
- """
1247
- Mean filter. Kernel is filled with same values.
1239
+ """Mean filter. Kernel is filled with same values.
1248
1240
 
1249
1241
  Parameters
1250
1242
  ----------
@@ -1264,6 +1256,65 @@ class ImgArray(LabeledArray):
1264
1256
  kwargs=dict(mode=mode, cval=cval),
1265
1257
  )
1266
1258
 
1259
+
1260
+ @_docs.write_docs
1261
+ @dims_to_spatial_axes
1262
+ @check_input_and_output
1263
+ def min_filter(
1264
+ self,
1265
+ radius: float = 1,
1266
+ *,
1267
+ mode: PaddingMode = "reflect",
1268
+ cval: float = 0.0,
1269
+ dims: Dims = None,
1270
+ ) -> ImgArray:
1271
+ """Minimum filter.
1272
+
1273
+ Parameters
1274
+ ----------
1275
+ {radius}{mode}{cval}{dims}
1276
+
1277
+ Returns
1278
+ -------
1279
+ ImgArray
1280
+ Filtered image
1281
+ """
1282
+ disk = _structures.ball_like(radius, len(dims))
1283
+ return self.as_float()._apply_dask(
1284
+ _filters.min_filter,
1285
+ c_axes=complement_axes(dims, self.axes),
1286
+ kwargs=dict(footprint=disk, mode=mode, cval=cval),
1287
+ )
1288
+
1289
+ @_docs.write_docs
1290
+ @dims_to_spatial_axes
1291
+ @check_input_and_output
1292
+ def max_filter(
1293
+ self,
1294
+ radius: float = 1,
1295
+ *,
1296
+ mode: PaddingMode = "reflect",
1297
+ cval: float = 0.0,
1298
+ dims: Dims = None,
1299
+ ) -> ImgArray:
1300
+ """Maximum filter.
1301
+
1302
+ Parameters
1303
+ ----------
1304
+ {radius}{mode}{cval}{dims}
1305
+
1306
+ Returns
1307
+ -------
1308
+ ImgArray
1309
+ Filtered image
1310
+ """
1311
+ disk = _structures.ball_like(radius, len(dims))
1312
+ return self.as_float()._apply_dask(
1313
+ _filters.max_filter,
1314
+ c_axes=complement_axes(dims, self.axes),
1315
+ kwargs=dict(footprint=disk, mode=mode, cval=cval),
1316
+ )
1317
+
1267
1318
  @_docs.write_docs
1268
1319
  @dims_to_spatial_axes
1269
1320
  @check_input_and_output
impy/arrays/lazy.py CHANGED
@@ -890,6 +890,47 @@ class LazyImgArray(AxesMixin):
890
890
  kwargs=dict(footprint=disk, mode=mode, cval=cval),
891
891
  )
892
892
 
893
+ @_docs.copy_docs(ImgArray.min_filter)
894
+ @dims_to_spatial_axes
895
+ @same_dtype
896
+ @check_input_and_output_lazy
897
+ def min_filter(
898
+ self,
899
+ radius: float = 1,
900
+ *,
901
+ mode: PaddingMode = "reflect",
902
+ cval: float = 0,
903
+ dims: Dims = None,
904
+ update: bool = False
905
+ ) -> LazyImgArray:
906
+ disk = _structures.ball_like(radius, len(dims))
907
+ return self._apply_map_overlap(
908
+ xp.ndi.minimum_filter,
909
+ depth=_ceilint(radius),
910
+ c_axes=complement_axes(dims, self.axes),
911
+ kwargs=dict(footprint=disk, mode=mode, cval=cval),
912
+ )
913
+
914
+ @_docs.copy_docs(ImgArray.max_filter)
915
+ @dims_to_spatial_axes
916
+ @same_dtype
917
+ @check_input_and_output_lazy
918
+ def max_filter(
919
+ self,
920
+ radius: float = 1,
921
+ *,
922
+ mode: PaddingMode = "reflect",
923
+ cval: float = 0,
924
+ dims: Dims = None,
925
+ update: bool = False
926
+ ) -> LazyImgArray:
927
+ disk = _structures.ball_like(radius, len(dims))
928
+ return self._apply_map_overlap(
929
+ xp.ndi.maximum_filter,
930
+ depth=_ceilint(radius),
931
+ c_axes=complement_axes(dims, self.axes),
932
+ kwargs=dict(footprint=disk, mode=mode, cval=cval),
933
+ )
893
934
 
894
935
  @_docs.copy_docs(ImgArray.std_filter)
895
936
  @dims_to_spatial_axes
impy/random.py CHANGED
@@ -184,10 +184,10 @@ class ImageGenerator:
184
184
  ) -> ImgArray:
185
185
  size, name, axes = _normalize_like(size, name, axes, like)
186
186
 
187
- arr = self._rng.normal(loc=loc, scale=scale, size=size).astype(np.float32)
187
+ arr = self._rng.normal(loc=loc, scale=scale, size=size)
188
188
  if np.isscalar(arr):
189
189
  return arr
190
- return asarray(xp.asnumpy(arr), axes=axes, name=name)
190
+ return asarray(xp.asnumpy(arr), axes=axes, name=name).astype(np.float32)
191
191
 
192
192
  def poisson(
193
193
  self,
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: impy-array
3
- Version: 2.4.8
3
+ Version: 2.4.9
4
4
  Summary: Speed up coding/extending image analysis in Python.
5
5
  Project-URL: Download, https://github.com/hanjinliu/impy
6
6
  Author-email: Hanjin Liu <liuhanjin-sc@g.ecc.u-tokyo.ac.jp>
@@ -1,4 +1,4 @@
1
- impy/__init__.py,sha256=caLalIZHTPzZHRUtqTEO4bT5iBHCcz_FNVftU3Amqyg,1638
1
+ impy/__init__.py,sha256=hoRBdnPuuB2oQ4-ECrHuGN3vObmgt0R40T_uxML6VwQ,1638
2
2
  impy/__main__.py,sha256=BAQkQ4X8EFo42pbNx__EqpZ5KL4MTfTUWsVbJIQF0O0,4974
3
3
  impy/_const.py,sha256=uNHxxY5ltZuOsJWpwlBWFmUM0QfMgIk5WODqlHuBomo,3700
4
4
  impy/_types.py,sha256=gO4l0hx9qxe6eI0PyC4ukW3k4IYxCEZ9gT-rQ3jj3zU,808
@@ -7,16 +7,16 @@ impy/binder.py,sha256=CTMb11g6uYDVVQV5Wtef865IO0G2V3vGXc8SiGYRD5k,9651
7
7
  impy/collections.py,sha256=2e55bLjZN7W4LFUCkyxekcDfLwZodMaU4JG5NQ3RS54,10946
8
8
  impy/core.py,sha256=itTwflodeyUJf5A4mK-XyrrQ1TGiFz0QU4w8Eel5iFg,25615
9
9
  impy/correlation.py,sha256=Yw1T_0eL9FmsMcnCysc49oRJQMn8ho5z9bAzNg5i59Y,28232
10
- impy/random.py,sha256=c9zlFn8M1ugZyfYlEVOqg0u4DGHS-EnnyrKfjPXOaxU,7004
10
+ impy/random.py,sha256=MQl0ViN6A7xDtM8BS4gbv1atgPKsrmp0TXzV1OtsDlU,7004
11
11
  impy/roi.py,sha256=p9ttjBl5SGHHXj0xg5UjPlg_V9cY3MnNZxFfYIjTYsg,14164
12
12
  impy/arrays/__init__.py,sha256=IHpTBIJysomS64rOZsv960YBmM1vc4M-asTSs1OJBWg,454
13
13
  impy/arrays/_imshow.py,sha256=6mJ_PDqmE4UZO9e9SUgyY_YrzQdR2QKlTG7KF_aC_tI,6949
14
14
  impy/arrays/axesmixin.py,sha256=9PK6kMZAfNVipTL65aF5-yR3qt2fy4ATl1OACXLYrAE,10596
15
15
  impy/arrays/big.py,sha256=tHNijyPgyIfTltLP3hQwZdHOpSX3IwG5DHPamajZ8Kg,2745
16
- impy/arrays/imgarray.py,sha256=Rg1HVIWE1JwCQbDpRTxQb89HoF77gxvXVOqZh6mY5i0,159103
16
+ impy/arrays/imgarray.py,sha256=jJQTAWxua0-MmQNIzfL1ducm6VxQeZQEeuSTSMYFNkY,160457
17
17
  impy/arrays/label.py,sha256=l0SZXcZxU8qwUgj0QZPZ32XsNaoBtenlrn6hNR03SPI,6406
18
18
  impy/arrays/labeledarray.py,sha256=vbWUONnMBOXwLZBHlO2fjl9zqF1nljVdq1y0EFc2ias,59456
19
- impy/arrays/lazy.py,sha256=wBjWCeCHZpx5x1Xb9RFtyKhrMIeDeqBhSw3FkSA8b3E,60145
19
+ impy/arrays/lazy.py,sha256=XrslWD3Eg0QSD3pKkbvuGDyHJpL-gGsNxbJwTIByuYU,61437
20
20
  impy/arrays/phasearray.py,sha256=IojWaNs5sEujn6Lhgqe00H0xF-4CZEFWt5cVW6U_DWQ,13981
21
21
  impy/arrays/specials.py,sha256=4sNg_zeJUce_rwnasPoyL2eZ0-gx_4Z-KwitmLB4a5k,7896
22
22
  impy/arrays/tiled.py,sha256=T44sS6v1Ovln1z1g61Eg8irgZR1Jmpb6BCY3nS6TmDE,9400
@@ -24,7 +24,7 @@ impy/arrays/_utils/__init__.py,sha256=M5HogfyUBvV8kp-X1ZthS8vDLUP7-O2f9Gvsc1ZXdT
24
24
  impy/arrays/_utils/_corr.py,sha256=ThGQV3KSv8ir8BTWDoV83ysalPB2p--LmSCv-J9qq2w,10047
25
25
  impy/arrays/_utils/_deconv.py,sha256=5UM7CoRpWphEYuuiq89bmFCKU-n1G_ArMCkDq7tamdQ,2754
26
26
  impy/arrays/_utils/_docs.py,sha256=AT6tRxXcX433FCfPXhE9wsaeduy_Um44KOqrYHYTFZE,4968
27
- impy/arrays/_utils/_filters.py,sha256=aigQnaURbUnmOXGDxkWksISWQbKAUdwtS8kzbaMzgoQ,7226
27
+ impy/arrays/_utils/_filters.py,sha256=pVkL4tuH8u51sc4fMS9U1edne4GdWYB9_l31ZtXkrtQ,7394
28
28
  impy/arrays/_utils/_glcm.py,sha256=AoUP-p1MPtAzP0Eyt_DEE_wZYwezNICzdkXMBY-OEBo,4150
29
29
  impy/arrays/_utils/_linalg.py,sha256=06jnv-P6nwUjYVTHX2f9i-KDSYZ0bxwNfWWP8A8e_Vw,3233
30
30
  impy/arrays/_utils/_misc.py,sha256=vyyw-G4iu7RiNRAJWyvWWGRalWlcMy5Kg_0VvLBBPq8,2953
@@ -64,8 +64,8 @@ impy/utils/utilcls.py,sha256=3Td9G2ZkU4C0BiW2LH0sq7RBjdco_BtyxNr-s-seLhs,437
64
64
  impy/viewer/__init__.py,sha256=MH-jhpFxP8JVJwUzbKMLRhhWSEYavVHuik9uOS3dDNU,292
65
65
  impy/viewer/utils.py,sha256=_RWV9LePbmYeC8qRBUBf3qG70BaLOndlzRLcvUYgTtE,12248
66
66
  impy/viewer/viewer.py,sha256=Sfq-obSLoHkBkIW0NDWCxEEaX7-YsC4ifAJ-nxpvJws,17632
67
- impy_array-2.4.8.dist-info/METADATA,sha256=PlwAqwu-GA82Idy3iz7sLzdrS47qkWGXoiTfzs7lqAY,7567
68
- impy_array-2.4.8.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
69
- impy_array-2.4.8.dist-info/entry_points.txt,sha256=reyrgy4odXvi1CcPOIIyRYBmsNGG2tO7ZkFOdG5CBkU,44
70
- impy_array-2.4.8.dist-info/licenses/LICENSE,sha256=rpxKafH9r42sxLLYYB5VbZBHOdtYeLuYJjVU1LBwrxk,1546
71
- impy_array-2.4.8.dist-info/RECORD,,
67
+ impy_array-2.4.9.dist-info/METADATA,sha256=2bE_GlsO3-oxky5vfOAddrBg5-uDzoIYYjihUqzzEiQ,7567
68
+ impy_array-2.4.9.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
69
+ impy_array-2.4.9.dist-info/entry_points.txt,sha256=reyrgy4odXvi1CcPOIIyRYBmsNGG2tO7ZkFOdG5CBkU,44
70
+ impy_array-2.4.9.dist-info/licenses/LICENSE,sha256=rpxKafH9r42sxLLYYB5VbZBHOdtYeLuYJjVU1LBwrxk,1546
71
+ impy_array-2.4.9.dist-info/RECORD,,