def anonymize_root_folder(in_root: Path_Str, out_root: Path_Str, **kwargs):
    'The fuction will get all nested folders from `in_root`\n    and perform anonymization of all folders containg dicom-files\n    Will recreate the `in_root` folders structure in the `out_root`\n\n    Args:\n        in_root (Path_Str): source root folder (presumably has\n        some dicom-files inide, maybe nested)\n        out_root (Path_Str): destination root folder, will create\n        if not exists\n    '
    in_root = to_Path(in_root)
    try_valid_dir(in_root)
    out_root = to_Path(out_root)
    out_root.mkdir(parents=True, exist_ok=True)
    in_dirs = get_dirs(in_root)
    state = AnonState(_STATE_PATH)
    state.init_state()
    state.load_state()

    def get_tags_callback(dataset: pydicom.Dataset):
        state.tag_counter.update(dataset.dir())
    logger.info('Processed paths will be added to the cache, if cache exist and has some paths included, they will be skipped')
    logger.info(f'if, you need to process data again delete files {_STATE_PATH}, please')
    try:
        for in_d in in_dirs:
            rel_path = in_d.relative_to(in_root)
            if (str(rel_path) in state.visited_folders):
                logger.info(f'{in_d} path is in cache, skipping')
                continue
            else:
                out_d = (out_root / rel_path)
                anonymize_dicom_folder(in_d, out_d, ds_callback=get_tags_callback, **kwargs)
                state.visited_folders[str(rel_path)] = True
    except Exception as e:
        raise e
    finally:
        prev_state = AnonState(_STATE_PATH)
        prev_state.init_state()
        prev_state.load_state()
        new_tags = set(state.tag_counter.keys()).difference(prev_state.tag_counter.keys())
        if new_tags:
            logger.warning(f'During the anonymization new tags: {new_tags} were present')
        else:
            logger.info('No new tags werer present')
        state.save_state()
The fuction will get all nested folders from `in_root`
and perform anonymization of all folders containg dicom-files
Will recreate the `in_root` folders structure in the `out_root`

Args:
    in_root (Path_Str): source root folder (presumably has
    some dicom-files inide, maybe nested)
    out_root (Path_Str): destination root folder, will create
    if not exists
def anonymize_root_folder(in_root: Path_Str, out_root: Path_Str, **kwargs):
    'The fuction will get all nested folders from `in_root`\n    and perform anonymization of all folders containg dicom-files\n    Will recreate the `in_root` folders structure in the `out_root`\n\n    Args:\n        in_root (Path_Str): source root folder (presumably has\n        some dicom-files inide, maybe nested)\n        out_root (Path_Str): destination root folder, will create\n        if not exists\n    '
    in_root = to_Path(in_root)
    try_valid_dir(in_root)
    out_root = to_Path(out_root)
    out_root.mkdir(parents=True, exist_ok=True)
    in_dirs = get_dirs(in_root)
    state = AnonState(_STATE_PATH)
    state.init_state()
    state.load_state()

    def get_tags_callback(dataset: pydicom.Dataset):
        state.tag_counter.update(dataset.dir())
    logger.info('Processed paths will be added to the cache, if cache exist and has some paths included, they will be skipped')
    logger.info(f'if, you need to process data again delete files {_STATE_PATH}, please')
    try:
        for in_d in in_dirs:
            rel_path = in_d.relative_to(in_root)
            if (str(rel_path) in state.visited_folders):
                logger.info(f'{in_d} path is in cache, skipping')
                continue
            else:
                out_d = (out_root / rel_path)
                anonymize_dicom_folder(in_d, out_d, ds_callback=get_tags_callback, **kwargs)
                state.visited_folders[str(rel_path)] = True
    except Exception as e:
        raise e
    finally:
        prev_state = AnonState(_STATE_PATH)
        prev_state.init_state()
        prev_state.load_state()
        new_tags = set(state.tag_counter.keys()).difference(prev_state.tag_counter.keys())
        if new_tags:
            logger.warning(f'During the anonymization new tags: {new_tags} were present')
        else:
            logger.info('No new tags werer present')
        state.save_state()