Skip to content

Commit

Permalink
Merge branch 'master' into docs/seg_explanation
Browse files Browse the repository at this point in the history
  • Loading branch information
CPBridge committed Jun 21, 2023
2 parents a3f2893 + 76829e8 commit aa94489
Show file tree
Hide file tree
Showing 17 changed files with 76 additions and 45 deletions.
4 changes: 4 additions & 0 deletions .codespellrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[codespell]
skip = .git,*.pdf,*.svg,*.ipynb
# te,fo - either abbreviations of variables
ignore-words-list = te,fo
22 changes: 22 additions & 0 deletions .github/workflows/codespell.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
---
name: Codespell

on:
push:
branches: [master]
pull_request:
branches: [master]

permissions:
contents: read

jobs:
codespell:
name: Check for spelling errors
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v3
- name: Codespell
uses: codespell-project/actions-codespell@v2
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def get_version():
package_dir={'': 'src'},
python_requires='>=3.6',
install_requires=[
'pydicom>=2.3.0',
'pydicom>=2.3.0,!=2.4.0',
'numpy>=1.19',
'pillow>=8.3',
'pillow-jpls>=1.0',
Expand Down
2 changes: 1 addition & 1 deletion src/highdicom/ann/enum.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ class GraphicTypeValues(Enum):
"""

POINT = 'POINT'
"""An individual piont defined by a single coordinate."""
"""An individual point defined by a single coordinate."""

POLYLINE = 'POLYLINE'
"""Connected line segments defined by two or more ordered coordinates.
Expand Down
2 changes: 1 addition & 1 deletion src/highdicom/frame.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ def encode_frame(
-------
bytes
Encoded pixel data (potentially compressed in case of encapsulated
format encoding, depending on the transfer snytax)
format encoding, depending on the transfer syntax)
Raises
------
Expand Down
2 changes: 1 addition & 1 deletion src/highdicom/ko/sop.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ def __init__(
Name of the department of the person or device that creates the
document instance
requested_procedures: Union[Sequence[pydicom.dataset.Dataset], None], optional
Requested procedures that are being fullfilled by creation of the
Requested procedures that are being fulfilled by creation of the
document
transfer_syntax_uid: str, optional
UID of transfer syntax that should be used for encoding of
Expand Down
2 changes: 1 addition & 1 deletion src/highdicom/legacy/sop.py
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,7 @@ def _convert_legacy_to_enhanced(
# All remaining unassigned attributes will be collected in either the
# UnassignedSharedConvertedAttributesSequence or the
# UnassignedPerFrameConvertedAttributesSequence, depending on whether
# values vary accross frames (original single-frame image instances).
# values vary across frames (original single-frame image instances).
unassigned_shared_ca_item = Dataset()
unassigned_perframe_ca_items = [
Dataset()
Expand Down
10 changes: 6 additions & 4 deletions src/highdicom/pm/sop.py
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ def __init__(
Identifying information for the person who created the content of
this parametric map.
palette_color_lut_transformation: Union[highdicom.PaletteColorLUTTransformation, None], optional
Description of the Palette Color LUT Transformation for tranforming
Description of the Palette Color LUT Transformation for transforming
grayscale into RGB color pixel values
**kwargs: Any, optional
Additional keyword arguments that will be passed to the constructor
Expand Down Expand Up @@ -737,9 +737,11 @@ def __init__(
# Frame Content
frame_content_item = Dataset()
frame_content_item.DimensionIndexValues = [
np.where(
(dimension_position_values[idx] == pos)
)[0][0] + 1
int(
np.where(
(dimension_position_values[idx] == pos)
)[0][0] + 1
)
for idx, pos in enumerate(plane_position_values[i])
]

Expand Down
4 changes: 2 additions & 2 deletions src/highdicom/pr/content.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ def __init__(
label: str
Name used to identify the Graphic Group (maximum 64 characters).
description: Union[str, None], optional
Description of the group (maxiumum 10240 characters).
Description of the group (maximum 10240 characters).
"""
super().__init__()
Expand Down Expand Up @@ -431,7 +431,7 @@ def __init__(
raise ValueError(
'All coordinates in the bounding box must be non-negative.'
)
self.AnchorPoint = anchor_point
self.AnchorPoint = list(anchor_point)
self.AnchorPointAnnotationUnits = units.value
self.AnchorPointVisibility = 'Y' if anchor_point_visible else 'N'
if units == AnnotationUnitsValues.DISPLAY:
Expand Down
6 changes: 3 additions & 3 deletions src/highdicom/pr/sop.py
Original file line number Diff line number Diff line change
Expand Up @@ -389,7 +389,7 @@ def __init__(
device_serial_number: Union[str, None]
Manufacturer's serial number of the device
palette_color_lut_transformation: highdicom.PaletteColorLUTTransformation
Description of the Palette Color LUT Transformation for tranforming
Description of the Palette Color LUT Transformation for transforming
grayscale into RGB color pixel values
content_label: str
A label used to describe the content of this presentation state.
Expand Down Expand Up @@ -419,10 +419,10 @@ def __init__(
Identifying information for the person who created the content of
this presentation state.
modality_lut_transformation: Union[highdicom.ModalityLUTTransformation, None], optional
Description of the Modality LUT Transformation for tranforming modality
Description of the Modality LUT Transformation for transforming modality
dependent into modality independent pixel values
voi_lut_transformations: Union[Sequence[highdicom.pr.SoftcopyVOILUTTransformation], None], optional
Description of the VOI LUT Transformation for tranforming
Description of the VOI LUT Transformation for transforming
modality pixel values into pixel values that are of interest to a
user or an application
icc_profile: Union[bytes, None], optional
Expand Down
37 changes: 20 additions & 17 deletions src/highdicom/seg/sop.py
Original file line number Diff line number Diff line change
Expand Up @@ -589,7 +589,7 @@ def iterate_indices_by_source_instance(
relabel: bool, optional
If True and ``combine_segments`` is ``True``, the output segment
numbers are relabelled into the range ``0`` to
``len(segment_numbers)`` (inclusive) accoring to the position of
``len(segment_numbers)`` (inclusive) according to the position of
the original segment numbers in ``segment_numbers`` parameter. If
``combine_segments`` is ``False``, this has no effect.
Expand Down Expand Up @@ -690,7 +690,7 @@ def iterate_indices_by_source_frame(
relabel: bool, optional
If True and ``combine_segments`` is ``True``, the output segment
numbers are relabelled into the range ``0`` to
``len(segment_numbers)`` (inclusive) accoring to the position of
``len(segment_numbers)`` (inclusive) according to the position of
the original segment numbers in ``segment_numbers`` parameter. If
``combine_segments`` is ``False``, this has no effect.
Expand Down Expand Up @@ -793,7 +793,7 @@ def iterate_indices_by_dimension_index_values(
relabel: bool, optional
If True and ``combine_segments`` is ``True``, the output segment
numbers are relabelled into the range ``0`` to
``len(segment_numbers)`` (inclusive) accoring to the position of
``len(segment_numbers)`` (inclusive) according to the position of
the original segment numbers in ``segment_numbers`` parameter. If
``combine_segments`` is ``False``, this has no effect.
Expand Down Expand Up @@ -1613,9 +1613,11 @@ def __init__(
CoordinateSystemNames.SLIDE
):
index_values = [
np.where(
(dimension_position_values[idx] == pos)
)[0][0] + 1
int(
np.where(
(dimension_position_values[idx] == pos)
)[0][0] + 1
)
for idx, pos in enumerate(
plane_position_values[j]
)
Expand All @@ -1626,11 +1628,12 @@ def __init__(
# Sequence points to (Image Position Patient) has a
# value multiplicity greater than one.
index_values = [
np.where(
(dimension_position_values[idx] == pos).all(
axis=1
)
)[0][0] + 1
int(
np.where(
(dimension_position_values[idx] == pos)
.all(axis=1)
)[0][0] + 1
)
for idx, pos in enumerate(
plane_position_values[j]
)
Expand All @@ -1642,7 +1645,7 @@ def __init__(
'dimension index values: {}'.format(j, error)
)
frame_content_item.DimensionIndexValues = (
[segment_number] + index_values
[int(segment_number)] + index_values
)
pffp_item.FrameContentSequence = [frame_content_item]
if has_ref_frame_uid:
Expand Down Expand Up @@ -1697,7 +1700,7 @@ def __init__(
logger.warning('spatial locations not preserved')

identification = Dataset()
identification.ReferencedSegmentNumber = segment_number
identification.ReferencedSegmentNumber = int(segment_number)
pffp_item.SegmentIdentificationSequence = [
identification,
]
Expand Down Expand Up @@ -2638,7 +2641,7 @@ def _get_pixels_by_seg_frame(
relabel: bool
If True and ``combine_segments`` is ``True``, the pixel values in
the output array are relabelled into the range ``0`` to
``len(segment_numbers)`` (inclusive) accoring to the position of
``len(segment_numbers)`` (inclusive) according to the position of
the original segment numbers in ``segment_numbers`` parameter. If
``combine_segments`` is ``False``, this has no effect.
rescale_fractional: bool
Expand Down Expand Up @@ -3010,7 +3013,7 @@ def get_pixels_by_source_instance(
relabel: bool, optional
If True and ``combine_segments`` is ``True``, the pixel values in
the output array are relabelled into the range ``0`` to
``len(segment_numbers)`` (inclusive) accoring to the position of
``len(segment_numbers)`` (inclusive) according to the position of
the original segment numbers in ``segment_numbers`` parameter. If
``combine_segments`` is ``False``, this has no effect.
ignore_spatial_locations: bool, optional
Expand Down Expand Up @@ -3229,7 +3232,7 @@ def get_pixels_by_source_frame(
relabel: bool, optional
If True and ``combine_segments`` is ``True``, the pixel values in
the output array are relabelled into the range ``0`` to
``len(segment_numbers)`` (inclusive) accoring to the position of
``len(segment_numbers)`` (inclusive) according to the position of
the original segment numbers in ``segment_numbers`` parameter. If
``combine_segments`` is ``False``, this has no effect.
ignore_spatial_locations: bool, optional
Expand Down Expand Up @@ -3494,7 +3497,7 @@ def get_pixels_by_dimension_index_values(
relabel: bool, optional
If True and ``combine_segments`` is ``True``, the pixel values in
the output array are relabelled into the range ``0`` to
``len(segment_numbers)`` (inclusive) accoring to the position of
``len(segment_numbers)`` (inclusive) according to the position of
the original segment numbers in ``segment_numbers`` parameter. If
``combine_segments`` is ``False``, this has no effect.
assert_missing_frames_are_empty: bool, optional
Expand Down
2 changes: 1 addition & 1 deletion src/highdicom/sr/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
"""Package for creationg of Structured Report (SR) instances."""
"""Package for creation of Structured Report (SR) instances."""
from highdicom.sr.coding import CodedConcept
from highdicom.sr.content import (
FindingSite,
Expand Down
8 changes: 4 additions & 4 deletions src/highdicom/sr/sop.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ def __init__(
performed_procedure_codes: Union[List[highdicom.sr.CodedConcept], None], optional
Codes of the performed procedures that resulted in the SR document
requested_procedures: Union[List[pydicom.dataset.Dataset], None], optional
Requested procedures that are being fullfilled by creation of the
Requested procedures that are being fulfilled by creation of the
SR document
previous_versions: Union[List[pydicom.dataset.Dataset], None], optional
Instances representing previous versions of the SR document
Expand Down Expand Up @@ -432,7 +432,7 @@ def __init__(
performed_procedure_codes: Union[List[highdicom.sr.CodedConcept], None], optional
Codes of the performed procedures that resulted in the SR document
requested_procedures: Union[List[pydicom.dataset.Dataset], None], optional
Requested procedures that are being fullfilled by creation of the
Requested procedures that are being fulfilled by creation of the
SR document
previous_versions: Union[List[pydicom.dataset.Dataset], None], optional
Instances representing previous versions of the SR document
Expand Down Expand Up @@ -563,7 +563,7 @@ def __init__(
performed_procedure_codes: Union[List[highdicom.sr.CodedConcept], None], optional
Codes of the performed procedures that resulted in the SR document
requested_procedures: Union[List[pydicom.dataset.Dataset], None], optional
Requested procedures that are being fullfilled by creation of the
Requested procedures that are being fulfilled by creation of the
SR document
previous_versions: Union[List[pydicom.dataset.Dataset], None], optional
Instances representing previous versions of the SR document
Expand Down Expand Up @@ -725,7 +725,7 @@ def __init__(
performed_procedure_codes: Union[List[highdicom.sr.CodedConcept], None], optional
Codes of the performed procedures that resulted in the SR document
requested_procedures: Union[List[pydicom.dataset.Dataset], None], optional
Requested procedures that are being fullfilled by creation of the
Requested procedures that are being fulfilled by creation of the
SR document
previous_versions: Union[List[pydicom.dataset.Dataset], None], optional
Instances representing previous versions of the SR document
Expand Down
4 changes: 2 additions & 2 deletions src/highdicom/sr/templates.py
Original file line number Diff line number Diff line change
Expand Up @@ -2350,7 +2350,7 @@ def __init__(
"General Region of Interest Measurement Modifiers"
for options)
finding_sites: Union[Sequence[highdicom.sr.FindingSite], None], optional
Coded description of one or more anatomic locations corresonding
Coded description of one or more anatomic locations corresponding
to the image region from which measurement was taken
method: Union[highdicom.sr.CodedConcept, pydicom.sr.coding.Code, None], optional
Measurement method (see
Expand Down Expand Up @@ -3274,7 +3274,7 @@ def __init__(
algorithm_id: Union[highdicom.sr.AlgorithmIdentification, None], optional
Identification of algorithm used for making measurements
finding_sites: Union[Sequence[highdicom.sr.FindingSite], None], optional
Coded description of one or more anatomic locations corresonding
Coded description of one or more anatomic locations corresponding
to the image region from which measurement was taken
session: Union[str, None], optional
Description of the session
Expand Down
6 changes: 3 additions & 3 deletions src/highdicom/sr/value_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -1458,7 +1458,7 @@ def __init__(
Number of frame(s) to which the reference applies in case of a
multi-frame image
referenced_segment_numbers: Union[int, Sequence[int], None], optional
Number of segment(s) to which the refernce applies in case of a
Number of segment(s) to which the reference applies in case of a
segmentation image
relationship_type: Union[highdicom.sr.RelationshipTypeValues, str, None], optional
Type of relationship with parent content item
Expand Down Expand Up @@ -1702,7 +1702,7 @@ class Scoord3DContentItem(ContentItem):
Note
----
Spatial coordinates are defined in the patient or specimen-based coordinate
system and have milimeter unit.
system and have millimeter unit.
"""

Expand Down Expand Up @@ -1955,7 +1955,7 @@ def __init__(
referenced_waveform_channels: Union[Sequence[Tuple[int, int]], None], optional
Pairs of waveform number (number of item in the Waveform Sequence)
and channel definition number (number of item in the Channel
Defition Sequence) to which the reference applies in case of a
Definition Sequence) to which the reference applies in case of a
multi-channel waveform
relationship_type: Union[highdicom.sr.RelationshipTypeValues, str, None], optional
Type of relationship with parent content item
Expand Down
4 changes: 2 additions & 2 deletions src/highdicom/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ def compute_plane_position_tiled_full(
Returns
-------
highdicom.PlanePositionSequence
Positon of the plane in the slide coordinate system
Position, of the plane in the slide coordinate system
Raises
------
Expand Down Expand Up @@ -262,7 +262,7 @@ def _compute_plane_position_tiled_full_efficiently(
Returns
-------
highdicom.PlanePositionSequence
Positon of the plane in the slide coordinate system
Position, of the plane in the slide coordinate system
"""
row_offset_frame = ((row_index - 1) * rows)
Expand Down
4 changes: 2 additions & 2 deletions tests/test_ko.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,8 @@ def test_construction(self):
container = content[0]
assert isinstance(container, ContainerContentItem)
assert container.ContentTemplateSequence[0].TemplateIdentifier == '2010'
# Oberver Context (Person): 2
# Oberver Context (Device): 3
# Observer Context (Person): 2
# Observer Context (Device): 3
# Description: 1
# Referenced Objects: 4
assert len(container.ContentSequence) == 10
Expand Down

0 comments on commit aa94489

Please sign in to comment.