Skip to content

Commit d5cb095

Browse files
committedDec 12, 2021
update to doc strings
1 parent 18dd62d commit d5cb095

File tree

2 files changed

+15
-15
lines changed

2 files changed

+15
-15
lines changed
 

‎src/highdicom/io.py

+4-2
Original file line numberDiff line numberDiff line change
@@ -225,12 +225,14 @@ class ImageFileReader(object):
225225
Examples
226226
--------
227227
>>> from highdicom.io import ImageFileReader
228-
>>> with ImageFileReader('/path/to/file.dcm') as image:
228+
>>> with ImageFileReader('data/test_files/ct_image.dcm') as image:
229229
... print(image.metadata)
230230
... for i in range(image.number_of_frames):
231231
... frame = image.read_frame(i)
232232
... print(frame.shape)
233-
233+
Dataset.file_meta -------------------------------
234+
(0002, 0000) File Meta Information Group Length UL: 192
235+
...
234236
"""
235237

236238
def __init__(self, filename: str):

‎src/highdicom/spatial.py

+11-13
Original file line numberDiff line numberDiff line change
@@ -45,19 +45,19 @@ class ImageToReferenceTransformer(object):
4545
Examples
4646
--------
4747
48+
>>> import numpy as np
4849
>>> # Create a transformer by specifying the reference space of
4950
>>> # an image
5051
>>> transformer = ImageToReferenceTransformer(
51-
>>> image_position=[56.0, 34.2, 1.0],
52-
>>> image_orientation=[1.0, 0.0, 0.0, 0.0, 1.0, 0.0],
53-
>>> pixel_spacing=[0.5, 0.5]
54-
>>> )
52+
... image_position=[56.0, 34.2, 1.0],
53+
... image_orientation=[1.0, 0.0, 0.0, 0.0, 1.0, 0.0],
54+
... pixel_spacing=[0.5, 0.5])
5555
>>> # Use the transformer to convert coordinates
5656
>>> image_coords = np.array([[0.0, 10.0], [5.0, 5.0]])
5757
>>> ref_coords = transformer(image_coords)
5858
>>> print(ref_coords)
59-
>>> # [[56. 39.2 1. ]
60-
>>> # [58.5 36.7 1. ]]
59+
[[56. 39.2 1. ]
60+
[58.5 36.7 1. ]]
6161
6262
"""
6363

@@ -198,18 +198,16 @@ class ReferenceToImageTransformer(object):
198198
>>> # Create a transformer by specifying the reference space of
199199
>>> # an image
200200
>>> transformer = ReferenceToImageTransformer(
201-
>>> image_position=[56.0, 34.2, 1.0],
202-
>>> image_orientation=[1.0, 0.0, 0.0, 0.0, 1.0, 0.0],
203-
>>> pixel_spacing=[0.5, 0.5]
204-
>>> )
205-
>>>
201+
... image_position=[56.0, 34.2, 1.0],
202+
... image_orientation=[1.0, 0.0, 0.0, 0.0, 1.0, 0.0],
203+
... pixel_spacing=[0.5, 0.5])
206204
>>> # Use the transformer to convert coordinates
207205
>>> ref_coords = np.array([[56., 39.2, 1. ], [58.5, 36.7, 1.]])
208206
>>> image_coords = transformer(ref_coords)
209207
>>>
210208
>>> print(image_coords)
211-
>>> # [[ 0. 10. 0.]
212-
>>> # [ 5. 5. 0.]]
209+
[[ 0. 10. 0.]
210+
[ 5. 5. 0.]]
213211
214212
"""
215213

0 commit comments

Comments
 (0)