Table of Contents
An app that converts between DICOM and mha format files.
dcm2mha_cnvtr is a ChRIS ds-type application that consumes image files of one type as input and converts these files to a reciprocal type as output. The reciprocating types of files are DICOM (dcm) and MetaImage Medical Format (mha).
docker run --rm fnndsc/pl-dcm2mha_cnvtr dcm2mha_cnvtr [-f|--inputFileFilter <inputFileFilter>] [-s|--saveAsPng] [-n|--imageName <pngFileName>] [-p|--filterPerc <filterPercentage>] [-r| --rotate <rotateAngle>] [--pftelDB <DBURLpath>] [-h|--help] [--json] [--man] [--meta] [--savejson <DIR>] [-v|--verbosity <level>] [--version] <inputDir> <outputDir>
[-f|--inputFileFilter <inputFileFilter>] A glob pattern string, default is "**/*.mha", representing the input file pattern to convert. Specify either "**/*mha" or "**/*dcm". [-s|--saveAsPng] If specified, generate a resultant PNG image along with dicoms. [-n|--imageName <pngFileName>] The name of the resultant PNG file. Default is "composite.png" [-p|--filterPerc <filterPercentage>] An integer value that represents the threshold for a high-pass filter on the image space. Image values less than this percentage are set to 0. This field is particularly important if image is noisy. Note that valid image data at intensities less than this cutoff are of course also filtered out! Default is 30. [-r| --rotate <rotateAngle>] An integer value in multiples of 90 that represents a rotation angle. The input image will be rotated anticlockwise for the provide angle. [--pftelDB <DBURLpath>] If specified, send telemetry logging to the pftel server and the specfied DBpath: --pftelDB <URLpath>/<logObject>/<logCollection>/<logEvent> for example --pftelDB http://localhost:22223/api/v1/weather/massachusetts/boston Indirect parsing of each of the object, collection, event strings is available through `pftag` so any embedded pftag SGML is supported. So http://localhost:22223/api/vi/%platform/%timestamp_strmsk|**********_/%name would be parsed to, for example: http://localhost:22223/api/vi/Linux/2023-03-11/posix [-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.
Getting inline help is:
docker run --rm fnndsc/pl-dcm2mha_cnvtr dcm2mha_cnvtr --man
You need to specify input and output directories using the -v flag to docker run.
docker run --rm -u $(id -u) \
-v $(pwd)/in:/incoming -v $(pwd)/out:/outgoing \
fnndsc/pl-dcm2mha_cnvtr dcm2mha_cnvtr \
/incoming /outgoing
Build the Docker container:
docker build -t local/pl-dcm2mha_cnvtr .
Run unit tests:
docker run --rm local/pl-dcm2mha_cnvtr nosetests
Debug container using live-mount:
Convert a set of DICOM files in a directory called dicom to MHA files in a directory called mha:
docker run -v $PWD/dicom:/incoming -v $PWD/mha:/outgoing \
fnndsc/pl-dcm2mha_cnvtr dcm2mha_cnvtr \
--inputFileFilter "**/*.dcm" \
/incoming /outgoing
and convert these back to DICOM again
docker run -v $PWD/mha:/incoming -v $PWD/dicom:/outgoing \
fnndsc/pl-dcm2mha_cnvtr dcm2mha_cnvtr \
--inputFileFilter "**/*.mha" \
/incoming /outgoing