CpMed User's Manual

Created:  4/7/00
Last Modified: 6/23/00
Version: cpmed 03d
Jim Nash, Synergy Research Inc.


Introduction

CpMed is a Unix commandline utility for conversion of medical images between different file formats. Supported formats include DICOM, AFNI, and NIAAA.  A Flat file writing capability is planned for the near future. This manual describes installation and usage of CpMed, and provides information about the different file formats and the extent to which CpMed supports conversion between them.

CpMed reads byte and short pixels and writes short pixels. Support is planned to convert between the following pixel depths to the extent the standards support them: (byte, short, float, complex).

CpMed release notes provide the latest information about each release of CpMed.
 

Support for various formats

AFNI (read and write)

AFNI 3D and 3D+time datasets are supported for reading and writing.

AFNI file notes provides a description of our implementation of AFNI brick structure. It provides some documentation to the AFNI file structure as such documentation does not otherwise exist. It provides web links to the AFNI web site.

DICOM (read only)

Reading from DICOM 3.0 format is supported to the extent that a selected subset of the possible image attributes (parameters) is read.  In general, the attributes that are read from the DICOM file are those supported in the NIAAA generic image format.  Attributes not belonging to the selected subset are ignored. Writing to DICOM is not supported.

DICOM file notes provides a description of our implementation of a DICOM file reader. It also provides a simplified introduction to the DICOM file which is a small subset of the DICOM standard. It also provides web links to the whole DICOM standard.

DICOM reader release notes provide the latest information about the DICOM reader for each release of CpMed

FLAT (read only)

Simple flat files are read and can be displayed. Support for setting various attributes from the command line is planned. Writing flat files is planned.

NIAAA generic image file (read and write)

Reading and writing NIAAA generic format is supported.

NIAAA "Generic" file notes provides a description of the NIAAA "Generic" file structure. This structure is in use at NIAAA at the National Institutes of Health.

 

Installing CpMed

CpMed consists of the file "cpmed.cc", an environment file "environment.h", a make file, the DICOM dictionary, and a number of files from sripClib. For convenience, all necessary files from sripClib are included in the cpmed directory.

To install CpMed, copy the archive cpmed__.tar.gz to a directory. Change directory to the cpmed directory. Then run the make file by typing "make" and then run the script install.sh by typing "install.sh". The script install.sh copies the DICOM dictionary to a special place in the root directories. You must be superuser to install DICOM. To summerize:

> cp archive_path/cpmed01a.tar.gz .
> tar -zxf cpmed01a.tar.gz
> cd cpmed
> make
> su
<password>
# install.sh

now you are ready to use CpMed.

 

Using CpMed

Usage of CpMed is described in the help listing that you get by typing the command "cpmed -h". Here we list the most typical uses of the program.

> cpmed -v -T=DICOM -t=NIAAA * .

This command assumes that all of the files in the current directory are DICOM and converts them into NIAAA files. There may be several DICOM series. One series being a stack of 2D images. One series is also called a 3D image.

> cpmed -t=AFNI * .

This command takes all of the files in the current directory, automatically detects their type, if possible, and then writes them out as AFNI BRIK files.

> cpmed -T=FLAT(128,128,16,2, 0) -t=NIAAA * .

This command takes all the files in the current directory and assumes that they are flat image files with the first pixel at offset 0 (no offset) and x,y,z dimensions of 128,128,16, and each pixel being 2 byte signed integer.

 

Comparison of data structures

Here is a comparison of three medical imaging data structures.
 topic AFNI DICOM NIAAA
 one dataset two files required: 
.BRIK - raw binary 
.HEAD - text
one file containing variety of strings and binary.  .img binary file with header is required. 
.hdr text file optional
 dictionary required no yes no
 other files .NOTE - user notes 
.HEAD - multiple
no .PAF analysis files
 offset to voxel data  .BRIK, offset = 0 must scan for tag .img, offset = 1024
 complexity low very high low
 well documented * no yes no
 easy to maintain yes no yes
 old programs can read new files yes yes yes, all new fields are appended to .img or added to .hdr
* - all structures are poorly documented in these pages. It's a start.

 
 

NIAAA file format

Two files are written, .img is a binary image file with a 512 byte header; .hdr is a text file which contains value pairs in the style of the programming language LISP. The header file contains various parameters associated with how the image was acquired. Only a few fields are defined and these fall in two groups: GENERIC is the name of the first group and contains a text duplicate of the information in the 512 byte header of the binary image file (.img); FILEHDR is the name of the second group which contains other information of interest specific to desired analysis.

Documentation on the .img file is implied in the file ImHeader.h. Documentation on the allowed fields in the .hdr text file is implied by example .hdr files. cpmed versions of this file does not have information on individual slices, but other conversion utilities do. When added, the names of such fields should follow precedent set by the older conversion utilities.