处理dicom树并为rev查看器创建json摘要。

pfdicom-rev的Python项目详细描述


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

Quick Overview

  • pfdicom_rev处理rev查看器的dicom树。

Overview

pfdicom_rev通过将DCM文件转换为JPG预览并生成JSON系列和研究摘要文件,以及每个研究的index.html来处理包含REV查看器DICOM文件的目录。

脚本接受一个<inputDir>,它应该是rev库的(绝对)根目录。在json描述符文件中,所有文件位置都将相对于这个根目录被引用。

pfdicom_rev在下面的[--stage <stage>]标志中定义的文件树空间上执行mulit pass循环。

注意:

  • pfdicom_rev的许多操作都依赖于imagemagick,包括dcm到jpg的转换、jpg的大小调整和预览条的创建。
  • 在某些情况下,ImageMagick的默认限制太低,无法生成预览条带,特别是在给定的dicom系列有许多(超过100个)dicom文件的情况下。一个解决方法是编辑与ImageMagick相关的policy.xml文件,并将图像widthheight说明符设置为100千像素(默认值约为16kP)。
<policydomain="resource"name="width"value="100KP"/><policydomain="resource"name="height"value="100KP"/>

有关详细信息,请参见here

Installation

Dependencies

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

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

Using ^{tt1}$

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

pip3 install pfdicom_rev

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.

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

For ReV, this is often the special directive '%inputDir' which directs
the system to generate all outputs in the input tree directly.

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

[-T|--tagStruct <JSONtagStructure>]
Parse the tags and their "subs" from a JSON formatted <JSONtagStucture>
passed directly in the command line. This is used in the optional
DICOM anonymization.

[-S|--server <server>]
The name of the server hosting the ReV viewer.

Defaults to empty string '' which is interpreted as the current host,
i.e. the host running `pfdicom_rev`. If the actual viewer is hosted
elsewhere, use this flag to specify the *viewer* host.

[--stage <stage>]
Stage to execute -- mostly for debugging purposes and useful if running a
particular stage repeatedly. There are some caveats to this -- mostly that
stages are serially dependent, thus running "--stage 4" off the bat will
not work since previous stages have not completed.

The actual thread of stage flow and dependencies are:



                              /--stage 2
                             /
                    stage 1--
                             \
                              \--stage 3----stage 4


    [1] analyize all the DCM files in the <inputDir>
        *   convert each DCM to JPG (native)
        *   resize all JPGs to  96x96  and generate mosaic preview strip
        *   resize all JPGs to 300x300 and generate DCMtag preview
        *   tag middle JPG in series based on series length
        *   create JSON per example series-level descriptors in each example
            directory:
                * declare location of actual series DCM files
        *   create JSON per month example-level descriptors in each month
            directory:
                * declare location of middle thumbnail JPGs

        In each series directory:
            <YY>-yr/<MM>-mo/<XX>-ex/
                forall(<SERIES>):
                    o dcm2jpgDCMresize/*jpg
                    o dcm2jpgRaw/*jpg
                    o preview.jpg
                    o raw-preview.jpg
                o <SERIES>-series.json
            <YY>-yr/<MM>-mo/
                o ex.json

    [2] analyze all the JSON series-level descriptors from stage [1] and
        in each example directory:
        *   create study-level JSON descriptors that summarize
            all series JSON data into one file
        *   create study-level index.html that directs to the ReV viewer
            with this yr/mo/ex tuple.

        In each study directory:
            <YY>-yr/<MM>-mo/<XX>-ex/
                o description.json
                o index.html

    [3] analyze all the JSON per month example-level descriptors
        from stage [1] and in each month directory:
        *   create overview per-month index.html that shows
            per-example thumbnails

        In each month direcory:
            <YY>-yr/<MM>-mo
            o index.html

    [4] analyze all JSON study level descriptors from stage [2]
        *   create tree map for mapping of arbitrary patient age to
            closest hits in tree

        In the root dir:
            o map.json

[--studyJSON <studyJSONfile>]
The name of the study JSON file.

Defaults to 'description.json'.

[--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_rev                                         \\
            -I /var/www/html/rev                    \\
            -O %inputDir                            \\
            --threads 0 --printElapsedTime          \\
            -v 3

它将运行DCM和JSON分析,打印最终经过的处理时间。

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

推荐PyPI第三方库


热门话题
字符串Java字母替换无效   java Spring Roo JPA MS SQL Server无法打开JPA EntityManager组织。冬眠例外GenericJDBCException:无法打开连接   在scala中使用JavaWS对大型数据文件进行java流式处理   Java编译器是否将字节和短字符识别为文本?   java无法查找符号错误,空指针   mongodb在Java中重用数据库连接   java将多个StringArray从字符串文件获取到活动中   java是一个变量,它只保存最后一次鼠标单击的坐标   c#尺寸有限;添加、删除和洗牌   java如何在Android中显示来自资产文件夹的文本文件中的文本   Android应用程序中的java Tensorflow Lite自定义对象检测模型错误   java如何在foreachloop中使用scanner将来自命令行的输入存储到数组中   java如何定义一个好的存储库接口   Android中的java解析动态json对象