Package: medcon
Table of ContentsAbstractSynopsisDescriptionArgumentsRunPull NIfTIUsingdocker runExamplesDebug_                           _
      | |                         | |
 _ __ | |______ _ __ ___   ___  __| | ___  ___  _ __
| '_ \| |______| '_ ` _ \ / _ \/ _` |/ __|/ _ \| '_ \
| |_) | |      | | | | | |  __/ (_| | (__| (_) | | | |
| .__/|_|      |_| |_| |_|\___|\__,_|\___|\___/|_| |_|
| |
|_|AbstractAn app to covert NIfTI volumes to DICOM files. This is a ChRIS conformant “DS” (Data Synthesis) plugin that wraps around themedconpackage and provides a thin shim about that executable.Synopsispython medcon.py                                                \
     -i|--inputFile <inputFile>                                 \
    [-a|--args 'ARGS: <argsToPassTo_medcon>']                   \
    [--do <macro>]                                              \
    [-h] [--help]                                               \
    [--json]                                                    \
    [--man]                                                     \
    [--meta]                                                    \
    [--savejson <DIR>]                                          \
    [-v <level>] [--verbosity <level>]                          \
    [--version]                                                 \
    <inputDir>                                                  \
    <outputDir>Descriptionmedcon.pycoverts NIfTI volumes to DICOM files. This is a ChRIS
conformant “DS” (Data Synthesis) plugin that wraps around the
medcon package and provides a thin shim about that executable. Using
the[--args'ARGS:<args>']CLI, a user can pass any additional
arbitrary arguments to the underlyingmedcon.If running this application directly, i.e. outside of its
docker container, please make sure that themedconapplication
is installed in the host system. On Ubuntu, this is typically:sudo apt install medconand also make sure that you are in an appropriate python virtual
environment with necessary requirements already installed
(see therequirements.txtfile).Please note, however, that running this application from its
docker container is the preferred method and the one documented
here.Arguments-i|--inputFile <inputFile>
Input file to process. This file exists within the explictly provided
CLI positional <inputDir>.

[-a|--args 'ARGS: <argsToPassTo_medcon>']
Optional string of additional arguments to "pass through" to medcon.

All the args for medcon are themselves specified at the plugin level
with this flag. These args MUST be contained within single quotes
(to protect them from the shell) and the quoted string MUST start with
 the required keyword 'ARGS: '.

[--do <macro>]
Optional argument to provide a "macro" type functionality. Using this
argument will add the correct underlying arguments to the internal
`medcon` binary.

Currently available:

        - 'nifti2dicom' : this will silently add the args
                      '-c dicom -split3d'

[-h] [--help]
If specified, show help message and exit.

[--json]
If specified, show json representation of app and exit.

[--man]
If specified, print (this) man page and exit.

[--meta]
If specified, print plugin meta data and exit.

[--savejson <DIR>]
If specified, save json representation file to DIR and exit.

[-v <level>] [--verbosity <level>]
Verbosity level for app. Not used currently.

[--version]
If specified, print version number and exit.RunWhilepl-medconis meant to be run as a containerized docker image, typcially within ChRIS, it is quite possible to run the dockerized plugin directly from the command line as well. The following instructions are meant to be a psuedo-jupyter-notebookinspired style where if you follow along and copy/paste into a terminal you should be able to run all the examples.First, let’s create a directory, saydevelwherever you feel like it. We will place some test data in this directory to process with this plugin.cd~/mkdirdevelcddevelexportDEVEL=$(pwd)Now, we need to fetch sample NIfTI data.Pull NIfTIWe provide a sample directory of a .nii volume here. (https://github.com/FNNDSC/SAG-anon-nii.git)Clone this repository (SAG-anon-nii) to your local computer.gitclonehttps://github.com/FNNDSC/SAG-anon-nii.gitMake sure theSAG-anon-niidirectory is placed in the devel directory.Usingdocker runTo run usingdocker, be sure to assign an “input” directory to/incomingand an output directory to/outgoing.Make sure that the$(pwd)/outdirectory is world writable!Make sure your current working directory isdevel. At this juncture it should containSAG-anon-nii.Create an output directory namedresultsindevel.mkdirresults&&chmod777resultsPull thefnndsc/pl-medconimage using the following command.dockerpullfnndsc/pl-medconExamplesCopy and modify the different commands below as neededdockerrun--rm\-v${DEVEL}/SAG-anon-nii/:/incoming-v${DEVEL}/results/:/outgoing\fnndsc/pl-medconmedcon.py\-iSAG-anon.nii\--donifti2dicom\/incoming/outgoingDebugFinally, let’s conclude with some quick notes on debugging this plugin. The debugging process is predicated on the idea of mapping a source code directory into an already existing container, thus “shadowing” or “masking” the existing code and overlaying current work directly within the container.In this manner, one can debug the plugin without needing to continually rebuild the docker image.So, assuming the same env variables as above, and assuming that you are in the source repo base directory of the plugin code:gitclonehttps://github.com/FNNDSC/pl-medcon.gitcdpl-medcondockerrun--rm-ti\-v$(pwd)/medcon:/usr/src/medcon\-v${DEVEL}/SAG-anon-nii/:/incoming\-v${DEVEL}/results/:/outgoing\fnndsc/pl-medconmedcon.py\-iSAG-anon.nii\--donifti2dicom\/incoming/outgoingOf course, adapt the above as needed.