main.py 文件源码

python
阅读 27 收藏 0 点赞 0 评论 0

项目:BIDS2ISATab 作者: INCF 项目源码 文件源码
def _get_investigation_template(bids_directory, mri_par_names):
    this_path = os.path.realpath(
        __file__[:-1] if __file__.endswith('.pyc') else __file__)
    template_path = opj(
        *(psplit(this_path)[:-1] + ("i_investigation_template.txt", )))
    investigation_template = open(template_path).read()

    title = psplit(bids_directory)[-1]

    if exists(opj(bids_directory, "dataset_description.json")):
        with open(opj(bids_directory, "dataset_description.json"), "r") \
                as description_dict_fp:
            description_dict = json.load(description_dict_fp)
            if "Name" in description_dict:
                title = description_dict["Name"]

    investigation_template = investigation_template.replace(
        "[TODO: TITLE]", title)
    investigation_template = investigation_template.replace(
        "[TODO: MRI_PAR_NAMES]", ";".join(mri_par_names))
    return investigation_template
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号