Code Monkey home page Code Monkey logo

pl-pfdicom_tagsub's Introduction

pl-pfdicom_tagSub

Abstract

This app performs a recursive walk down an input tree, and for each DICOM file (as filtered with a -e .dcm), will perform an edit or substitution on a pattern of user specified DICOM tags. Resultant edited files are saved in the corresponding location in the output tree. This page is not the canonical reference for pfdicom_tagSub on which this plugin is based. Please see https://github.com/FNNDSC/pfdicom_tagSub for detail about the actual tag substitution process and the pattern of command line flags.

Note that the only different between this plugin and the reference pfdicom_tagSub is that the reference has explicit flags for inputDir and outputDir while this plugin uses positional arguments for the same.

Run

Using docker run

docker run -it --rm -v $(pwd)/in:/incoming -v $(pwd)/out:/outgoing  \
        fnndsc/pl-pfdicom_tagsub dcm_tagSub.py                      \
        --tagStruct '
        {
            "PatientName":       "anonymized",
            "PatientID":         "%_md5|7_PatientID",
            "AccessionNumber":   "%_md5|10_AccessionNumber",
            "PatientBirthDate":  "%_strmsk|******01_PatientBirthDate"
        }
        ' --threads 0 -v 2 -e .dcm                                  \
        /incoming /outgoing

Assuming that $(pwd)/in contains a tree of DICOM files, then the above will generate, for each leaf directory node in $(pwd)/in that contains files satisfying the search constraint of ending in .dcm, new DICOM files with the above tag subsitutions: The PatientName is set to anonymized, the PatientID is replaced with the first seven chars of an md5 hash of the original PatientID -- similarly for the AssessionNumber. Finally the PatientBirthDate is masked so that the birthday is set to the first of the month.

Debug

Invariably, some debugging will be required. In order to debug efficiently, map the following into their respective locations in the container:

docker run -it --rm -v $(pwd)/in:/incoming -v $(pwd)/out:/outgoing      \
        -v $(pwd)/dcm_tagSub/dcm_tagSub.py:/usr/src/dcm_tagSub/dcm_tagSub.py  \
        -v $(pwd)/dcm_tagSub/pfdicom_tagSub.py:/usr/local/lib/python3.5/dist-packages/pfdicom_tagSub/pfdicom_tagSub.py \
        fnndsc/pl-pfdicom_tagsub dcm_tagSub.py                          \
        --tagStruct '
        {
            "PatientName":       "anonymized",
            "PatientID":         "%_md5|7_PatientID",
            "AccessionNumber":   "%_md5|10_AccessionNumber",
            "PatientBirthDate":  "%_strmsk|******01_PatientBirthDate"
        }
        ' --threads 0 -v 2 -e .dcm                                      \
        /incoming /outgoing

This assumes that the source code the underlying pfdicom_tagSub.py module is accessible as shown.

Make sure that the host $(pwd)/out directory is world writable!

pl-pfdicom_tagsub's People

Contributors

rudolphpienaar avatar reddigari avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.