处理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 Admob不使用webview   Java Wicket表单:序列化对象类“myClassName”时出错   java googledriveapi更新文件与我的帐户管理员   java简单框架未知xml标记解析   java如何使用主类和用户获取Spark应用程序ID   java如何更改自定义属性的值?   java有没有办法在jMock中找到未使用的期望值?   gradle运行任务的java文档?   java通过使用数组来存储文本文件的行,通过覆盖来删除文本文件中的行   用于表达式语言注入的java利用负载   java IDEStyle程序运行   java在运行时启用/禁用Springws   爪哇芦苇。formatNumber NullPointException   java为什么我的代码无法检测两个动态实体之间的碰撞?