source/dcm_transform.py
def assign_custom_tags(dataset, args):
    """ Given a dataset and the args key, val pair array  arguments set custom tags"""
    # assign custom tags
    if args == '':
        return
    try:
        tags_len = len(args)
        if tags_len > 1:
            print()
        for i in range(0, int(tags_len / 2) * 2, 2):
            print("Setting tag " + args[i] + " to " + args[i + 1] + ' ... ')
            try:
                data_element = dataset.data_element(args[i])
            except KeyError:
                # OK, maybe user wants a tag that is in file_meta metadata structure
                # so give it a second chance:
                data_element = dataset.file_meta.data_element(args[i])

            if data_element is None:
                print("  Could not find that tag, value won't be set ...")
            else:
                try:
                    data_element.value = args[i + 1]
                except Exception:
                    print("  Could not set that tag value  <" + args[i + 1] +
                          ">, value will not be set ...")

        if tags_len % 2 != 0:
            print("  Warning: list of pair of <tags value> expected, " +
                  "but odd count was found instead, " +
                  "found ending: <" + args[tags_len - 1] + '>')
    except Exception as exc:
        print(exc)
 Given a dataset and the args key, val pair array  arguments set custom tags
Given a dataset and the args key, val pair array  arguments set custom tags
Given a dataset and the args key val pair array arguments set custom tags
def assign_custom_tags(dataset, args):
    if args == '':
        return
    try:
        tags_len = len(args)
        if tags_len > 1:
            print()
        for i in range(0, int(tags_len / 2) * 2, 2):
            print("Setting tag " + args[i] + " to " + args[i + 1] + ' ... ')
            try:
                data_element = dataset.data_element(args[i])
            except KeyError:
                data_element = dataset.file_meta.data_element(args[i])
            if data_element is None:
                print("  Could not find that tag, value won't be set ...")
            else:
                try:
                    data_element.value = args[i + 1]
                except Exception:
                    print("  Could not set that tag value  <" + args[i + 1] +
                          ">, value will not be set ...")
        if tags_len % 2 != 0:
            print("  Warning: list of pair of <tags value> expected, " +
                  "but odd count was found instead, " +
                  "found ending: <" + args[tags_len - 1] + '>')
    except Exception as exc:
        print(exc)
def assign_custom_tags ( dataset , args ) : if args == '' : return try : tags_len = len ( args ) if tags_len > 1 : print ( ) for i in range ( 0 , int ( tags_len / 2 ) * 2 , 2 ) : print ( "Setting tag " + args [ i ] + " to " + args [ i + 1 ] + ' ... ' ) try : data_element = dataset . data_element ( args [ i ] ) except KeyError : data_element = dataset . file_meta . data_element ( args [ i ] ) if data_element is None : print ( "  Could not find that tag, value won't be set ..." ) else : try : data_element . value = args [ i + 1 ] except Exception : print ( "  Could not set that tag value  <" + args [ i + 1 ] + ">, value will not be set ..." ) if tags_len % 2 != 0 : print ( "  Warning: list of pair of <tags value> expected, " + "but odd count was found instead, " + "found ending: <" + args [ tags_len - 1 ] + '>' ) except Exception as exc : print ( exc )
Given a dataset and the args key, val pair array  arguments set custom tags
Given a dataset and the args key val pair array arguments set custom tags
""" Given a dataset and the args key, val pair array  arguments set custom tags""" # assign custom tags # OK, maybe user wants a tag that is in file_meta metadata structure # so give it a second chance:
dataset
args