-
Notifications
You must be signed in to change notification settings - Fork 44
Open
Description
I get the following IntegrityError
, when trying to load the following SEG from the NSCLC-Radiogenomics dataset. Error indicates that there are duplicate SOPInstanceUIDs. However, I went through the DICOM and found no duplicates. I've included the DICOM dump of the SEG aswell.
Version:
highdicom 0.26.0
pydicom 3.0.1
In [5]: ds = dcmread("/NSCLC-Radiogenomics/R01-003/SEG
⋮ _Series-96510/1-1.dcm")
In [6]: seg = hd.seg.Segmentation.from_dataset(ds)
---------------------------------------------------------------------------
IntegrityError Traceback (most recent call last)
Cell In[6], line 1
----> 1 seg = hd.seg.Segmentation.from_dataset(ds)
File ~/bhklab/josh/med-imagetools/.pixi/envs/dev/lib/python3.12/site-packages/highdicom/seg/sop.py:2233, in Segmentation.from_dataset(cls, dataset, copy)
2227 pixel_measures = PixelMeasuresSequence.from_sequence(
2228 pffg_item.PixelMeasuresSequence,
2229 copy=False,
2230 )
2231 pffg_item.PixelMeasuresSequence = pixel_measures
-> 2233 seg = super().from_dataset(seg, copy=False)
2235 return cast(Self, seg)
File ~/bhklab/josh/med-imagetools/.pixi/envs/dev/lib/python3.12/site-packages/highdicom/image.py:1176, in _Image.from_dataset(cls, dataset, copy)
1173 im.__class__ = cls
1174 im = cast(Self, im)
-> 1176 im._build_luts()
1177 return im
File ~/bhklab/josh/med-imagetools/.pixi/envs/dev/lib/python3.12/site-packages/highdicom/image.py:3307, in _Image._build_luts(self)
3302 self._coordinate_system = get_image_coordinate_system(
3303 self
3304 )
3306 if is_multiframe_image(self):
-> 3307 self._build_luts_multiframe()
3308 else:
3309 self._build_luts_single_frame()
File ~/bhklab/josh/med-imagetools/.pixi/envs/dev/lib/python3.12/site-packages/highdicom/image.py:3708, in _Image._build_luts_multiframe(self)
3704 shared_pixel_spacing = None
3706 self._db_con = sqlite3.connect(":memory:")
-> 3708 self._create_ref_instance_table(referenced_uids)
3710 # Construct the columns and values to put into a frame look-up table
3711 # table within sqlite. There will be one row per frame in the
3712 # image
3713 col_defs = [] # SQL column definitions
File ~/bhklab/josh/med-imagetools/.pixi/envs/dev/lib/python3.12/site-packages/highdicom/image.py:4185, in _Image._create_ref_instance_table(self, referenced_uids)
4177 with self._db_con:
4178 self._db_con.execute(
4179 "CREATE TABLE InstanceUIDs("
4180 "StudyInstanceUID VARCHAR NOT NULL, "
(...) 4183 ")"
4184 )
-> 4185 self._db_con.executemany(
4186 "INSERT INTO InstanceUIDs "
4187 "(StudyInstanceUID, SeriesInstanceUID, SOPInstanceUID) "
4188 "VALUES(?, ?, ?)",
4189 referenced_uids,
4190 )
IntegrityError: UNIQUE constraint failed: InstanceUIDs.SOPInstanceUID
CPBridge and fedorov
Metadata
Metadata
Assignees
Labels
No labels