Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
kurmukovai authored Aug 13, 2021
1 parent 69f23d8 commit 69006dc
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,17 @@ from a series of dicom files (each containing 2D image)
>>> from dicom_csv import join_tree, order_series, stack_images
>>> from pydicom import dcmread
>>> from pathlib import Path
>>>
>>> # 1. Collect metadata from all dicom files
>>> folder = Path('/path/to/folder/')
>>> meta = join_tree(folder, verbose=2)
>>> uid = '...' # unique identifier of a series, you could list them by `meta.SeriesInstanceUID.unique()`
>>>
>>> # 2. Select series to load
>>> uid = '...' # unique identifier of a series you want to load,
>>> # you could list them by `meta.SeriesInstanceUID.unique()`
>>> series = meta.query("SeriesInstanceUID==@uid")
>>>
>>> # 3. Read files & combine them into a single volume
>>> images2d = [dcmread(folder / row[1].PathToFolder / row[1].FileName) for row in series.iterrows()]
>>> image3d = stack_images(order_series(images2d))
```
Expand Down

0 comments on commit 69006dc

Please sign in to comment.