Skip to content

seg.get_pixels_by_source_instance -- support search by SOP_INSTANCE_IDS in the case of multiple sources. #386

@nicolay-r

Description

@nicolay-r

Dear highdicom team,

I have the question which relates to searching for particular pixel data (layer) in DICOMSEG file that has Multiple Souces.
In the attached example those sources are: liver, tumor.

...
(0062,0002)  Segment Sequence  2 item(s) ---- 
   (0062,0004) Segment Number                      US: 1
   (0062,0005) Segment Label                       LO: 'Liver'
   ---------
   (0062,0004) Segment Number                      US: 2
   (0062,0005) Segment Label                       LO: 'Tumor-1'
...

Using the following snippet:

seg = hd.seg.segread(buffer)
mask = seg.get_pixels_by_source_instance(
    source_sop_instance_uids=["1.2.826.0.1.3680043.8.274.1.1.2081054905.266506.1768410047.96982"],
    ignore_spatial_locations=True,
    assert_missing_frames_are_empty=True
)

Would result in:

RuntimeError: Indexing via source frames is not permissible since some frames in the image specify multiple source frames.

It works flawlessly in the case when the source is single (seg._single_source_frame_per_frame == 1); but in this case we have two sources.

Question: is there a way to pefrom a search by sop_instance_uids with known source?
(like set liver or tumor in that example)

seg_multisource_example.dicom.zip

Metadata

Metadata

Assignees

Labels

questionFurther information is requested

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions