Ejemplo n.º 1
0
def add_graphic_layer(dicom, layer_name, layer_description, layer_order):
    ds_graphic_layer = Dataset()
    ds_graphic_layer.GraphicLayer = layer_name
    ds_graphic_layer.GraphicLayerOrder = layer_order
    ds_graphic_layer.GraphicLayerRecommendedDisplayGrayscaleValue = 65535
    ds_graphic_layer.GraphicLayerDescription = layer_description
    if dicom.get("GraphicLayers"):
        dicom.GraphicLayers.append(ds_graphic_layer)
    else:
        dicom.GraphicLayers = Sequence([ds_graphic_layer])
Ejemplo n.º 2
0
def get_graphic_annotation(sop_class, sop_instance_uid, layer_name,
                           graphic_objects, text_objects):
    ds_graphic_annotation = Dataset()
    referenced_sequence_dataset = Dataset()
    referenced_sequence_dataset.ReferencedSOPClassUID = sop_class
    referenced_sequence_dataset.ReferencedSOPInstanceUID = sop_instance_uid
    ds_graphic_annotation.ReferencedImageSequence = Sequence(
        [referenced_sequence_dataset])
    ds_graphic_annotation.GraphicLayer = layer_name
    if graphic_objects is not None and len(graphic_objects) > 0:
        ds_graphic_annotation.GraphicObjects = Sequence(graphic_objects)
    if text_objects is not None and len(text_objects) > 0:
        ds_graphic_annotation.TextObjects = Sequence(text_objects)
    return ds_graphic_annotation