File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -124,6 +124,17 @@ processing unnecessary frames. If you know that you are likely to access frames
124124multiple times, you can force caching of the stored values by accessing the
125125``.pixel_array `` property (inherited from ``pydicom.Dataset ``).
126126
127+ Additionally, there are two methods for accessing multiple frames at a time:
128+
129+ * :meth: `highdicom.Image.get_stored_frames() `: Returns a stack of multiple
130+ stored frames. The first parameter is a list (or other iterable) of frame
131+ numbers. If omitted, all frames are returned in the order they are stored in
132+ the image.
133+ * :meth: `highdicom.Image.get_frames() `: Returns a stack of multiple
134+ frames with pixel transforms applied. The first parameter is a list (or other
135+ iterable) of frame numbers. If omitted, all frames are returned in the order
136+ they are stored in the image.
137+
127138Accessing Total Pixel Matrices
128139------------------------------
129140
Original file line number Diff line number Diff line change @@ -50,6 +50,7 @@ The :class:`highdicom.Image` class has several methods that return frames or
5050arrangements of frames from a DICOM image:
5151
5252* :meth: `highdicom.Image.get_frame() `
53+ * :meth: `highdicom.Image.get_frames() `
5354* :meth: `highdicom.Image.get_volume() `
5455* :meth: `highdicom.Image.get_total_pixel_matrix() `
5556
Original file line number Diff line number Diff line change @@ -345,8 +345,6 @@ segmentation type.
345345
346346.. code-block :: python
347347
348- import numpy as np
349-
350348 from pydicom.sr.codedict import codes
351349 from pydicom.data import get_testdata_file
352350
@@ -355,13 +353,8 @@ segmentation type.
355353 # Load an enhanced (multiframe) CT image
356354 source_image = hd.imread(get_testdata_file(' eCT_Supplemental.dcm' ))
357355
358- # Stack all the frames of the image
359- image_array = np.stack(
360- [
361- source_image.get_frame(i + 1 )
362- for i in range (source_image.number_of_frames)
363- ]
364- )
356+ # Get a stack of all the frames of the image
357+ image_array = source_image.get_frames()
365358
366359 # Create a segmentation by thresholding the CT image at 0 HU
367360 mask = image_array > 0
You can’t perform that action at this time.
0 commit comments