Skip to content

Commit

Permalink
Style fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
CPBridge committed Jan 30, 2024
1 parent 82d8fd3 commit 0f173e4
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 17 deletions.
29 changes: 15 additions & 14 deletions src/highdicom/seg/sop.py
Original file line number Diff line number Diff line change
Expand Up @@ -1191,7 +1191,9 @@ def __init__(
tile_size: Union[Sequence[int], None] = None,
pyramid_uid: Optional[str] = None,
pyramid_label: Optional[str] = None,
palette_color_lut_transformation: Optional[PaletteColorLUTTransformation] = None,
palette_color_lut_transformation: Optional[
PaletteColorLUTTransformation
] = None,
icc_profile: Optional[bytes] = None,
**kwargs: Any
) -> None:
Expand Down Expand Up @@ -1718,8 +1720,8 @@ def __init__(
PaletteColorLUTTransformation
):
raise TypeError(
'Argument "palette_color_lut_transformation" must be of type '
'PaletteColorLUTTransformation.'
'Argument "palette_color_lut_transformation" must be '
'of type highdicom.PaletteColorLUTTransformation.'
)

lut = palette_color_lut_transformation.red_lut
Expand Down Expand Up @@ -2180,16 +2182,13 @@ def __init__(
# Even though completely empty planes were removed earlier,
# there may still be planes in which this specific segment is
# absent. Such frames should be removed
if (
segment_number is not None
and omit_empty_frames
and not np.any(segment_array)
):
logger.debug(
f'skip empty plane {plane_index} of segment '
f'#{segment_number}'
)
continue
if segment_number is not None:
if omit_empty_frames and not np.any(segment_array):
logger.debug(
f'skip empty plane {plane_index} of segment '
f'#{segment_number}'
)
continue

# Log a debug message
if segment_number is None:
Expand Down Expand Up @@ -3506,7 +3505,9 @@ def _build_luts(self) -> None:
n_expected_dim_ind_pointers = len(self._dim_ind_pointers)
else:
# (+1 because referenced segment number is ignored)
n_expected_dim_ind_pointers = len(self._dim_ind_pointers) + 1
n_expected_dim_ind_pointers = (
len(self._dim_ind_pointers) + 1
)
if len(indices) != n_expected_dim_ind_pointers:
raise RuntimeError(
'Unexpected mismatch between dimension index values in '
Expand Down
6 changes: 5 additions & 1 deletion src/highdicom/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,11 @@ def compute_plane_position_tiled_full(

def iter_tiled_full_frame_data(
dataset: Dataset,
) -> Generator[Tuple[Union[int, None], int, int, int, float, float, float], None, None]:
) -> Generator[
Tuple[Union[int, None], int, int, int, float, float, float],
None,
None,
]:
"""Get data on the position of each tile in a TILED_FULL image.
This works only with images with Dimension Organization Type of
Expand Down
7 changes: 5 additions & 2 deletions tests/test_seg.py
Original file line number Diff line number Diff line change
Expand Up @@ -822,8 +822,11 @@ def check_dimension_index_vals(seg):
# DimensionIndexValues has VM=1 in this case so returns int
posn_index = f.FrameContentSequence[0].DimensionIndexValues
else:
# DimensionIndexValues has VM>1 in this case so returns list
posn_index = f.FrameContentSequence[0].DimensionIndexValues[1]
# DimensionIndexValues has VM>1 in this case so returns
# list
posn_index = (
f.FrameContentSequence[0].DimensionIndexValues[1]
)
# This is not general, but all the tests run here use axial
# images so just check the z coordinate
posn_val = f.PlanePositionSequence[0].ImagePositionPatient[2]
Expand Down

0 comments on commit 0f173e4

Please sign in to comment.