Skip to content

Commit 4f54f20

Browse files
committed
fix(dicom): Don't try to get information on non-existent PixelData
This commit makes it so that we only look for information about the format of a DICOM's PixelData if it actually has such data, whereas before we looked for it for any DICOM that wasn't a contour series. That test was insufficient and broke information-only DICOM modalities like PR. Fixes Trac#9437
1 parent 65af121 commit 4f54f20

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

src/bundles/dicom/src/dicom_hierarchy.py

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -520,7 +520,7 @@ def __init__(
520520
rsi = int(rsi)
521521
self.rescale_intercept = rsi
522522
self.rescale_slope = int(self.dicom_series.rescale_slope)
523-
if not self.contour_series:
523+
if self.image_series and not self.contour_series:
524524
bits = self.sample_file.get("BitsAllocated")
525525
rep = self.sample_file.get("PixelRepresentation")
526526
self.value_type = self.numpy_value_type(
@@ -663,6 +663,18 @@ def to_models(self, open_models, derived, sgrids):
663663
"be available." % (self.number, self.patient_id)
664664
)
665665

666+
@property
667+
def number(self):
668+
if self.sample_file.get("SeriesNumber", None) is None:
669+
self.session.logger.warning("SeriesNumber not specified; setting to 0")
670+
return 0
671+
else:
672+
return int(self.sample_file.get("SeriesNumber", 0))
673+
674+
@property
675+
def patient_id(self):
676+
return self.sample_file.get("PatientID", "")
677+
666678
@property
667679
def columns(self):
668680
return self.sample_file.get("Columns")

0 commit comments

Comments
 (0)