large-image-source-multi 1.35.8.dev22__py3-none-any.whl → 1.35.8.dev24__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.
@@ -60,6 +60,30 @@ def _lazyImportSkimageTransform():
60
60
  raise TileSourceError(msg)
61
61
 
62
62
 
63
+ def _estimateTransform(cls, src, dst):
64
+ """
65
+ Estimate a scikit-image transform from corresponding points. This uses
66
+ from_estimate when available (scikit-image >= 0.26) and estimate
67
+ otherwise.
68
+
69
+ :param cls: a scikit-image transform class, such as AffineTransform.
70
+ :param src: an array of source points.
71
+ :param dst: an array of destination points.
72
+ :returns: an instance of the transform class.
73
+ """
74
+ if hasattr(cls, 'from_estimate'):
75
+ transformer = cls.from_estimate(src, dst)
76
+ if not transformer:
77
+ msg = f'Cannot compute the warp transform: {transformer}'
78
+ raise TileSourceError(msg)
79
+ return transformer
80
+ transformer = cls()
81
+ if not transformer.estimate(src, dst):
82
+ msg = f'Cannot compute the warp transform: {cls.__name__} estimation failed'
83
+ raise TileSourceError(msg)
84
+ return transformer
85
+
86
+
63
87
  SourceEntrySchema = {
64
88
  'type': 'object',
65
89
  'additionalProperties': True,
@@ -697,12 +721,12 @@ class MultiFileTileSource(FileTileSource, metaclass=LruCacheMetaclass):
697
721
  m[0][2] += warp_dst[0][0] - warp_src[0][0]
698
722
  m[1][2] += warp_dst[0][1] - warp_src[0][1]
699
723
  elif useSimilarity:
700
- transformer = skimage_transform.SimilarityTransform()
701
- transformer.estimate(warp_src, warp_dst)
724
+ transformer = _estimateTransform(
725
+ skimage_transform.SimilarityTransform, warp_src, warp_dst)
702
726
  m = transformer.params
703
727
  elif warp_src.shape[0] <= 3:
704
- transformer = skimage_transform.AffineTransform()
705
- transformer.estimate(warp_src, warp_dst)
728
+ transformer = _estimateTransform(
729
+ skimage_transform.AffineTransform, warp_src, warp_dst)
706
730
  m = np.dot(transformer.params, m)
707
731
  else:
708
732
  warp_dst = np.dot(m, np.hstack([warp_dst, np.ones((len(warp_dst), 1))]).T).T[:, :2]
@@ -757,8 +781,8 @@ class MultiFileTileSource(FileTileSource, metaclass=LruCacheMetaclass):
757
781
  if warp is None:
758
782
  transcorners = np.dot(m, corners.T)
759
783
  elif skimage_transform is not None:
760
- transformer = skimage_transform.ThinPlateSplineTransform()
761
- transformer.estimate(warp.get('src'), warp.get('dst'))
784
+ transformer = _estimateTransform(
785
+ skimage_transform.ThinPlateSplineTransform, warp.get('src'), warp.get('dst'))
762
786
  # We might want to adjust the number of points based on some
763
787
  # criteria such as source image size or number of warp points
764
788
  corners = self._perimeterPoints(x0, y0, x1, y1, 8)
@@ -1272,8 +1296,8 @@ class MultiFileTileSource(FileTileSource, metaclass=LruCacheMetaclass):
1272
1296
  dstcorners = corners
1273
1297
  srccorners = np.dot(np.linalg.inv(transform), np.array(corners).T).T.tolist()
1274
1298
  else:
1275
- transformer = skimage_transform.ThinPlateSplineTransform()
1276
- transformer.estimate(warp_dst, warp_src)
1299
+ transformer = _estimateTransform(
1300
+ skimage_transform.ThinPlateSplineTransform, warp_dst, warp_src)
1277
1301
  # Is there any way to be smarter about the sampling?
1278
1302
  dstcorners = self._perimeterPoints(0, 0, outw, outh, 8)
1279
1303
  srccorners = transformer(dstcorners)
@@ -1373,8 +1397,8 @@ class MultiFileTileSource(FileTileSource, metaclass=LruCacheMetaclass):
1373
1397
  if warp is None:
1374
1398
  transformer = skimage_transform.AffineTransform(np.linalg.inv(transform))
1375
1399
  else:
1376
- transformer = skimage_transform.ThinPlateSplineTransform()
1377
- transformer.estimate(warp_dst, warp_src)
1400
+ transformer = _estimateTransform(
1401
+ skimage_transform.ThinPlateSplineTransform, warp_dst, warp_src)
1378
1402
  # skimage.transform.warp is faster and has less artifacts than
1379
1403
  # scipy.ndimage.affine_transform. It is faster than using cupy's
1380
1404
  # version of scipy's affine_transform when the source and destination
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: large-image-source-multi
3
- Version: 1.35.8.dev22
3
+ Version: 1.35.8.dev24
4
4
  Summary: A tilesource for large_image to composite other tile sources
5
5
  Home-page: https://github.com/girder/large_image
6
6
  Author: Kitware, Inc.
@@ -19,12 +19,12 @@ Requires-Python: >=3.10
19
19
  Description-Content-Type: text/x-rst
20
20
  License-File: LICENSE
21
21
  Requires-Dist: jsonschema
22
- Requires-Dist: large-image>=1.35.8.dev22
22
+ Requires-Dist: large-image>=1.35.8.dev24
23
23
  Requires-Dist: pyyaml
24
24
  Provides-Extra: all
25
25
  Requires-Dist: scikit-image; extra == "all"
26
26
  Provides-Extra: girder
27
- Requires-Dist: girder-large-image>=1.35.8.dev22; extra == "girder"
27
+ Requires-Dist: girder-large-image>=1.35.8.dev24; extra == "girder"
28
28
  Dynamic: author
29
29
  Dynamic: author-email
30
30
  Dynamic: classifier
@@ -0,0 +1,8 @@
1
+ large_image_source_multi/__init__.py,sha256=JqGpk0rQdD6dIi6YFCRTfzNUF91w6IILqBzXBzUAHKg,70708
2
+ large_image_source_multi/girder_source.py,sha256=zgzAsSSYXGNglFv-yPSl-wN5jhSlq_XAF2LMwLAQm1U,1312
3
+ large_image_source_multi-1.35.8.dev24.dist-info/licenses/LICENSE,sha256=psuoW8kuDP96RQsdhzwOqi6fyWv0ct8CR6Jr7He_P_k,10173
4
+ large_image_source_multi-1.35.8.dev24.dist-info/METADATA,sha256=66_44kxmAoDQiCgIWktWeJh-HkmfY74KNOYNtoGps-8,1427
5
+ large_image_source_multi-1.35.8.dev24.dist-info/WHEEL,sha256=mOdXR9C3wMVov7cSY8PY-XCzo3SmmWCHvGQr5csJoao,91
6
+ large_image_source_multi-1.35.8.dev24.dist-info/entry_points.txt,sha256=1ufcPRbofaLVrGNESx1R9QhdUovr4jTzte185wHqpcU,172
7
+ large_image_source_multi-1.35.8.dev24.dist-info/top_level.txt,sha256=v6W6Hkx77lY-DGQ8XqRgbdxYSJRLFv90dCrIJe15d2A,25
8
+ large_image_source_multi-1.35.8.dev24.dist-info/RECORD,,
@@ -1,8 +0,0 @@
1
- large_image_source_multi/__init__.py,sha256=vw1NOLuCneU6QJYqCgXAzKwZ7jF9_BiFB9H-3o5BA6I,69804
2
- large_image_source_multi/girder_source.py,sha256=zgzAsSSYXGNglFv-yPSl-wN5jhSlq_XAF2LMwLAQm1U,1312
3
- large_image_source_multi-1.35.8.dev22.dist-info/licenses/LICENSE,sha256=psuoW8kuDP96RQsdhzwOqi6fyWv0ct8CR6Jr7He_P_k,10173
4
- large_image_source_multi-1.35.8.dev22.dist-info/METADATA,sha256=3O1CsXm8Pc0HeZ2fYqJPuAQUrMViEdThPpcFXr_UTxk,1427
5
- large_image_source_multi-1.35.8.dev22.dist-info/WHEEL,sha256=mOdXR9C3wMVov7cSY8PY-XCzo3SmmWCHvGQr5csJoao,91
6
- large_image_source_multi-1.35.8.dev22.dist-info/entry_points.txt,sha256=1ufcPRbofaLVrGNESx1R9QhdUovr4jTzte185wHqpcU,172
7
- large_image_source_multi-1.35.8.dev22.dist-info/top_level.txt,sha256=v6W6Hkx77lY-DGQ8XqRgbdxYSJRLFv90dCrIJe15d2A,25
8
- large_image_source_multi-1.35.8.dev22.dist-info/RECORD,,