Skip to content

Commit 61fd3ef

Browse files
committed
DOC: Add IO documentation
1 parent 6591ab5 commit 61fd3ef

File tree

1 file changed

+37
-0
lines changed

1 file changed

+37
-0
lines changed

docs/Quick_start_guide.rst

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,43 @@ Array views of an `itk.Image` provide a way to set and get pixel values with Num
142142
[ -993, -999],
143143
[ -996, -994]], dtype=int16)
144144

145+
Input/Output (IO)
146+
.................
147+
148+
Convenient functions are provided read and write from ITK's many supported
149+
file formats.::
150+
151+
image = itk.imread('image.tif')
152+
153+
# Read in with a specific pixel type.
154+
image = itk.imread('image.tif', itk.F)
155+
156+
# Read in an image series.
157+
# Pass a sorted list of files.
158+
image = itk.imread(['image1.png', 'image2.png', 'image3.png'])
159+
160+
# Read in a volume from a DICOM series.
161+
# Pass a directory.
162+
# Only a single series, sorted spatially, will be returned.
163+
image = itk.imread('/a/dicom/directory/')
164+
165+
# Write an image.
166+
itk.imwrite(image, 'image.tif')
167+
168+
169+
# Read a mesh.
170+
mesh = itk.meshread('mesh.vtk')
171+
172+
# Write a mesh.
173+
itk.meshwrite(mesh, 'mesh.vtk')
174+
175+
176+
# Read a spatial transform.
177+
transform = itk.transformread('transform.h5')
178+
179+
# Write a spatial transform.
180+
itk.transformwrite(transform, 'transform.h5')
181+
145182
Image filters and Image-like inputs and outputs
146183
...............................................
147184

0 commit comments

Comments
 (0)