提取DICOM头信息——PF*系列的一部分。

pfdicom-tagExtract的Python项目详细描述


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

Quick Overview

  • pfdicom_tagExtract基于解析dicom元数据(即dicom标记)生成各种格式的报告(txt、html等)。

Overview

pfdicom_tagExtract提取dicom文件的头信息,并回显到stdout和输出报告类型文件–这可以是原始输出、json类型输出或html类型输出。

脚本接受一个<inputDir>,然后从这一点开始执行递归的os.walk(),以探测包含要处理的文件的所有subdir。检查每个subdir中的dicom文件(最简单的说是通过文件扩展名映射),检查头、尾、中间(或其他索引)文件中的标记信息。

可选地,可以通过传递包含要查询的标记的逐行列表的<tagFile>来约束标记列表,也可以通过直接传递用逗号分隔的标记列表来约束标记列表。

最后,还可以执行图像转换(如果指定了html转换,则嵌入到输出html文件中)。

Installation

Dependencies

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

  • pfmisc(pf*对象系列的各种杂项模块和类)
  • pftree(创建文件系统层次结构的字典表示)
  • pfdicom(处理底层dicom文件读取)
  • matplotlib(处理保存/转换为HTML报表的图像格式)

Using ^{tt1}$

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

pip3 install pfdicom_tagExtract

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 directory to contain all output files.

[--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.

-F|--tagFile <tagFile>
Read the tags, one-per-line in <tagFile>, and print the
corresponding tag information in the DICOM <inputFile>.

-T|--tagList <tagList>
Read the list of comma-separated tags in <tagList>, and print the
corresponding tag information parsed from the DICOM <inputFile>.

-m|--image <[<index>:]imageFile>
If specified, also convert the <inputFile> to <imageFile>. If the
name is preceded by an index and colon, then convert this indexed
file in the particular <inputDir>.

[-s|--imageScale <factor:interpolation>]
If an image conversion is specified, this flag will scale the image
by <factor> and use an interpolation <order>. This is useful in
increasing the size of images for the html output.

Note that certain interpolation choices can result in a significant
slowdown!

    interpolation order:

    'none', 'nearest', 'bilinear', 'bicubic', 'spline16',
    'spline36', 'hanning', 'hamming', 'hermite', 'kaiser', 'quadric',
    'catrom', 'gaussian', 'bessel', 'mitchell', 'sinc', 'lanczos'

-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.

[-t|--outputFileType <outputFileType>]
A comma specified list of output types. These can be:

    o <type><ext><desc>
    o raw       -raw.txt    the raw internal dcm structure to string
    o json      .json       a json representation
    o html      .html       an html representation with optional image
    o dict      -dict.txt   a python dictionary
    o col       -col.txt    a two-column text representation (tab sep)
    o csv       .csv        a csv representation

Note that if not specified, a default type of 'raw' is assigned.

[-p|--printToScreen]
If specified, will print tags to screen.

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

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

[--version]
If specified, print the version number and exit.

[--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

在目标树上运行并输出一些详细信息和统计信息

pfdicom_tagExtract                                      \
            -I /var/www/html/normsmall -e dcm           \
            -O /var/www/html/tag                        \
            -o '%_md5|6_PatientID-%PatientAge'\
            -m 'm:%_nospc|-_ProtocolName.jpg'\
            -s 3:none                                   \
            --useIndexhtml                              \
            -t raw,json,html,dict,col,csv               \
            --threads 0 -v 0 --json

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

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

推荐PyPI第三方库


热门话题
java如何在构造函数外部添加鼠标侦听器   java如何使用比较器对列表进行排序以正确排序空值?   javajavax。由于javax,邮件“535.7.3身份验证失败”。邮件升级(v1.3.1至v1.5.2)   java将arraylist流到固定的二维数组中并打印?   RecyclerView适配器上的java上下文   java如何为此Twitter API为KafkaProducer建立连接   java Spring安全性重写WebSecurity配置适配器的配置(AuthenticationManagerBuilder)是否会影响全局应用程序?   线程“awteventque0”NullPointerException中的java异常   if条件中的null值和null指针异常java   java树集<Object>允许相同类型的多个对象   java定义类;我认不出   字符串java replaceAll()   JAVAutil。scanner(Java)读取文件时如何跳过空格?   java在swing中关闭flash屏幕   java在Wildfly 16中的应用程序中加载pk12文件   有没有工具可以自动生成屏幕抓取的Java代码   创建意图时,java方法getParcelableExtra()返回null   将数据从java传递到jsp   java Android Studio |永久保存布局