Skip to content

Commit

Permalink
Fix warnings on writing annotations
Browse files Browse the repository at this point in the history
  • Loading branch information
erikogabrielsson committed Oct 21, 2024
1 parent 9b53f09 commit 0f33d6c
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions wsidicom/graphical_annotations.py
Original file line number Diff line number Diff line change
Expand Up @@ -1144,9 +1144,9 @@ def _create_measurement_value_sequence(
# annotation has one and only one measurement.
if not self._measurements_is_one_to_one(code, unit):
indices = self.create_measurement_indices(code, unit)
measurements_ds.AnnotationIndexList = indices
measurements_ds.AnnotationIndexList = indices.tobytes()
values = self._create_measurement_values(code, unit)
measurements_ds.FloatingPointValues = values
measurements_ds.FloatingPointValues = values.tobytes()
measurement_value_sequence = DicomSequence([measurements_ds])
return measurement_value_sequence

Expand Down Expand Up @@ -1234,9 +1234,9 @@ def _set_coordinates_data_in_ds(self, ds: Dataset) -> Dataset:
The Annotation Group Sequence with inserted coordinates.
"""
if self._is_double:
ds.DoublePointCoordinatesData = self.point_coordinates_data
ds.DoublePointCoordinatesData = self.point_coordinates_data.tobytes()
else:
ds.PointCoordinatesData = self.point_coordinates_data
ds.PointCoordinatesData = self.point_coordinates_data.tobytes()
return ds

def _set_measurement_sequence_in_ds(self, ds: Dataset) -> Dataset:
Expand Down Expand Up @@ -1282,6 +1282,7 @@ def to_ds(self, group_number: int) -> Dataset:
ds.AnnotationGroupLabel = self.label
if self.description is not None:
ds.AnnotationGroupDescription = self.description

ds = self.category_code.insert_into_ds(ds)
ds = self.type_code.insert_into_ds(ds)
ds = self._set_coordinates_data_in_ds(ds)
Expand Down Expand Up @@ -1493,7 +1494,7 @@ def to_ds(self, group_number: int) -> Dataset:
Dataset containing the group.
"""
ds = super().to_ds(group_number)
ds.LongPrimitivePointIndexList = self.point_index_list
ds.LongPrimitivePointIndexList = self.point_index_list.tobytes()
return ds


Expand Down

0 comments on commit 0f33d6c

Please sign in to comment.