处理DICOM标记并执行替换——PF*系列的一部分。

pfdicom-tagSub的Python项目详细描述


https://badge.fury.io/py/pfdicom_tagSub.svghttps://travis-ci.org/FNNDSC/pfdicom_tagSub.svg?branch=masterhttps://img.shields.io/badge/python-3.5%2B-blue.svg

Quick Overview

  • pfdicom_tagSub读取/编辑/保存DICOM元信息。它可以用来匿名化DICOM头数据。

Overview

pfdicom_tagSub用json结构中传递的值替换dicom头中的一组<tag, value>对。

脚本接受一个<inputDir>,然后从这一点开始,执行一个os.walk()来提取所有的subdir。检查每个subdir中是否有dicom文件(最简单地说是通过文件扩展名映射)被传递给一个处理方法,该方法读取并替换指定的dicom标记,并将结果保存到输出树中相应的目录和文件名中。

Installation

Dependencies

以下依赖项安装在主机系统/python3 virtual env上(如果从pypi中提取,它们也将自动安装):

  • pfmisc(pf*对象系列的各种杂项模块和类)
  • pftree(创建文件系统层次结构的字典表示)
  • pfdicom(处理底层dicom文件读取)

Using ^{tt1}$

安装此脚本及其所有依赖项的最佳方法是 从pypi获取它

pip3 install pfdicom_tagSub

Command line arguments

-I|--inputDir <inputDir>
Input DICOM directory to examine. By default, the first file in this
directory is examined for its tag information. There is an implicit
assumption that each <inputDir> contains a single DICOM series.

-i|--inputFile <inputFile>
An optional <inputFile> specified relative to the <inputDir>. If
specified, then do not perform a directory walk, but convert only
this file.

-e|--extension <DICOMextension>
An optional extension to filter the DICOM files of interest from the
<inputDir>.

[-O|--outputDir <outputDir>]
The output root directory that will contain a tree structure identical
to the input directory, and each "leaf" node will contain the analysis
results.

-F|--tagFile <JSONtagFile>
Parse the tags and their "subs" from a JSON formatted <JSONtagFile>.

-T|--tagStruct <JSONtagStructure>
Parse the tags and their "subs" from a JSON formatted <JSONtagStucture>
passed directly in the command line.

-o|--outputFileStem <outputFileStem>
The output file stem to store data. This should *not* have a file
extension, or rather, any "." in the name are considered part of
the stem and are *not* considered extensions.

[--outputLeafDir <outputLeafDirFormat>]
If specified, will apply the <outputLeafDirFormat> to the output
directories containing data. This is useful to blanket describe
final output directories with some descriptive text, such as
'anon' or 'preview'.

This is a formatting spec, so

    --outputLeafDir 'preview-%s'

where %s is the original leaf directory node, will prefix each
final directory containing output with the text 'preview-' which
can be useful in describing some features of the output set.

[--threads <numThreads>]
If specified, break the innermost analysis loop into <numThreads>
threads.

[-x|--man]
Show full help.

[-y|--synopsis]
Show brief help.

[--json]
If specified, output a JSON dump of final return.

[--followLinks]
If specified, follow symbolic links.

-v|--verbosity <level>
Set the app verbosity level.

    0: No internal output;
    1: Run start / stop output notification;
    2: As with level '1' but with simpleProgress bar in 'pftree';
    3: As with level '2' but with list of input dirs/files in 'pftree';
    5: As with level '3' but with explicit file logging for
            - read
            - analyze
            - write

Examples

通过处理特定标记执行DICOM匿名化:

pfdicom_tagSub                                      \\
    -I /var/www/html/normsmall -e dcm               \\
    -O /var/www/html/anon                           \\
    --tagStruct '
    {
        "PatientName":              "anonymized",
        "PatientID":                "%_md5|7_PatientID",
        "AccessionNumber":          "%_md5|10_AccessionNumber",
        "PatientBirthDate":         "%_strmsk|******01_PatientBirthDate",
        "ReferringPhysicianName":   "ReferringPhysicianName",
        "PhysiciansOfRecord":       "PhysiciansOfRecord",
        "RequestingPhysician":      "RequestingPhysician",
        "InstitutionAddress":       "InstitutionAddress",
        "InstitutionName":          "InstitutionName"
    }
    ' --threads 0 --printElapsedTime

它只在脚本结束时输出,并记录json格式的字符串。

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
java JList侦听器找不到符号   多点触摸跨平台java应用程序(Windows、Mac和Linux(Ubuntu)(可能是Android))   在UnitTest中找不到java类加载器资源   java当我尝试在Eclipse中运行我的minecraft mod时,我总是遇到这个错误,这是什么意思?   内部有一个同步块的静态方法,在java中阻止整个类?   不支持java操作:具有BillableStatus的费用在采购中应具有AccountBasedExpenseLineDetail行的CustomerRef   java运行时常量池GC集合   java无法解析配置“:app:\u debugApk”的所有依赖项。找不到名为“default”的配置   在GCP计算引擎中托管Neo4j的java   java如何从BroadcastReceiver更新片段选项卡?   线程“main”组织中的java异常。冬眠注释异常:@org。冬眠注释。表引用未知表:ProductForPractice   在Java/Groovy中嵌入处理   java Android REST教程/示例项目   java我可以在同一测试中在一个模拟器上启动应用程序,在另一个模拟器上启动移动浏览器吗?   java如何更改通知横幅的方向?   安卓 Java帮助实现Firebase授权   if else之后的rs.next()中出现java错误?