roifile 2024.3.20__tar.gz → 2024.5.24__tar.gz

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.

Potentially problematic release.


This version of roifile might be problematic. Click here for more details.

@@ -1,6 +1,10 @@
1
1
  Revisions
2
2
  ---------
3
3
 
4
+ 2024.5.24
5
+
6
+ - Fix GitHub not correctly rendering docstring examples.
7
+
4
8
  2024.3.20
5
9
 
6
10
  - Fix writing generator of ROIs (#9).
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: roifile
3
- Version: 2024.3.20
3
+ Version: 2024.5.24
4
4
  Summary: Read and write ImageJ ROI format
5
5
  Home-page: https://www.cgohlke.com
6
6
  Author: Christoph Gohlke
@@ -38,7 +38,7 @@ interest, geometric shapes, paths, text, and whatnot for image overlays.
38
38
 
39
39
  :Author: `Christoph Gohlke <https://www.cgohlke.com>`_
40
40
  :License: BSD 3-Clause
41
- :Version: 2024.3.20
41
+ :Version: 2024.5.24
42
42
  :DOI: `10.5281/zenodo.6941603 <https://doi.org/10.5281/zenodo.6941603>`_
43
43
 
44
44
  Quickstart
@@ -64,14 +64,18 @@ Requirements
64
64
  This revision was tested with the following requirements and dependencies
65
65
  (other versions may work):
66
66
 
67
- - `CPython <https://www.python.org>`_ 3.9.13, 3.10.11, 3.11.8, 3.12.2
67
+ - `CPython <https://www.python.org>`_ 3.9.13, 3.10.11, 3.11.9, 3.12.3
68
68
  - `Numpy <https://pypi.org/project/numpy/>`_ 1.26.4
69
- - `Tifffile <https://pypi.org/project/tifffile/>`_ 2024.2.12 (optional)
70
- - `Matplotlib <https://pypi.org/project/matplotlib/>`_ 3.8.3 (optional)
69
+ - `Tifffile <https://pypi.org/project/tifffile/>`_ 2024.5.22 (optional)
70
+ - `Matplotlib <https://pypi.org/project/matplotlib/>`_ 3.8.4 (optional)
71
71
 
72
72
  Revisions
73
73
  ---------
74
74
 
75
+ 2024.5.24
76
+
77
+ - Fix GitHub not correctly rendering docstring examples.
78
+
75
79
  2024.3.20
76
80
 
77
81
  - Fix writing generator of ROIs (#9).
@@ -1,3 +1,6 @@
1
+ ..
2
+ This file is generated by setup.py
3
+
1
4
  Read and write ImageJ ROI format
2
5
  ================================
3
6
 
@@ -9,7 +12,7 @@ interest, geometric shapes, paths, text, and whatnot for image overlays.
9
12
 
10
13
  :Author: `Christoph Gohlke <https://www.cgohlke.com>`_
11
14
  :License: BSD 3-Clause
12
- :Version: 2024.3.20
15
+ :Version: 2024.5.24
13
16
  :DOI: `10.5281/zenodo.6941603 <https://doi.org/10.5281/zenodo.6941603>`_
14
17
 
15
18
  Quickstart
@@ -35,14 +38,18 @@ Requirements
35
38
  This revision was tested with the following requirements and dependencies
36
39
  (other versions may work):
37
40
 
38
- - `CPython <https://www.python.org>`_ 3.9.13, 3.10.11, 3.11.8, 3.12.2
41
+ - `CPython <https://www.python.org>`_ 3.9.13, 3.10.11, 3.11.9, 3.12.3
39
42
  - `Numpy <https://pypi.org/project/numpy/>`_ 1.26.4
40
- - `Tifffile <https://pypi.org/project/tifffile/>`_ 2024.2.12 (optional)
41
- - `Matplotlib <https://pypi.org/project/matplotlib/>`_ 3.8.3 (optional)
43
+ - `Tifffile <https://pypi.org/project/tifffile/>`_ 2024.5.22 (optional)
44
+ - `Matplotlib <https://pypi.org/project/matplotlib/>`_ 3.8.4 (optional)
42
45
 
43
46
  Revisions
44
47
  ---------
45
48
 
49
+ 2024.5.24
50
+
51
+ - Fix GitHub not correctly rendering docstring examples.
52
+
46
53
  2024.3.20
47
54
 
48
55
  - Fix writing generator of ROIs (#9).
@@ -101,37 +108,45 @@ Examples
101
108
 
102
109
  Create a new ImagejRoi instance from an array of x, y coordinates:
103
110
 
104
- >>> roi = ImagejRoi.frompoints([[1.1, 2.2], [3.3, 4.4], [5.5, 6.6]])
105
- >>> roi.roitype = ROI_TYPE.POINT
106
- >>> roi.options |= ROI_OPTIONS.SHOW_LABELS
111
+ .. code-block:: python
112
+
113
+ >>> roi = ImagejRoi.frompoints([[1.1, 2.2], [3.3, 4.4], [5.5, 6.6]])
114
+ >>> roi.roitype = ROI_TYPE.POINT
115
+ >>> roi.options |= ROI_OPTIONS.SHOW_LABELS
107
116
 
108
117
  Export the instance to an ImageJ ROI formatted byte string or file:
109
118
 
110
- >>> out = roi.tobytes()
111
- >>> out[:4]
112
- b'Iout'
113
- >>> roi.tofile('_test.roi')
119
+ .. code-block:: python
120
+
121
+ >>> out = roi.tobytes()
122
+ >>> out[:4]
123
+ b'Iout'
124
+ >>> roi.tofile('_test.roi')
114
125
 
115
126
  Read the ImageJ ROI from the file and verify the content:
116
127
 
117
- >>> roi2 = ImagejRoi.fromfile('_test.roi')
118
- >>> roi2 == roi
119
- True
120
- >>> roi.roitype == ROI_TYPE.POINT
121
- True
122
- >>> roi.subpixelresolution
123
- True
124
- >>> roi.coordinates()
125
- array([[1.1, 2.2],
126
- [3.3, 4.4],
127
- [5.5, 6.6]], dtype=float32)
128
- >>> roi.left, roi.top, roi.right, roi.bottom
129
- (1, 2, 7, 8)
128
+ .. code-block:: python
129
+
130
+ >>> roi2 = ImagejRoi.fromfile('_test.roi')
131
+ >>> roi2 == roi
132
+ True
133
+ >>> roi.roitype == ROI_TYPE.POINT
134
+ True
135
+ >>> roi.subpixelresolution
136
+ True
137
+ >>> roi.coordinates()
138
+ array([[1.1, 2.2],
139
+ [3.3, 4.4],
140
+ [5.5, 6.6]], dtype=float32)
141
+ >>> roi.left, roi.top, roi.right, roi.bottom
142
+ (1, 2, 7, 8)
130
143
 
131
144
  Plot the ROI using matplotlib:
132
145
 
133
- >>> roi.plot()
146
+ .. code-block:: python
147
+
148
+ >>> roi.plot()
134
149
 
135
150
  View the overlays stored in a ROI, ZIP, or TIFF file from a command line::
136
151
 
137
- python -m roifile _test.roi
152
+ python -m roifile _test.roi
@@ -39,7 +39,7 @@ interest, geometric shapes, paths, text, and whatnot for image overlays.
39
39
 
40
40
  :Author: `Christoph Gohlke <https://www.cgohlke.com>`_
41
41
  :License: BSD 3-Clause
42
- :Version: 2024.3.20
42
+ :Version: 2024.5.24
43
43
  :DOI: `10.5281/zenodo.6941603 <https://doi.org/10.5281/zenodo.6941603>`_
44
44
 
45
45
  Quickstart
@@ -65,14 +65,18 @@ Requirements
65
65
  This revision was tested with the following requirements and dependencies
66
66
  (other versions may work):
67
67
 
68
- - `CPython <https://www.python.org>`_ 3.9.13, 3.10.11, 3.11.8, 3.12.2
68
+ - `CPython <https://www.python.org>`_ 3.9.13, 3.10.11, 3.11.9, 3.12.3
69
69
  - `Numpy <https://pypi.org/project/numpy/>`_ 1.26.4
70
- - `Tifffile <https://pypi.org/project/tifffile/>`_ 2024.2.12 (optional)
71
- - `Matplotlib <https://pypi.org/project/matplotlib/>`_ 3.8.3 (optional)
70
+ - `Tifffile <https://pypi.org/project/tifffile/>`_ 2024.5.22 (optional)
71
+ - `Matplotlib <https://pypi.org/project/matplotlib/>`_ 3.8.4 (optional)
72
72
 
73
73
  Revisions
74
74
  ---------
75
75
 
76
+ 2024.5.24
77
+
78
+ - Fix GitHub not correctly rendering docstring examples.
79
+
76
80
  2024.3.20
77
81
 
78
82
  - Fix writing generator of ROIs (#9).
@@ -170,7 +174,7 @@ View the overlays stored in a ROI, ZIP, or TIFF file from a command line::
170
174
 
171
175
  from __future__ import annotations
172
176
 
173
- __version__ = '2024.3.20'
177
+ __version__ = '2024.5.24'
174
178
 
175
179
  __all__ = [
176
180
  'roiread',
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: roifile
3
- Version: 2024.3.20
3
+ Version: 2024.5.24
4
4
  Summary: Read and write ImageJ ROI format
5
5
  Home-page: https://www.cgohlke.com
6
6
  Author: Christoph Gohlke
@@ -38,7 +38,7 @@ interest, geometric shapes, paths, text, and whatnot for image overlays.
38
38
 
39
39
  :Author: `Christoph Gohlke <https://www.cgohlke.com>`_
40
40
  :License: BSD 3-Clause
41
- :Version: 2024.3.20
41
+ :Version: 2024.5.24
42
42
  :DOI: `10.5281/zenodo.6941603 <https://doi.org/10.5281/zenodo.6941603>`_
43
43
 
44
44
  Quickstart
@@ -64,14 +64,18 @@ Requirements
64
64
  This revision was tested with the following requirements and dependencies
65
65
  (other versions may work):
66
66
 
67
- - `CPython <https://www.python.org>`_ 3.9.13, 3.10.11, 3.11.8, 3.12.2
67
+ - `CPython <https://www.python.org>`_ 3.9.13, 3.10.11, 3.11.9, 3.12.3
68
68
  - `Numpy <https://pypi.org/project/numpy/>`_ 1.26.4
69
- - `Tifffile <https://pypi.org/project/tifffile/>`_ 2024.2.12 (optional)
70
- - `Matplotlib <https://pypi.org/project/matplotlib/>`_ 3.8.3 (optional)
69
+ - `Tifffile <https://pypi.org/project/tifffile/>`_ 2024.5.22 (optional)
70
+ - `Matplotlib <https://pypi.org/project/matplotlib/>`_ 3.8.4 (optional)
71
71
 
72
72
  Revisions
73
73
  ---------
74
74
 
75
+ 2024.5.24
76
+
77
+ - Fix GitHub not correctly rendering docstring examples.
78
+
75
79
  2024.3.20
76
80
 
77
81
  - Fix writing generator of ROIs (#9).
@@ -9,11 +9,10 @@ segmentation from/to ImageJ TIFF files.
9
9
 
10
10
  import numpy
11
11
  from matplotlib import pyplot
12
+ from roifile import ImagejRoi
12
13
  from skimage.measure import find_contours, label, regionprops
13
14
  from tifffile import TiffFile, imwrite
14
15
 
15
- from roifile import ImagejRoi
16
-
17
16
 
18
17
  def plot_image_overlays(image, overlays, **kwargs):
19
18
  """Plot image and overlays (bytes) using matplotlib."""
@@ -8,14 +8,32 @@ import sys
8
8
  from setuptools import setup
9
9
 
10
10
 
11
- def search(pattern, code, flags=0):
12
- # return first match for pattern in code
13
- match = re.search(pattern, code, flags)
11
+ def search(pattern, string, flags=0):
12
+ """Return first match of pattern in string."""
13
+ match = re.search(pattern, string, flags)
14
14
  if match is None:
15
15
  raise ValueError(f'{pattern!r} not found')
16
16
  return match.groups()[0]
17
17
 
18
18
 
19
+ def fix_docstring_examples(docstring):
20
+ """Return docstring with examples fixed for GitHub."""
21
+ start = True
22
+ indent = False
23
+ lines = ['..', ' This file is generated by setup.py', '']
24
+ for line in docstring.splitlines():
25
+ if not line.strip():
26
+ start = True
27
+ indent = False
28
+ if line.startswith('>>> '):
29
+ indent = True
30
+ if start:
31
+ lines.extend(['.. code-block:: python', ''])
32
+ start = False
33
+ lines.append((' ' if indent else '') + line)
34
+ return '\n'.join(lines)
35
+
36
+
19
37
  with open('roifile/roifile.py', encoding='utf-8') as fh:
20
38
  code = fh.read().replace('\r\n', '\n').replace('\r', '\n')
21
39
 
@@ -36,7 +54,7 @@ if 'sdist' in sys.argv:
36
54
  # update README, LICENSE, and CHANGES files
37
55
 
38
56
  with open('README.rst', 'w', encoding='utf-8') as fh:
39
- fh.write(readme)
57
+ fh.write(fix_docstring_examples(readme))
40
58
 
41
59
  license = search(
42
60
  r'(# Copyright.*?(?:\r\n|\r|\n))(?:\r\n|\r|\n)+""',
File without changes
File without changes
File without changes