Closed a-parida12 closed 3 years ago
Thanks @a-parida12 for your interest in the library and for reporting the issue.
The Slice Thickness and Pixel Spacing attributes are required for creation of a Segmentation instance (see Pixel Measures Macro Attributes).
Interestingly, the Pixel Spacing attribute has type 1C in case of a Diagnostic X-Ray Image (see Basic Pixel Spacing Calibration Macro Attributes) and I am not sure whether Slice Thickness may be present.
You can provide this information to the constructor of highdicom.seg.Segmentation
using the pixel_measures
parameter (see highdicom.seg.Segmentation).
The Study ID attribute is type 2, so it should be present in the source image even if it does not have a value. You could just patch the source_image
prior to passing it to highdicom.seg.Segmentation
:
source_image.StudyID = None
pixel_measures = PixelMeasuresSequence(
pixel_spacing=...,
slice_thickness=...,
)
seg_dataset = Segmentation(
source_images=[source_image],
pixel_array=np.uint16(seg_img),
segmentation_type=SegmentationTypeValues.FRACTIONAL,
segment_descriptions=description_segments,
series_instance_uid=generate_uid(),
sop_instance_uid=generate_uid(),
instance_number=instance_number,
manufacturer="deepc",
manufacturer_model_name=config["NAME"],
software_versions="v"+config["VERSION"],
device_serial_number="Device XYZ",
series_number=2,
fractional_type="OCCUPANCY",
pixel_measures=pixel_measures
)
Closing the issue due to inactivity.
I am trying to save the segmentation of a CXR as a dicomseg.
Even though I am using a proper
DX
dcm. I am getting errors where it says some fields likeStudyID
,SliceThickness
andPixelSpacing
are missing in thesource_image
. Is it possible to skip the missing fields? or is there a better way to handle such scenarios?