How to use the deid.config.load_deid function in deid

To help you get started, we’ve selected a few deid examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github pydicom / deid / deid / main.py View on Github external
sys.exit(0)
        
    # Initialize the message bot, with level above
    from deid.logger import bot
    from deid.dicom import get_files
    from deid.data import get_dataset  

    output_folder = args.outfolder
    if output_folder is None:
        if args.do_print is False:
            output_folder = tempfile.mkdtemp()

    # If a deid is given, check against format
    if args.deid is not None:
        from deid.config import load_deid
        params = load_deid(args.deid)
        if params['format'] != args.format:
            bot.error("Format in deid (%s) doesn't match choice here (%s) exiting." %(params['format'],
                                                                                      args.format))

    # Get list of dicom files
    base = args.folder
    if base is None:
        bot.info("No input folder specified, will use demo dicom-cookies.")
        base = get_dataset('dicom-cookies')
    basename = os.path.basename(base)
    dicom_files = get_files(base)

    # Does the user want to inspect files?
    if args.action == "inspect":
        from deid.dicom import has_burned_pixels
        has_burned_pixels(dicom_files)
github pydicom / deid / deid / main / identifiers.py View on Github external
def main(args, parser):

    # Global output folder
    output_folder = args.outfolder
    if output_folder is None:
        output_folder = tempfile.mkdtemp()

    # If a deid is given, check against format
    if args.deid is not None:
        params = load_deid(args.deid)
        if params["format"] != args.format:
            bot.error(
                "Format in deid (%s) doesn't match choice here (%s) exiting."
                % (params["format"], args.format)
            )
    # Get list of dicom files
    base = args.input
    if base is None:
        bot.info("No input folder specified, will use demo dicom-cookies.")
        base = get_dataset("dicom-cookies")
    basename = os.path.basename(base)
    dicom_files = list(get_files(base))  # todo : consider using generator functionality

    do_get = False
    do_put = False
    ids = None
github pydicom / deid / deid / main / inspect.py View on Github external
def main(args, parser):
    """inspect currently serves to inspect the header fields of a set
       of dicom files against a standard, and flag images that don't
       pass the different levels of criteria
    """

    # If a deid is given, check against format
    deid = args.deid
    if deid is not None:
        params = load_deid(deid)
        if params["format"] != args.format:
            bot.error(
                "Format in deid (%s) doesn't match choice here (%s) exiting."
                % (params["format"], args.format)
            )
    # Get list of dicom files
    base = args.folder
    if base is None:
        bot.info("No input folder specified, will use demo dicom-cookies.")
        base = get_dataset("dicom-cookies")

    dicom_files = list(
        get_files(base, pattern=args.pattern)
    )  # todo : consider using generator functionality
    result = has_burned_pixels(dicom_files, deid=deid)