sortspec - Sort Spectroscopy files

blue bar

Command line program to move exported spectroscopy files into a pre-defined directory structure.

sortspec [-src source_directory] [-dest destination_directory] [-exepath path] [-flat] [-sdbmS]
-src
Path to directory containing (unsorted) exported spectroscopy data files.
-dest
Path to top-level destination directory, which should already exist.
-exepath
Explicit path to to GE utility sdbm-..., if not in the environment PATH variable.
-flat
Do to sort files into subdirectories by year; see below.
-keep
For GE P*.7 files only, keep the text .shf file used to extract the acquisition details from the P*.7 file.
-sdbmS
For GE P*.7 files only, pass the "-S" flag to sdbm-... and use a slightly different algorithm to find the acquisition details. This option may improve the success of sorting large GE P*.7 files arising from RF coils with a large number of elements, or imaging related acquisitions.
-keep
For GE P*.7 files only, keep the text .shf file used to extract the acquisition details from the P*.7 file. If the -sdbmS option is also specificed, the location of the .shf file is stored in another text file.
-delid str
If the Subject ID stored in the spectroscopy file starts with the string specified in str then delete this file.

sortspec catalogues exported spectroscopy data files by moving them from an input source directory into a pre-defined destination directory tree structure. It was designed to run on a workstation which received exported spectroscopy data files from a number of MR scanners, uploaded into a particular directory and with a range of file naming conventions. sortspec reads each file in this input directory and tries to recognize the data format. If this is successful, sortspec reads the specific header to extract useful information, such as acquisition date and time, patient name, TE, TR, etc. It then moves and renames the spectroscopy file into a pre-defined destination directory structure.

The current destination structure consists of a sub-directory for each year, in which there are further sub-directories for each patient (defined by scan date and patient name). The spectroscopy files are placed in this sub-directory, with the filename being constructed of the acquisition time, magnetic field strength, TE, and TR. Any manufacturer specific file extension is maintained. For example, John Smith, scanned just after mid-day on 23rd January 2007 on a 3T scanner with two acquisitions (TE=35 and 144ms) both with a TR of 2000ms would have his spectroscopy data moved into a sub-directory 2007/20070123_Smith_John and the two spectroscopy files would be named 1205_3T_1H_035_2000 and 1211_3T_1H_144_2000.

Sorting the spectroscopy files in sub-directories named by the year is useful when a large number of spectroscopy files have accumulated. However, if only a few files are stored, this extra depth of sub-directory may not be required, and its creation can be prevented by using the -flat command line option.

The source and destination directories may be specified on the command line. If not, then the environment variables SPEC_SRC and SPEC_DEST are read to obtain the source and destination directories. If neither are specified, then the current directory is used.

Currently, sortspec can read exported single-voxel spectroscopy data from recent GE scanners (P*.7 files), Philips (*.SDAT and *.SPAR files), and Siemens (*.rda files). It usually works with CSI exported data as well. To read GE P*.7 files, it must be able to find the sdbm-... utility, which may be requested from GE. This limits the architectures on which GE exported data can be handled to Linux, Sun, and SGI. The Linux version, sdbm-linux, may often be found on the Signa console file system.

sortspec should work for CSI exported raw data and for muli-nuclear spectroscopy. GE's sdbm-... utility oftens brings up a prompt when processing CSI data, to which the Accept option may be selected.