Skip to content

Commit 6dc83a0

Browse files
authored
v0.26.0dev (#366)
* Add option to use extended offset table (#354) * Simplify decode_frame to use pydicom deocder directly (#353) * Improvements to spatial calculations (#357) * Add debug logging to spatial calculations * Add perpencicular_tol as a parameter * Improvements to volume docs * Fix line length * Improve logic to match segmentation frames to source images (#361) * Add debug logging to spatial calculations * Add perpencicular_tol as a parameter * Improvements to volume docs * Fix line length * Refactor seg spatial metadata preparation * Recover existing behavior after refactor * WIP * Complete implementation of matching; move generic parts to Image class * Add volume reference tests * Improve test comments * Linterfixes * Minor fixes * Include further_source_images in plane matching * Allow references to multiple frames on creation and parsing * Add tests * Lint * Relax requirement for distinct dimensions * Spell fixes * Contributing Equipment (#356) * Implement ContributingEquipment * Add base_content file * Remove unneeded import * Refactor to _add_contributing_equipment method * Version bump to 0.26.0 * "Usablility" improvements for working with volumes and segmentations (#367) * Add affine conversion to volume constructors; add match_orientation * Add ITK and NIfTI conversion docs * Add pydicom and highdicom docs page * Add missing docs page * Rewrite of segmentation pixel array docstring * lint * Fix spelling * Another spell fix
1 parent 322d187 commit 6dc83a0

30 files changed

Lines changed: 4769 additions & 1581 deletions

README.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@
77

88
# Highdicom
99

10-
`highdicom` is a pure Python package providing a high-level application programming interface (API) for working with DICOM files, with a focus on common operations required for machine learning, computer vision, and other similar computational analyses. Broadly speaking the package helps with three types of task:
10+
`highdicom` is a pure Python package built on top of `pydicom` to provide a higher-level application programming interface (API) for working with DICOM files. Its focus is on common operations required for machine learning, computer vision, and other similar computational analyses. Broadly speaking, the package helps with three types of task:
1111

12-
1. Reading existing DICOM image files of a wide variety of modalities (covering radiology, pathology, and more) and formatting the frames to prepare them for computational analysis.
12+
1. Reading existing DICOM image files of a wide variety of modalities (covering radiology, pathology, and more) and selecting and formatting its frames for computational analysis. This includes considerations such as spatial arrangements of frames, and application of pixel transforms, which are not handled by `pydicom`.
1313
2. Storing image-derived information, for example from computational analyses or human annotation, in derived DICOM objects for communication and storage. This includes:
1414
* Annotations
1515
* Parametric Map images
@@ -19,7 +19,8 @@
1919
* Key Object Selection documents
2020
* Legacy Converted Enhanced CT/PET/MR images (e.g., for single frame to multi-frame conversion)
2121
* Softcopy Presentation State instances (including Grayscale, Color, and Pseudo-Color)
22-
3. Reading existing derived DICOM files and filtering and accessing the information contained within them.
22+
23+
3. Reading existing derived DICOM files of the above types and filtering and accessing the information contained within them.
2324

2425
## Documentation
2526

docs/general.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ parts of the library.
1010
:maxdepth: 2
1111
:caption: Contents:
1212

13+
highdicom_and_pydicom
1314
image
1415
pixel_transforms
1516
volume

docs/highdicom_and_pydicom.rst

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
.. _pydicom-and-highdicom:
2+
3+
Highdicom and Pydicom
4+
=====================
5+
6+
The ``highdicom`` library is built on top of ``pydicom``. This page summarizes
7+
the relationship between the two.
8+
9+
Pydicom
10+
-------
11+
12+
`pydicom`_ is a widely-used Python package for working with DICOM files in
13+
Python. It uses a fundamental class, ``pydicom.Dataset``, to represent DICOM
14+
objects within Python programs. It handles operations such as:
15+
16+
- Reading and writing ``Dataset`` objects to/from files.
17+
- Accessing and setting individual attributes on ``Dataset`` objects.
18+
- Decoding pixel data within DICOM files to NumPy arrays, and encoding pixel
19+
data from NumPy to raw bytes to store within ``Dataset`` objects.
20+
21+
22+
Highdicom
23+
---------
24+
25+
There is a wide variety of DICOM objects defined in the standard, covering many
26+
types of images (X-Ray, CT, MRI, Microscopy, Ophthalmic images) as well as
27+
various types of image-derived information, such as Structured Reports,
28+
Annotations, Presentation States, Segmentations, and Parametric Maps. Formally,
29+
these "types" are known as Information Object Definitions (IODs). The standard
30+
requires different combinations of attributes are required for different IODs
31+
(e.g. the "Echo Time" attribute exists with the *MRImage* IOD but not within
32+
the *CTImage* IOD) ``pydicom`` represents all of these objects using a general
33+
``Dataset`` class, which implements behavior that is common to all of these
34+
objects. However, it does not attempt to specialize its representation to
35+
implement specific behaviors of these various IODs, leaving it up to the user
36+
to interpret the individual attributes in the file in each case.
37+
38+
The purpose of ``highdicom`` is to build upon ``pydicom`` to implement specific
39+
behaviors for various IODs, to make it easier to correctly create and work with
40+
**specific** types of DICOM object. ``highdicom`` defines sub-classes of
41+
``pydicom.Dataset`` that implement particular IODs, for example:
42+
43+
- :class:`highdicom.Image` (this actually covers many IODs)
44+
- :class:`highdicom.seg.Segmentation`
45+
- :class:`highdicom.sr.EnhancedSR`
46+
- :class:`highdicom.sr.ComprehensiveSR`
47+
- :class:`highdicom.sr.Comprehensive3DSR`
48+
- :class:`highdicom.pm.ParametricMap`
49+
- :class:`highdicom.pr.GrayscaleSoftcopyPresentationState`
50+
- :class:`highdicom.pr.PseudoColorSoftcopyPresentationState`
51+
- :class:`highdicom.pr.AdvancedBlendingPresentationState`
52+
- :class:`highdicom.ko.KeyObjectSelectionDocument`
53+
- :class:`highdicom.ann.MicroscopyBulkSimpleAnnotations`
54+
- :class:`highdicom.sc.SCImage`
55+
56+
Since each of these objects are sub-classes of ``pydicom.Dataset``, they all
57+
inherit its behaviors for accessing and setting individual attributes and
58+
writing to file. They should also be interoperable with ``pydicom.Dataset``,
59+
such that they can be used anywhere a ``pydicom.Dataset`` is expected. However
60+
they also have:
61+
62+
- A constructor that dramatically simplifies the creation of the objects while
63+
ensuring correctness. The constructors guide you through which attributes are
64+
required and enforce inter-relationships between them required by the
65+
standard.
66+
- Several of these IODs also have further methods that allow you to search,
67+
filter, and access the information within them more easily.
68+
69+
However, not all classes within ``highdicom`` are DICOM objects, and such
70+
objects are not sub-classes of ``pydicom.Dataset``. Notable examples include
71+
:class:`highdicom.Volume`,
72+
:class:`highdicom.spatial.ImageToReferenceTransformer` (and other similar
73+
objects), :class:`highdicom.io.ImageFileReader`.
74+
75+
.. _`pydicom`: https://pydicom.github.io/pydicom/stable/index.html

docs/index.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
Documentation of the Highdicom Package
22
======================================
33

4-
``highdicom`` is a pure Python package providing a high-level application programming interface (API) for working with DICOM files, with a focus on common operations required for machine learning, computer vision, and other similar computational analyses. Broadly speaking, the package helps with three types of task:
4+
``highdicom`` is a pure Python package built on top of ``pydicom`` to provide a higher-level application programming interface (API) for working with DICOM files. Its focus is on common operations required for machine learning, computer vision, and other similar computational analyses. Broadly speaking, the package helps with three types of task:
55

6-
1. Reading existing DICOM image files of a wide variety of modalities (covering radiology, pathology, and more) and formatting the frames to prepare them for computational analysis.
6+
1. Reading existing DICOM image files of a wide variety of modalities (covering radiology, pathology, and more) and selecting and formatting its frames for computational analysis. This includes considerations such as spatial arrangements of frames, and application of pixel transforms, which are not handled by ``pydicom``.
77
2. Storing image-derived information, for example from computational analyses or human annotation, in derived DICOM objects for communication and storage. This includes:
88

99
- Annotations
@@ -15,7 +15,7 @@ Documentation of the Highdicom Package
1515
- Legacy Converted Enhanced CT/PET/MR images (e.g., for single frame to multi-frame conversion)
1616
- Softcopy Presentation State instances (including Grayscale, Color, and Pseudo-Color)
1717

18-
3. Reading existing derived DICOM files and filtering and accessing the information contained within them.
18+
3. Reading existing derived DICOM files of the above types and filtering and accessing the information contained within them.
1919

2020
For new users looking to get an overview of the library's capabilities and perform basic tasks, we recommend starting with the :ref:`quick-start` page. For a detailed introduction to many of the library's capabilities, see the rest of the :ref:`user-guide`. Documentation of all classes and functions may be found in the :ref:`api-docs`.
2121

docs/quickstart.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ Computed Tomography (CT) images:
135135
image_datasets[0].Rows,
136136
image_datasets[0].Columns
137137
),
138-
dtype=np.bool
138+
dtype=bool
139139
)
140140
mask[1:-1, 10:-10, 100:-100] = True
141141

0 commit comments

Comments
 (0)