pydicom-seg icon indicating copy to clipboard operation
pydicom-seg copied to clipboard

Creating an empty segmentation

Open vsaase opened this issue 4 years ago • 3 comments
trafficstars

Hi,

I would like to create an empty DICOM-SEG from a json file as created with http://qiicr.org/dcmqi/#/seg to then use it as a template for users to fill in the segments. The segmentation dicom file only has to reference the series it applies to, so only a single dicom file from the series would be needed. I tried to use a zero filled NRRD as input to MultiClassWriter, but that raises an error that no segments where found. Just asking before putting effort into an implementation, maybe there is a shortcut in pydicom-seg?

Victor

vsaase avatar Mar 18 '21 14:03 vsaase

Maybe something like this: https://github.com/vsaase/pydicom-seg/tree/empty_seg This usecase is maybe not in the spirit of DICOM (immutability) however, so I understand if you are sceptical.

Not having a segment defined in the DICOM metadata should be treated as conceptually different from not seeing it in the source image and not assigning pixels to it. So I think it should be possible to have empty segments.

vsaase avatar Mar 19 '21 13:03 vsaase

Sorry for the long delay!

I think this is a valid use case and should work out of the box. Especially in automated workflows this would be required where results are generated by a software and allow for non-existing segmentations. If in this case the DICOM can not be created the user/radiologist might think the entire software process has failed.

Two things I am currently concerned about:

  1. Is this still legal DICOM? The standard says Number Of Frames should have a value greater than zero.
  2. I am currently a bit unsure how the reading functionality would be affected. The origin, and extent are derived from information in the PerFrameFunctionalGroupsSequence.

razorx89 avatar Aug 15 '21 08:08 razorx89

Hi, I'm also interested in creating an empty DICOM-SEG, which is essential in many application cases. This functionality still seems to be not provided out of the box after three years since this issue was opened. JSON schema still requires more than one element in segmentAttributes and unique_labels should contain at least one label. @razorx89, your concerns are valid, but maybe you have a working example or suggestions for creating an empty DICOM-SEG while using the current version of pydicom-seg?

bashkanov avatar Mar 27 '24 13:03 bashkanov