Help and Manual for Tools

Introduction

This page provides some help and explanation on a few simple tools which can be used on the networked Unix workstations running the Solaris or Linux operating systems or the Windows 7 PCs of the Wolfson Molecular Imaging Centre at the University of Manchester.

All applications described here are available on the Unix application disk. This disk should normally be mounted to client workstations at the mount point /opt/wmic.

Platform independent executables (such as Bourne shell scripts) as well as wrapper scripts are installed in the directory /opt/wmic/bin.

The platform specific binary executables are located in six separate subdirectories.

  1. The directory /opt/wmic/bin/sparc contains the 32-bit executables for the SPARC Solaris platform.
  2. The directory /opt/wmic/bin/sparcv9 contains the 64-bit executables for the SPARCV9 Solaris platform.
  3. The directory /opt/wmic/bin/i386 contains the 32-bit executables for the Linux systems with 80386 or compatible processors.
  4. The directory /opt/wmic/bin/x86_64 contains the 64-bit executables for the Linux systems with processors using the AMD64 instruction set.
  5. The directory /opt/wmic/bin/maci64 contains the Mach-O 64-bit executables for the macOS systems with Intel processors.
  6. The directory \\MMIC-FS1\WMIC_Apps contains the 32-bit executables for the Microsoft Windows platform.
  7. The directory \\MMIC-FS1\WMIC_Apps\win64 contains the 64-bit executables for the Microsoft Windows platform.

Some of the binary programs require dynamic linking with the AVW library. For those, a wrapper script in /opt/wmic/bin sets the appropriate environment variables and then invokes the platform specific binary from one of the subdirectories listed above.

Exit status
The following exit values are returned:
    0      Successful completion.
    1      Incorrect usage, command help is displayed.
    2      Memory allocation failed.
    3      AVW licence validation error.
    >3    Programme specific error, a corresponding error message is printed.

In the following examples, a per cent sign % at the beginning of the line indicates the command line prompt of a C shell compatible shell.

Contents

  1. ShowHdr (show or compare Analyze 7.5 Image header files)
    Example 1: Print the full contents of two header files
    Example 2: Display just the number of frames (volumes)
    Example 3: Compare two header files and filter out the fields that are different
    Example 4: Print the ROI Scale factor in single or double precision
  2. EditHdr (edit the contents of an Analyze 7.5 Image header file)
    Example call:
    Example 2: Create a synthetic header file for an HRRT Interfile image
    Example 3: Transfer the ROI Scale factor in double precision
  3. MRIWarp 1.52
  4. AIR 5.3.0 (Automated Image Registration package)
  5. nifticlib-0.5 (tools from the NIfTI C library)
  6. FSL
  7. chopima (cut dynamic Analyze 7.5 Image file[s] into series of individual image files)
    Example 1: Cut a dynamic image from the HiREZ scanner, creating three digit frame numbers in the file names
    Example 2: Cut a dynamic image from the HRRT scanner, updating the min/max values in the output header files
  8. cmrgima (convert 45 min IRF images or KI images into Cerebral Metabolic Rate of Glucose parametric images)
    Example 1: Conversion of a 45 min IRF image
    Example 2: Conversion of a KI image
  9. ima2obj (convert image file[s] into Analyze Object Map file[s])
    Example 1:
    Example 2: Explicitly specify the number of objects to create
  10. showobjn (show Object Map numbers [and names])
    Example 1: Show the number of objects in the Object Maps
    Example 2: Print a full list of the objects in the Object Maps
  11. objncopy (object name copy command)
    Example 1: Object Map file t00799.obj with 10 objects from the showobjn example above
    Example 2: Object Map file t00799.obj after removing the "empty" object "brainstem"
  12. panames (probabilistic atlas names)
    Example 1: Obtain the object name list of atlas 2, i.e. the list with 68 entries
    Example 2: Change the object name list in an Object Map file
  13. obj2ima (convert Analyze Object Map file[s] into Analyze 7.5 Image file[s])
    Example:
  14. tacstats (create time activity curve statistics)
    Example 1: Sample a dynamic PET image and save the full statistics in a WMIC CSV file
    Example 2: Sample a dynamic PET image and save the short statistics in a WMIC CSV file
    Example 3: Sample a dynamic PET image including the unused object[s] and save the short statistics in a WMIC CSV file
    Example 4: Sample a static PET image and save the voxel statistics in a WMIC CSV file
    Combining two regions, e.g. left and right
  15. stats2xls (read cohort of STATS CSV files and write the data into an XLS file)
  16. vstats2vec (extract region vectors from voxel statistics CSV data)
  17. vec2xls (load cohort of VEC files and write the data into an XLS file)
  18. decay (decay or undecay dynamic PET image in Analyze Image 7.5 file format)
    Example: Correct a dynamic [15O]H2O study from the HiREZ scanner for radioactive decay, creating decay-corrected images
  19. addimg (add frames of a dynamic PET image in Analyze file format)
    Example: Dynamic [18F]FDG study from the High Resolution Research Tomograph (HRRT)
  20. mulimg (multiply a thresholded image with another image)
    Example:
  21. normi (normalise dynamic image, create voxel histogram)
    Example 1: Dynamic [11C]-(R)-PK11195 study from the High Resolution Research Tomograph (HRRT)
    Example 2: Some Matlab code to read and display the voxel histogram
    Example 3: Using a NIfTI floating point image as mask image
    Example 4: Using a 16-bit signed integer image as mask image
  22. hdr2sif (convert Inveon Interfile header data into CSV Scan Information Files)
  23. inveon_i2ana (convert the Inveon dynamic binary interfile into Analyze 7.5 format)
    Example:
  24. sthg2ana (convert "something float" into a signed short Analyze Image 7.5 file)
    Example 1: Convert a dynamic PET study from a GEADVANCE file into an Analyze Image 7.5 file
    Example 2: Convert a dynamic PET study from an ECAT 7 file into an Analyze Image 7.5 file
    Example 3: Convert a parametric map in Analyze Image 7.5 format from single precision float to signed 16-bit integer
    Example 4: Round float values to nearest integer values in the probabilistic brain atlas NIfTI image
    Example 5: Convert a parametric map in NIfTI format from double precision float to signed 16-bit integer
  25. hrrt_gfilt (Gaussian 3D filter for dynamic Analyze 7.5 PET images)
    Example 1: Single frame HRRT image, FWHM= 2.5 mm (convolution in image space)
    Example 2: Dynamic HiREZ image, FWHM= 10 mm (multiplication in the Fourier domian)

ShowHdr - show or compare Analyze 7.5 Image header files

Type binary executable
Location /opt/wmic/bin/sparc, /opt/wmic/bin/sparcv9, /opt/wmic/bin/i386, /opt/wmic/bin/x86_64, \\MMIC-FS1\WMIC_Apps, \\MMIC-FS1\WMIC_Apps\win64
Version3.4

Description: ShowHdr is a command line program to print the contents of Analyze 7.5 Image header files on the standard output stream.
ShowHdr tries to identify the endianness of the header files. If required, the bytes are swapped and a notice it printed on the standard error stream.
ShowHdr's output can be piped through the stream editor sed to extract the value of a specific field.
With the command line option -c a field by field comparison of two header files is performed. If a field's content is equal in both files, it is printed as in the standard mode of ShowHdr. Otherwise, the contents from both files is shown, and the line is marked with 5 stars *****. This allows the use of fgrep to filter those lines out where the contents differs between the two files (see Example 3 below).

Usage:

  ShowHdr [-f format] h01234.hdr t56789.hdr ...
  shows the contents of all files specified

  ShowHdr -c [-f format] a.hdr b.hdr
  shows a field by field comparison of the two files

 -f format      a string specifying the output conversion of the
                floating point values (default: %g)
                See the Standard C Library Functions printf(3C)
                manpage for examples.

Example 1: Print the full contents of two header files

% ShowHdr h00005_20060623_160920_s09_nf02.hdr h00005_20060623_160920_s15_nf29.hdr
Notice: bytes swapped.
Analyze header dump of: <h00005_20060623_160920_s09_nf02.hdr> 
  hk.sizeof_hdr      : <348>
  hk.data_type       : <dsr      >
  hk.db_name         : <                 >
  hk.extents         : <0>
  hk.session_error   : <0>
  hk.regular         : <r>
  hk.hkey_un0        : <0>
  dime.dim[0]        : <4>
  dime.dim[1]        : <256>
  dime.dim[2]        : <256>
  dime.dim[3]        : <81>
  dime.dim[4]        : <2>
  dime.dim[5]        : <0>
  dime.dim[6]        : <0>
  dime.dim[7]        : <0>
  dime.vox_units     : <mm  >
  dime.cal_units     : <kBq/ml  >
  dime.unused1       : <0>
  dime.datatype      : <4>
  dime.bitpix        : <16>
  dime.dim_un0       : <0>
  dime.pixdim[0]     : <0>
  dime.pixdim[1]     : <2.66615>
  dime.pixdim[2]     : <2.66615>
  dime.pixdim[3]     : <2>
  dime.pixdim[4]     : <0>
  dime.pixdim[5]     : <0>
  dime.pixdim[6]     : <0>
  dime.pixdim[7]     : <0>
  dime.vox_offset    : <0>
  dime.funused1      : <0.00326873>
  dime.funused2      : <122.24>
  dime.funused3      : <0>
  dime.cal_max       : <107.106>
  dime.cal_min       : <0>
  dime.compressed    : <0>
  dime.verified      : <0>
  dime.glmax         : <32767>
  dime.glmin         : <0>
  hist.descrip       : <PET Water Ranging Study - Pelvis (Adult)                                        >
  hist.aux_file      : <none                   >
  hist.orient        : <>
  hist.originator    : <petct1    >
  hist.generated     : <EM2D 4i16s>
  hist.scannum       : <9         >
  hist.patient_id    : <h00005    >
  hist.exp_date      : <2006-06-23>
  hist.exp_time      : <16:09:20.9>
  hist.hist_un0      : <FFS>
  hist.views         : <0>
  hist.vols_added    : <0>
  hist.start_field   : <0>
  hist.field_skip    : <0>
  hist.omax          : <0>
  hist.omin          : <0>
  hist.smax          : <0>
  hist.smin          : <0>

================================================================================

Notice: bytes swapped.
Analyze header dump of: <h00005_20060623_160920_s15_nf29.hdr> 
  hk.sizeof_hdr      : <348>
  hk.data_type       : <dsr      >
  hk.db_name         : <                 >
  hk.extents         : <0>
  hk.session_error   : <0>
  hk.regular         : <r>
  hk.hkey_un0        : <0>
  dime.dim[0]        : <4>
  dime.dim[1]        : <256>
  dime.dim[2]        : <256>
  dime.dim[3]        : <81>
  dime.dim[4]        : <29>
  dime.dim[5]        : <0>
  dime.dim[6]        : <0>
  dime.dim[7]        : <0>
  dime.vox_units     : <mm  >
  dime.cal_units     : <kBq/ml  >
  dime.unused1       : <0>
  dime.datatype      : <4>
  dime.bitpix        : <16>
  dime.dim_un0       : <0>
  dime.pixdim[0]     : <0>
  dime.pixdim[1]     : <2.66615>
  dime.pixdim[2]     : <2.66615>
  dime.pixdim[3]     : <2>
  dime.pixdim[4]     : <0>
  dime.pixdim[5]     : <0>
  dime.pixdim[6]     : <0>
  dime.pixdim[7]     : <0>
  dime.vox_offset    : <0>
  dime.funused1      : <0.0972375>
  dime.funused2      : <122.24>
  dime.funused3      : <0>
  dime.cal_max       : <3186.18>
  dime.cal_min       : <-2806.08>
  dime.compressed    : <0>
  dime.verified      : <0>
  dime.glmax         : <32767>
  dime.glmin         : <-28858>
  hist.descrip       : <PET Water Ranging Study - Pelvis (Adult)                                        >
  hist.aux_file      : <none                   >
  hist.orient        : <>
  hist.originator    : <petct1    >
  hist.generated     : <DIFT      >
  hist.scannum       : <15        >
  hist.patient_id    : <h00005    >
  hist.exp_date      : <2006-06-23>
  hist.exp_time      : <16:09:20.9>
  hist.hist_un0      : <FFS>
  hist.views         : <0>
  hist.vols_added    : <0>
  hist.start_field   : <0>
  hist.field_skip    : <0>
  hist.omax          : <0>
  hist.omin          : <0>
  hist.smax          : <0>
  hist.smin          : <0>

Example 2: Display just the number of frames (volumes)

% ShowHdr h00005_20060623_160920_s09_nf02.hdr h00005_20060623_160920_s15_nf29.hdr | sed -n '/^  dime.dim\[4\]        : <\([0-9]*\)>$/s//\1/p'
2
29

Example 3: Compare two header files and filter out the fields that are different

% ShowHdr -c h00450_mr2pet.hdr spm5/h00450_mr2pet.hdr | fgrep "*****"
  hist.originator    : <>       <D>     *****
    spm.origx        : <0>      <68>    *****
    spm.origy        : <0>      <98>    *****
    spm.origz        : <0>      <60>    *****

Example 4: Print the ROI Scale factor in single or double precision

ShowHdr can also be used to convert the single precision floating point values using any desired format string. For example,

% ShowHdr -f %.7e t00321_45min.hdr | sed -n '/  dime.funused1      : <\(.*\)>/s//\1/p'
3.0592648e-08

prints the ROI Scale Factor in single precision. In contrast, the answer by od would depend on whether the current machine has the same endianness as the Analyze 7.5 Image header file.

% od -A n -j 112 -N 4 -t f4 t00321_45min.hdr
          3.0592648e-08

looks all right whereas

%od -A n -j 112 -N 4 -t f4 t00321_45min.hdr 
         -7.3994286e+34

appears to be the wrong endian.
The command

% ShowHdr -f %18.16g t00321_45min.hdr | sed -n '/  dime.funused1      : <\(.*\)>/s//\1/p'
3.059264841454024e-08

prints the double precision representation of the ROI Scale Factor.


EditHdr - edit the contents of an Analyze 7.5 Image header file

Type binary executable
Location /opt/wmic/bin/sparc, /opt/wmic/bin/sparcv9, /opt/wmic/bin/i386, /opt/wmic/bin/x86_64, \\MMIC-FS1\WMIC_Apps, \\MMIC-FS1\WMIC_Apps\win64
Version2.2

Description: EditHdr is a command line program to edit the fields in an Analyze 7.5 Image header file.
EditHdr tries to identify the endianness of the header file. If required, the bytes are swapped internally. Regardless of the system where EditHdr is run, the original endianness of the header file will remain unchanged.

Usage: EditHdr image.hdr field0=value0 field1=value1 ... fieldn=valuen

 image.hdr      the name of the Analyze Image 7.5 header file to be
                edited.
 fieldi=valuei  the name of the header field with the value to be
                assigned.

This is a list of the header fields and the data types of their values:

                hk.sizeof_hdr   = int
                hk.data_type    = char[10]
                hk.db_name      = char[18]
                hk.extents      = int
                hk.session_error= short int
                hk.regular      = char[1]
                hk.hkey_un0     = char[1]
                dime.dim[0]     = short int
                dime.dim[1]     = short int
                dime.dim[2]     = short int
                dime.dim[3]     = short int
                dime.dim[4]     = short int
                dime.dim[5]     = short int
                dime.dim[6]     = short int
                dime.dim[7]     = short int
                dime.vox_units  = char[4]
                dime.cal_units  = char[8]
                dime.unused1    = short int
                dime.datatype   = short int
                dime.bitpix     = short int
                dime.dim_un0    = short int
                dime.pixdim[0]  = float
                dime.pixdim[1]  = float
                dime.pixdim[2]  = float
                dime.pixdim[3]  = float
                dime.pixdim[4]  = float
                dime.pixdim[5]  = float
                dime.pixdim[6]  = float
                dime.pixdim[7]  = float
                dime.vox_offset = float
                dime.funused1   = float
                dime.funused2   = float
                dime.funused3   = float
                dime.cal_max    = float
                dime.cal_min    = float
                dime.compressed = int
                dime.verified   = int
                dime.glmax      = int
                dime.glmin      = int
                hist.descrip    = char[80]
                hist.aux_file   = char[24]
                hist.orient     = char[1]
                hist.originator = char[10]
                  spm.origx     = short int
                  spm.origy     = short int
                  spm.origz     = short int
                hist.generated  = char[10]
                hist.scannum    = char[10]
                hist.patient_id = char[10]
                hist.exp_date   = char[10]
                hist.exp_time   = char[10]
                hist.hist_un0   = char[3]
                hist.views      = int
                hist.vols_added = int
                hist.start_field= int
                hist.field_skip = int
                hist.omax       = int
                hist.omin       = int
                hist.smax       = int
                hist.smin       = int

Note that in most cases the brackets used to specify the subscripts of array fields have to be protected from interpretation by the shell! This can be done with back slash \ or double quote " characters. The same applies to white spaces in character arrays.

Example call:

% EditHdr h01234.hdr dime.pixdim\[1\]=2.092 "dime.pixdim[2]"=2.092 "dime.pixdim[3]=2.42" dime.vox_units=mm dime.cal_units=kBq/ml hist.descrip=our\ example\ with\ spaces\ in\ between hist.patient_id="=my uncle"

Example 2: Create a synthetic header file for an HRRT Interfile image

Use the dd command on a Unix system to first create an empty 348-bytes header file new.hdr:

% dd if=/dev/zero bs=348 count=1 of=new.hdr
1+0 records in
1+0 records out

Then set all the required fields to the appropriate values. For example, the datatype value for AVW_FLOAT (32-bit single precision float) is defined as 16 for an Analyze 7.5 Image and the corresponding number of bits per pixel bitpix is 32:

% EditHdr new.hdr hk.sizeof_hdr=348 hk.regular=r "dime.dim[0]=4" "dime.dim[1]=256" "dime.dim[2]=256" "dime.dim[3]=207" "dime.dim[4]=1" dime.datatype=16 dime.bitpix=32 "dime.pixdim[1]=1.21875" "dime.pixdim[2]=1.21875" "dime.pixdim[3]=1.21875"

Paired up with a 256 x 256 x 207 voxels HRRT Interfile image file new.img, the resulting Analyze 7.5 Image can now be loaded into any image display software. As no Y or Z flip has been applied to the data, the image will not be shown in standard radiological orientation.

Example 3: Transfer the ROI Scale factor in double precision

This example transfers the value of the ROI Scale factor in double precision from the image pre.hdr to the image post.hdr:

% EditHdr post.hdr dime.funused1=`ShowHdr -f %18.16g pre.hdr | sed -n '/  dime.funused1      : <\(.*\)>/s//\1/p'`

Check that the binary values of dime.funused1 in the two images are identical:

% ShowHdr -c pre.hdr post.hdr | fgrep dime.funused1
  dime.funused1      : <0.00138057>

The output should only show one value and no asterisks*****at the end of the line.


MRIWarp 1.52

Type binary executables
Location /opt/wmic/mriwarp/1.52/sparcv9, /opt/wmic/mriwarp/1.52/sparc, /opt/wmic/bin/x86_64, /opt/wmic/mriwarp/1.52/i386, \\wmic-san1\secondary_data\appdir\mriwarp\1.52\win32, \\wmic-san1\secondary_data\appdir\mriwarp\1.52\win64
Version1.52

Description: MRIWarp is a warping tool for intersubject registration of brain images constructed by Ulrik Kjems. Apart from warping there are also (command line) functions for ANALYZE header information, mirroring, translation, subsampling, ... The package cannot only be used as a preprocessing step in function neuroimaging but also as a step in deformation-based morphometry, see reference.

Quick reference to the 18 utility programmes:

  1. histo_vols (Compute 2D intensity histogram of 2 volumes)
  2. gauss_vol (Apply Gaussian smoothing kernel to a volume)
  3. concat_vol (Concatenate volume data)
  4. compute_warp (Compute a 3D non-linear deformation ("warp") of an MRI volume to match a template.)
  5. connect3d (3D connected components analysis)
  6. warp_reslice (Applies deformation field and linear transformation)
  7. covar (Compute covariance matrix for a set of volumes)
  8. maskvol (Build mask, boxcar-smoothing within mask)
  9. subsample (Subsample a volume by an integral factor)
  10. apply_warp (Fast application of displacement field)
  11. file2ana (Converts files to ANALYZE file format.)
  12. file2xprime (Converts files to XPRIME file format.)
  13. ivar (Computes variance image between the specified volumes)
  14. file2vapet (Converts files to VAPET file format.)
  15. flip (Flip a volume along X-, Y- or Z-axis)
  16. headerinfo (Show volume header information)
  17. convert_vol (Change datatype, scale intensity, compute min/max)
  18. resize_vol (Resize a volume (add/remove space))

AIR 5.3.0 - Automated Image Registration package

Type binary executables
Location /opt/wmic/air/5.3.0/sparcv9, /opt/wmic/air/5.3.0/sparc, /opt/wmic/bin/x86_64, /opt/wmic/air/5.3.0/i386, \\wmic-san1\secondary_data\appdir\air\5.3.0\win32, \\wmic-san1\secondary_data\appdir\air\5.3.0\win64
Version5.3.0

Description: The Automated Image Registration (AIR) package written by Roger P. Woods includes automated routines for aligning and reslicing tomographic image data. In addition, a number of utility routines and error checking routines are provided. The routines are invoked as standard UNIX commands. The AIR package does not provide any graphics or image display capabilities.
The default image file format is compatible with the ANALYZE format developed at the Mayo Clinic. No file format converters are provided.

Programs that will display, generate or modify header files are

  1. scanheader (display contents of header file)
  2. fixheader (correct header voxel sizes)
  3. makeaheader (create new header)
  4. setheadermax (change header maximum)

nifticlib-0.5 - tools from the NIfTI C library

Type binary executables
Location /opt/wmic/bin/sparc, /opt/wmic/bin/i386
Version0.5

Description: NIfTI-1 is a new Analyze-style data format. A collection of I/O routines for the NIfTI-1 neuroimage data format is available in niftilib. From the C package nifticlib version 0.5 (31 May 2007), three tools are available.

  1. nifti1_test (show header information and perform format conversions)
  2. nifti_tool (display, modify or compare nifti structures in datasets; copy a dataset by selecting a list of volumes from the original; copy a dataset, collapsing any dimensions, each to a single index; display a time series for a voxel, or more generally, the data from any collapsed image, in ASCII text)
  3. nifti_stats (demo program for computing NIfTI statistical functions)

FSL

Description: FSL is a comprehensive library of analysis tools for brain imaging data created by the Analysis Group, FMRIB, Oxford, UK. Most of the tools can be run both from the command line and as GUIs ("point-and-click" graphical user interfaces).

The version and platform specific distributions are located in separate subdirectories within /opt/wmic/fsl reflected by the environment variable FSLDIR. For csh and similar shells, the following command can be used to define FSLDIR

  1. On Linux systems with 80386 or compatible processors:
    setenv FSLDIR /opt/wmic/fsl/v4.1
  2. For 32-bit executables on the SPARC Solaris platform:
    setenv FSLDIR /opt/wmic/fsl/v4.1.9
  3. For 64-bit executables on the SPARCV9 Solaris platform:
    setenv FSLDIR /opt/wmic/fsl/v5.0.2.2
  4. For 64-bit executables on Linux systems with processors using the AMD64 instruction set either:
    setenv FSLDIR /opt/wmic/fsl/v5.0.10
             or
    setenv FSLDIR /opt/wmic/fsl/v6.0.6.4

Then add the bin subdirectory to the PATH environment variable and define the two FSL environment variables FSLTCLSH and FSLWISH, respectively

setenv PATH ${PATH}:${FSLDIR}/bin (or for version 6.0.6 and newer: setenv PATH ${PATH}:${FSLDIR}/share/fsl/bin )
setenv FSLTCLSH ${FSLDIR}/bin/fsltclsh
setenv FSLWISH ${FSLDIR}/bin/fslwish
setenv FSLOUTPUTTYPE NIFTI
The last statement defines in which file format FSL will save output images.

Of the FSL tools, only FSLUTILS is mentioned here as it provides a set of useful command-line utilities which allow the conversion, processing etc of Analyze and Nifti format data sets. Three examples are


chopima - cut dynamic Analyze 7.5 Image file[s] into series of individual image files

Type Bourne shell script, requires the binaries ShowHdr and EditHdr
Location /opt/wmic/bin
Version3.4

Description: chopima is a command line program to cut dynamic Analyze 7.5 Image file[s] (multiple frames) into series of individual single-frame Analyze 7.5 Image files. This might be required for instance in order to perform a frame-to-frame realignment of the data.
By default, the minimum and maximum values in the file headers are only copied from the source file. This often eases the reassemblance of the individual frames into one big dynamic image file later on.
If correct minimum and maximum values in the individual header files are required, then the -u option should be used. However, this only produces correct results if chopima is run on a system with the same endianness as the Analyze 7.5 Image file!

Usage: chopima [-0] [-o] [-s] [-u] h01234_lm1_1_CZ.hdr t56789dy1_Cal.hdr ...

 -0     use leading zeros in the frame numbers (i.e. "001" instead of "1").
 -o     overwrite ON (default: if the output files already exist, they will
        not be overwritten)
 -s     suppress scanner type identification (set this flag for volumes with
        nonstandard image matrix size)
 -u     update the file headers with the new, frame-specific min/max values
        (default: copy the min/max values from the header of the dynamic)
        Using this option will dramatically increase the execution time!!!

Example 1: Cut a dynamic image from the HiREZ scanner, creating three digit frame numbers in the file names

mmic-sun2% chopima -0 h00005_20060623_160920_s15_nf29.hdr
./h00005_20060623_160920_s15_nf29.img:   29 frames, 307888128 bytes, 10616832 bytes per frame (HiREZ scanner).
  ./h00005_20060623_160920_s15_nf29_v001.img -> written,  ./h00005_20060623_160920_s15_nf29_v001.hdr -> written.
  ./h00005_20060623_160920_s15_nf29_v002.img -> written,  ./h00005_20060623_160920_s15_nf29_v002.hdr -> written.
  ./h00005_20060623_160920_s15_nf29_v003.img -> written,  ./h00005_20060623_160920_s15_nf29_v003.hdr -> written.
  ./h00005_20060623_160920_s15_nf29_v004.img -> written,  ./h00005_20060623_160920_s15_nf29_v004.hdr -> written.
  ./h00005_20060623_160920_s15_nf29_v005.img -> written,  ./h00005_20060623_160920_s15_nf29_v005.hdr -> written.
  ./h00005_20060623_160920_s15_nf29_v006.img -> written,  ./h00005_20060623_160920_s15_nf29_v006.hdr -> written.
  ./h00005_20060623_160920_s15_nf29_v007.img -> written,  ./h00005_20060623_160920_s15_nf29_v007.hdr -> written.
  ./h00005_20060623_160920_s15_nf29_v008.img -> written,  ./h00005_20060623_160920_s15_nf29_v008.hdr -> written.
  ./h00005_20060623_160920_s15_nf29_v009.img -> written,  ./h00005_20060623_160920_s15_nf29_v009.hdr -> written.
  ./h00005_20060623_160920_s15_nf29_v010.img -> written,  ./h00005_20060623_160920_s15_nf29_v010.hdr -> written.
  ./h00005_20060623_160920_s15_nf29_v011.img -> written,  ./h00005_20060623_160920_s15_nf29_v011.hdr -> written.
  ./h00005_20060623_160920_s15_nf29_v012.img -> written,  ./h00005_20060623_160920_s15_nf29_v012.hdr -> written.
  ./h00005_20060623_160920_s15_nf29_v013.img -> written,  ./h00005_20060623_160920_s15_nf29_v013.hdr -> written.
  ./h00005_20060623_160920_s15_nf29_v014.img -> written,  ./h00005_20060623_160920_s15_nf29_v014.hdr -> written.
  ./h00005_20060623_160920_s15_nf29_v015.img -> written,  ./h00005_20060623_160920_s15_nf29_v015.hdr -> written.
  ./h00005_20060623_160920_s15_nf29_v016.img -> written,  ./h00005_20060623_160920_s15_nf29_v016.hdr -> written.
  ./h00005_20060623_160920_s15_nf29_v017.img -> written,  ./h00005_20060623_160920_s15_nf29_v017.hdr -> written.
  ./h00005_20060623_160920_s15_nf29_v018.img -> written,  ./h00005_20060623_160920_s15_nf29_v018.hdr -> written.
  ./h00005_20060623_160920_s15_nf29_v019.img -> written,  ./h00005_20060623_160920_s15_nf29_v019.hdr -> written.
  ./h00005_20060623_160920_s15_nf29_v020.img -> written,  ./h00005_20060623_160920_s15_nf29_v020.hdr -> written.
  ./h00005_20060623_160920_s15_nf29_v021.img -> written,  ./h00005_20060623_160920_s15_nf29_v021.hdr -> written.
  ./h00005_20060623_160920_s15_nf29_v022.img -> written,  ./h00005_20060623_160920_s15_nf29_v022.hdr -> written.
  ./h00005_20060623_160920_s15_nf29_v023.img -> written,  ./h00005_20060623_160920_s15_nf29_v023.hdr -> written.
  ./h00005_20060623_160920_s15_nf29_v024.img -> written,  ./h00005_20060623_160920_s15_nf29_v024.hdr -> written.
  ./h00005_20060623_160920_s15_nf29_v025.img -> written,  ./h00005_20060623_160920_s15_nf29_v025.hdr -> written.
  ./h00005_20060623_160920_s15_nf29_v026.img -> written,  ./h00005_20060623_160920_s15_nf29_v026.hdr -> written.
  ./h00005_20060623_160920_s15_nf29_v027.img -> written,  ./h00005_20060623_160920_s15_nf29_v027.hdr -> written.
  ./h00005_20060623_160920_s15_nf29_v028.img -> written,  ./h00005_20060623_160920_s15_nf29_v028.hdr -> written.
  ./h00005_20060623_160920_s15_nf29_v029.img -> written,  ./h00005_20060623_160920_s15_nf29_v029.hdr -> written.

Example 2: Cut a dynamic image from the HRRT scanner, updating the min/max values in the output header files

mmic-node16% chopima -u image_10.hdr
./image_10.img:   33 frames, 895352832 bytes, 27131904 bytes per frame (HRRT scanner).
  ./image_10_v1.img -> written,  ./image_10_v1.hdr -> written (min=0,max=12).
  ./image_10_v2.img -> written,  ./image_10_v2.hdr -> written (min=0,max=3743).
  ./image_10_v3.img -> written,  ./image_10_v3.hdr -> written (min=0,max=10680).
  ./image_10_v4.img -> written,  ./image_10_v4.hdr -> written (min=0,max=23744).
  ./image_10_v5.img -> written,  ./image_10_v5.hdr -> written (min=0,max=21012).
  ./image_10_v6.img -> written,  ./image_10_v6.hdr -> written (min=0,max=21774).
  ./image_10_v7.img -> written,  ./image_10_v7.hdr -> written (min=0,max=17885).
  ./image_10_v8.img -> written,  ./image_10_v8.hdr -> written (min=0,max=18652).
  ./image_10_v9.img -> written,  ./image_10_v9.hdr -> written (min=0,max=21477).
  ./image_10_v10.img -> written,  ./image_10_v10.hdr -> written (min=0,max=29326).
  ./image_10_v11.img -> written,  ./image_10_v11.hdr -> written (min=0,max=32767).
  ./image_10_v12.img -> written,  ./image_10_v12.hdr -> written (min=0,max=18903).
  ./image_10_v13.img -> written,  ./image_10_v13.hdr -> written (min=0,max=21618).
  ./image_10_v14.img -> written,  ./image_10_v14.hdr -> written (min=0,max=12352).
  ./image_10_v15.img -> written,  ./image_10_v15.hdr -> written (min=0,max=8566).
  ./image_10_v16.img -> written,  ./image_10_v16.hdr -> written (min=0,max=6991).
  ./image_10_v17.img -> written,  ./image_10_v17.hdr -> written (min=0,max=4975).
  ./image_10_v18.img -> written,  ./image_10_v18.hdr -> written (min=0,max=5190).
  ./image_10_v19.img -> written,  ./image_10_v19.hdr -> written (min=0,max=2770).
  ./image_10_v20.img -> written,  ./image_10_v20.hdr -> written (min=0,max=2845).
  ./image_10_v21.img -> written,  ./image_10_v21.hdr -> written (min=0,max=3613).
  ./image_10_v22.img -> written,  ./image_10_v22.hdr -> written (min=0,max=1687).
  ./image_10_v23.img -> written,  ./image_10_v23.hdr -> written (min=0,max=2417).
  ./image_10_v24.img -> written,  ./image_10_v24.hdr -> written (min=0,max=1454).
  ./image_10_v25.img -> written,  ./image_10_v25.hdr -> written (min=0,max=1274).
  ./image_10_v26.img -> written,  ./image_10_v26.hdr -> written (min=0,max=1223).
  ./image_10_v27.img -> written,  ./image_10_v27.hdr -> written (min=0,max=1085).
  ./image_10_v28.img -> written,  ./image_10_v28.hdr -> written (min=0,max=1273).
  ./image_10_v29.img -> written,  ./image_10_v29.hdr -> written (min=0,max=1195).
  ./image_10_v30.img -> written,  ./image_10_v30.hdr -> written (min=0,max=1580).
  ./image_10_v31.img -> written,  ./image_10_v31.hdr -> written (min=0,max=1275).
  ./image_10_v32.img -> written,  ./image_10_v32.hdr -> written (min=0,max=1189).
  ./image_10_v33.img -> written,  ./image_10_v33.hdr -> written (min=0,max=1115).

Note that the dynamic image was reconstruced using an iterative algorithm. Hence there are no negative voxel values. The maximum value was observed in frame (volume) 11.


cmrgima - convert 45 min IRF images or KI images into Cerebral Metabolic Rate of Glucose parametric images

Type Bourne shell script, requires the binaries ShowHdr and EditHdr
Location /opt/wmic/bin
Version2.3

Description: cmrgima is a Bourne shell script to create parametric images of the Cerebral Metabolic Rate of Glucose (CMRGl) from parametric images of IRF45 min (obtained from Spectral Analysis) or KI (e.g. created with plasma input function Patlak Analysis). The parametric images must be in Analyze image 7.5 file format and can currently be provided by any of the following three applications:

To calculate the mean plasma glucose concentration during the PET scan, the user is prompted to enter a series of plasma glucose concentration measurements in millimolar units (i.e. in mmol/l= μmol/ml). The relative molecular mass of glucose C6H12O6 is 180 g/mol, plasma glucose measurements in gram glucose per liter plasma have to be converted accordingly.

The default lumped constant in cmrgima is 0.48 (Sokoloff et al., 1977). The command line option -l LC can be used to specify a different value LC as lumped constant.

The CMRGl parametric images are saved as signed 16-bit Analyze image file in units of μmol/ml/min = mmol/l/min. To convert them into mg/100 ml/min, all values have to be multiplied by 18.

The output images have the same endianness as the input files independent of the machine type on which cmrgima is run.

Reference:
Sokoloff, L.; Reivich, M.; Kennedy, C.; Des Rosiers, M.H.; Patlak, C.S.; Pettigrew, K.D.; Sakurada, O.; Shinohara, M.
The [14C]deoxyglucose method for the measurement of local cerebral glucose utilization: theory, procedure, and normal values in the conscious and anesthetized albino rat.
J. Neurochem. 28 (1977), 897 - 916.

Usage: cmrgima [-l LC] [-o] h01234_45min.hdr t56789_PPM_Ki.hdr ...

 -l LC  define an alternative value for the lumped constant (default
        value: LC=0.48)
 -o     overwrite ON (default: if the output files `h01234_45min_cmrg.hdr'
        and `h01234_45min_cmrg.img' already exist, they will not be over-
        written)

Example 1: Conversion of a 45 min IRF image

% cmrgima t00321_45min.hdr

Input file    : "t00321_45min.hdr" (type 0)
  ROIScale    = 3.0592648e-08 = 0x330364f9 (single precision)
  cal_max     = 1.0024293e-03 = 0x3a8363f2 (single precision)

Enter Plasma Glucose Samples in Millimolar Units (concentration in mmol/l):
*** press Ctrl-D (^D) to finish input ***
   Sample 0   = 5.70
   Sample 1   = 5.54
   Sample 2   = 5.50
   Sample 3   = 5.36
   Sample 4   = 5.50
   Sample 5   = done.
    Mean      =  5.52000000000000e+00 mmol/l
    Lumped Con= 0.48
  Output Image= Input Image *  1.15000000000000e+01 * 60
  ROIScale    =  2.11089271200000e-05 (double precision)
  cal_max     =  6.91676217000000e-01 (double precision)

Output files  : "./t00321_45min_cmrg.img" -> written.
                "./t00321_45min_cmrg.hdr" -> written.
  ROIScale    = 2.1108926e-05 = 0x37b11313 (single precision)
  cal_max     = 6.9167620e-01 = 0x3f3111b1 (single precision)

The conversion was performed on a machine with the same endianness as the input image.

Example 2: Conversion of a KI image

% cmrgima t00321_Ki.hdr

  WARNING: t00321_Ki.hdr: glmax= 32766 (should normally be 32767).
  Input file    : "t00321_Ki.hdr" (type 1)
  ROIScale    = 1.1460926e-05 = 0x4d484037 (single precision - bytes need to be swapped)
  cal_max     = 3.7554014e-01 = 0xcc46c03e (single precision - bytes need to be swapped)
  cal_min     = -3.7077731e-01 = 0x86d6bdbe (single precision - bytes need to be swapped)
  
  Enter Plasma Glucose Samples in Millimolar Units (concentration in mmol/l):
  *** press Ctrl-D (^D) to finish input ***
  Sample 0   = 5.70
  Sample 1   = 5.54
  Sample 2   = 5.50
  Sample 3   = 5.36
  Sample 4   = 5.50
  Sample 5   = done.
  Mean      =  5.52000000000000e+00 mmol/l
  Lumped Con= 0.48
  Output Image= Input Image *  1.15000000000000e+01 * 1
  ROIScale    =  1.31800649000000e-04 (double precision)
  cal_max     =  4.31871161000000e+00 (double precision)
  cal_min     = -4.26393906500000e+00 (double precision)
  
  Output files  : "./t00321_Ki_cmrg.img" -> written.
                  "./t00321_Ki_cmrg.hdr" -> written.
  ROIScale    = 1.3180065e-04 = 0xf8330a39 (single precision - bytes need to be swapped)
  cal_max     = 4.3187118e+00 = 0xe3328a40 (single precision - bytes need to be swapped)
  cal_min     = -4.2639389e+00 = 0x307288c0 (single precision - bytes need to be swapped)

The conversion was performed on a machine with an endianness different to the input image. This can be seen at the comment bytes need to be swapped for the hexadecimal screen output of the 32-bit single precision float values. However, this has no effect on the output images created, they are the same independent of the machine type on which cmrgima is run.


ima2obj - convert image file(s) into Analyze Object Map file(s)

Type binary executable, AVW library required
Location /opt/wmic/bin (Solaris/Linux wrapper script)
\\MMIC_FS1\WMIC_Apps, \\MMIC-FS1\WMIC_Apps\win64 (32-bit/64-bit Windows binaries)
Version3.4

Description: ima2obj is a simple command line tool to convert image files into Analyze Object Map files. The input image files can be of any format that can be read by the AVW library. However, each file must contain a single volume (frame). If the data type is not AVW_UNSIGNED_CHAR, then the image is first converted into an unsigned 8-bit integer image. If the command line option -r is specified, then all unused objects are removed from the Object Map file.

Usage: ima2obj [-o] [-r] [-y] [-n 1...255] file[s]


 -o             overwrite ON (default: if the output file `file.obj' 
                already exists, it will not be overwritten)
 -r             remove all the unused objects. This is any object 
                which does not have at least one corresponding voxel
                in the object map.
 -y             y flip. All input image volumes will be flipped 
                vertically.
 -n 1...255     the number of objects to create. Every Object Map
                has one background object "Original" representing
                all voxels with a value of zero.
                By default, the number of objects created is equal
                to the maximum voxel value found in the image file.
 file[s]        the name[s] of the image file[s] to be converted.
                They can be of any file format that can be opened 
                by AVW_OpenImageFile(). However, each file must
                not contain more than a single volume. If the data
                type is not AVW_UNSIGNED_CHAR, then the image is first
                converted into an unsigned 8-bit integer image.

Example 1:

% ima2obj h00116_mask.hdr h00116_atlas.hdr h00116_test.avw
Input file    : "h00116_mask.hdr"
  Data format =   4  AnalyzeImage(7.5)
  Data type   =   1  AVW_UNSIGNED_CHAR
  NumVols     =   1
  Width       = 181
  Height      = 217
  Depth       = 181
  Voxel width = 1 mm
  Voxel height= 1 mm
  Voxel depth = 1 mm
  glmin       =   0
  glmax       =   1
Output file   : "h00116_mask.obj"
  File format = OBJMAP, version 20050829
  NumObjects  =   2

=============================================================================

Input file    : "h00116_atlas.hdr"
  Data format =  46  NIFTI
  Data type   =   1  AVW_UNSIGNED_CHAR
  NumVols     =   1
  Width       = 135
  Height      = 175
  Depth       = 130
  Voxel width = 1.21875 mm
  Voxel height= 1.21875 mm
  Voxel depth = 1.21875 mm
  glmin       =   0
  glmax       =  83
Output file   : "h00116_atlas.obj"
  File format = OBJMAP, version 20050829
  NumObjects  =  84

=============================================================================

Input file    : "h00116_test.avw"
  Data format =   0  AnalyzeAVW
  Data type   =   1  AVW_UNSIGNED_CHAR
  NumVols     =   1
  Width       = 120
  Height      = 160
  Depth       = 120
  Voxel width = 1 mm
  Voxel height= 1 mm
  Voxel depth = 1 mm
  glmin       =   0
  glmax       =   5
Output file   : "h00116_test.obj"
  File format = OBJMAP, version 20050829
  NumObjects  =   6

Example 2: Explicitly specify the number of objects to create

The image c2h01293_pam.hdr was the product of the thresholded probabilistic white matter map (class 2) generated with SPM and the 83-region brain atlas warped into individual space (similar to this example). However, the output file created by mulimg had a global maximum value of only 82 and not 83 indicating that there was no surviving voxel with the value 83 corresponding to the structure "G_sup_temp_ant_r" in the 83-region brain atlas.
Therefore ima2obj needs to be called with the command line option -n 83 to create an Object Map with 83 objects:

% ima2obj -n 83 c2h01293_pam.hdr
Input file    : "c2h01293_pam.hdr"
  Data format =   4  AnalyzeImage(7.5)
  Data type   =   1  AVW_UNSIGNED_CHAR
  NumVols     =   1
  Width       = 130
  Height      = 140
  Depth       = 124
  Voxel width = 1.21875 mm
  Voxel height= 1.21875 mm
  Voxel depth = 1.21875 mm
  glmin       =   0
  glmax       =  82
  --> 83 Objects will be added.
Output file   : "c2h01293_pam.obj"
  File format = OBJMAP, version 20050829
  NumObjects  =  84

The command showobjn can now be called to double check the number of objects in the Object Map file:

% showobjn -v c2h01293_pam.obj
Object Map    : "c2h01293_pam.obj"
  Version     = 20050829
  Width       = 130
  Height      = 140
  Depth       = 124
  NumObjects  =  84
  NumVoxels   = 2256800
    1: "                        Original", 2064819 voxels, R=255, G=255, B=255
    2: "                        Object_2",       0 voxels, R=255, G=  0, B=  0
    3: "                        Object_3",      16 voxels, R=  0, G=255, B=  0
    4: "                        Object_4",       0 voxels, R=255, G=255, B=  0
    5: "                        Object_5",       0 voxels, R=  0, G=  0, B=255
    6: "                        Object_6",       0 voxels, R=255, G=  0, B=255
    7: "                        Object_7",     637 voxels, R=  0, G=255, B=255
... ... ...
   77: "                       Object_77",     259 voxels, R= 70, G=255, B=255
   78: "                       Object_78",     272 voxels, R=185, G=185, B=185
   79: "                       Object_79",       5 voxels, R=255, G= 77, B= 77
   80: "                       Object_80",       0 voxels, R= 77, G=255, B= 77
   81: "                       Object_81",      50 voxels, R=255, G=255, B= 77
   82: "                       Object_82",      40 voxels, R= 77, G= 77, B=255
   83: "                       Object_83",     229 voxels, R=255, G= 77, B=255
   84: "                       Object_84",       0 voxels, R= 77, G=255, B=255

As expected, "Object_84" is listed as an empty object with 0 voxels at the end of the list.
Now, panames can be called to label the objects according to the 83-region Probabilistic Brain Atlas:

% panames c2h01293_pam.obj
Object Map file    : c2h01293_pam.obj
  Number of objects: 84
  object names succesfully changed using atlas 4.

Another call of showobjn finally confirms that the empty object "G_sup_temp_ant_r" with 0 voxels exists at the end of the list:

% showobjn -v c2h01293_pam.obj
Object Map    : "c2h01293_pam.obj"
  Version     = 20050829
  Width       = 130
  Height      = 140
  Depth       = 124
  NumObjects  =  84
  NumVoxels   = 2256800
    1: "                        Original", 2064819 voxels, R=255, G=255, B=255
    2: "                   Hippocampus_r",       0 voxels, R=255, G=  0, B=  0
    3: "                   Hippocampus_l",      16 voxels, R=  0, G=255, B=  0
    4: "                      Amygdala_r",       0 voxels, R=255, G=255, B=  0
    5: "                      Amygdala_l",       0 voxels, R=  0, G=  0, B=255
    6: "                    Ant_TL_med_r",       0 voxels, R=255, G=  0, B=255
    7: "                    Ant_TL_med_l",     637 voxels, R=  0, G=255, B=255
... ... ...
   77: "                Subgen_antCing_l",     259 voxels, R= 70, G=255, B=255
   78: "                Subgen_antCing_r",     272 voxels, R=185, G=185, B=185
   79: "                  Subcall_area_l",       5 voxels, R=255, G= 77, B= 77
   80: "                  Subcall_area_r",       0 voxels, R= 77, G=255, B= 77
   81: "             Presubgen_antCing_l",      50 voxels, R=255, G=255, B= 77
   82: "             Presubgen_antCing_r",      40 voxels, R= 77, G= 77, B=255
   83: "                G_sup_temp_ant_l",     229 voxels, R=255, G= 77, B=255
   84: "                G_sup_temp_ant_r",       0 voxels, R= 77, G=255, B=255

In fact, there are several other empty objects ("Hippocampus_r", "Amygdala_r", "Amygdala_l", "Ant_TL_med_r" and "Subcall_area_r") shown in this part of the screen output. Each empty object creates a tacstats warning message similar to that shown in examples 1 and 2 below:

"WARNING: object XY does not mask anything - skipped"

A call of tacstats with the command line switch -w suppresses this warning message and inserts a line with NaN (not a number) entries in the output for each of the empty objects as shwon in example 3 below.


showobjn - show Object Map numbers [and names]

Type binary executable, AVW library required
Location /opt/wmic/bin (Solaris/Linux wrapper script)
\\MMIC_FS1\WMIC_Apps, \\MMIC-FS1\WMIC_Apps\win64 (32-bit/64-bit Windows binaries)
Version1.4

Description: showobjn is a command line program to display the number of objects in an Analyze Object Map file.
If the verbosity flag -v is set, a list of the objects with name string, voxel numbers and RGB values is printed.

Usage: showobjn [-v|l] file[s]

 -v             verbose: list the names and voxel numbers of the individual objects
 -l             long format: list full attributes of the individual objects
                (default: only the total number of objects and voxels is reported)
 file[s]        the name[s] of the Analyze Object Map file[s]

Example 1: Show the number of objects in the Object Maps

% showobjn h00116.obj t00799.obj
Object Map    : "h00116.obj"
  Version     = 20050829
  Width       = 120
  Height      = 160
  Depth       = 120
  NumObjects  =   6
  NumVoxels   = 2304000

================================================================================

Object Map    : "t00799.obj"
  Version     = 910926
  Width       = 128
  Height      = 128
  Depth       =  63
  NumObjects  =  10
  NumVoxels   = 1032192

Example 2: Print a full list of the objects in the Object Maps

% showobjn -v h00116.obj t00799.obj
Object Map    : "h00116.obj"
  Version     = 20050829
  Width       = 120
  Height      = 160
  Depth       = 120
  NumObjects  =   6
    1: "                        Original", 2285660 voxels, R=255, G=255, B=255
    2: "                      cerebellum",    8816 voxels, R=255, G=  0, B=  0
    3: "                      thalamus_r",    1169 voxels, R=  0, G=255, B=  0
    4: "                      thalamus_l",    1312 voxels, R=255, G=255, B=  0
    5: "                            soft",    3305 voxels, R=  0, G=  0, B=255
    6: "                            bone",    3738 voxels, R=255, G=  0, B=255
  NumVoxels   = 2304000
  
================================================================================
  
Object Map    : "t00799.obj"
  Version     = 910926
  Width       = 128
  Height      = 128
  Depth       =  63
  NumObjects  =  10
    1: "                        Original",  992754 voxels, R=255, G=255, B=255
    2: "                       frontal_r",    3862 voxels, R=255, G=  0, B=  0
    3: "                       frontal_l",    3804 voxels, R=  0, G=255, B=  0
    4: "                       temppar_r",    8572 voxels, R=255, G=255, B=  0
    5: "                       temppar_l",    8400 voxels, R=  0, G=  0, B=255
    6: "                       occipit_r",    6236 voxels, R=255, G=  0, B=255
    7: "                       occipit_l",    5583 voxels, R=  0, G=255, B=255
    8: "                       cerebel_r",    1535 voxels, R=255, G=255, B=255
    9: "                       cerebel_l",    1446 voxels, R=255, G=  7, B=  7
   10: "                       brainstem",       0 voxels, R=  7, G=255, B=  7
  NumVoxels   = 1032192

Note: Object 10 "brainstem" is an entry in the object list, however, it actually does not contain any voxel.


objncopy - object name copy command

Type binary executable, AVW library required
Location /opt/wmic/bin (Solaris/Linux wrapper script)
\\MMIC_FS1\WMIC_Apps, \\MMIC-FS1\WMIC_Apps\win64 (32-bit/64-bit Windows binaries)
Version1.4

Description: The object name copy program objncopy is a small utility that transfers the object name list from a source Analyze Object Map file into destination Object Map file(s). As an example, this is useful after an Analyze Image file has been converted with ima2obj into an Analyze Object Map file and the object name list has automatically been set to the default of "Object_1", "Object_2", "Object_3" etc. This happens, for instance, after an Object Map originally defined on the MR image has been resliced from the subject's MRI space into the subject's PET space. Then objncopy can be used to define the object name list of the resliced (destination) Object Map file using the original object name list of the original (source) Object Map file.
objncopy only works if the numbers of objects in the source and the destination Object Map files are the same. Otherwise, it exits with an error message and no change is performed. Therefore, it is important that the original Object Map does not contain any "empty" objects (see the example of the "brainstem" object above), because these empty objects are removed when the Object Map is saved as an Analyze 7.5 image file.

Usage: objncopy source.obj dest1.obj [dest2.obj ...]

Copies the object names from the `sourc.obj' file
into the `dest.obj' file if the numbers of objects in
both Analyze Object Map files are equal. Otherwise
nothing is changed. Multiple destination Object
Map files can be specified on the command line.

Example 1: Object Map file t00799.obj with 10 objects from the showobjn example above

% objncopy t00799.obj t00799_resliced.obj
Source file   : "t00799.obj"
  Version     = 910926
  Width       = 128
  Height      = 128
  Depth       =  63
  NumObjects  =  10
Destination fi: "t00799_resliced.obj"
  Version     = 20050829
  Width       = 128
  Height      = 128
  Depth       =  63
  NumObjects  =   9
The number of objects must not differ between the files!
  ==> NOTHING CHANGED
Exit 5

Example 2: Object Map file t00799.obj after removing the "empty" object "brainstem"

% objncopy t00799_original.obj t00799_resliced.obj
Source file   : "t00799_original.obj"
  Version     = 20050829
  Width       = 128
  Height      = 128
  Depth       =  63
  NumObjects  =   9
Destination fi: "t00799_resliced.obj"
  Version     = 20050829
  Width       = 128
  Height      = 128
  Depth       =  63
  NumObjects  =   9
    1: was "Original" is now "Original"
    2: was "Object_2" is now "frontal_r"
    3: was "Object_3" is now "frontal_l"
    4: was "Object_4" is now "temppar_r"
    5: was "Object_5" is now "temppar_l"
    6: was "Object_6" is now "occipit_r"
    7: was "Object_7" is now "occipit_l"
    8: was "Object_8" is now "cerebel_r"
    9: was "Object_9" is now "cerebel_l"
Modified Object Map "t00799_resliced.obj" succesfully saved.

panames - give the objects in an Analyze Object Map file the names from the Probabilistic Brain Atlas

Type binary executable, AVW library required
Location /opt/wmic/bin (Solaris/Linux wrapper script)
\\MMIC_FS1\WMIC_Apps, \\MMIC-FS1\WMIC_Apps\win64 (32-bit/64-bit Windows binaries)
Version2.3

Description: panames is a command line program which applies a predefined object name list to an Analyze Object Map file. Currently, six such predefined object name lists are implemented, with either 50, 51, 68, 74, 84 or 86 entries. When panames opens an Object Map file, it checks whether the number of objects defined in that file matches any of these numbers and writes the corresponding object name list into that Object Map file. If the number of objects does not match, then nothing is changed.
panames can be thought of as a special case of the objncopy utility that uses built in lists of object names instead of reading the object name list from a source Object Map file.

References:

Hammers, A.; Koepp, M.J.; Free, S.L.; Brett, M.; Richardson, M.P.; Labbé, C.; Cunningham, V.J.; Brooks, D.J.; Duncan, J.
Implementation and application of a brain template for multiple volumes of interest.
Hum Brain Mapp 15 (2002), 165 - 174.

Hammers, A.; Allom, R.; Koepp, M.J.; Free, S.L.; Myers, R.; Lemieux, L.; Mitchell, T.N.; Brooks, D.J.; Duncan, J.S.
Three-dimensional maximum probability atlas of the human brain, with particular reference to the temporal lobe.
Hum Brain Mapp 19 (2003), 224 - 247

Hammers, A.; Chen, C.-H.; Lemieux, L.; Allom, R.; Vossos, S.; Free, S.L.; Myers, R.; Brooks, D.J.; Duncan, J.S.; Koepp, M.J.
Statistical neuroanatomy of the human inferior frontal gyrus and probabilistic atlas in a standard stereotaxic space.
Hum. Brain Mapp. 28 (2007), 34 - 48.

Rylands, A.J.; Hinz, R.; Jones, M.; Holmes, S.E.; Feldmann, M.; Brown, G.; McMahon, A.W.; Talbot, P.S.
Pre- and postsynaptic serotonergic differences in males with extreme levels of impulsive aggression without callous unemotional traits: a PET study using 11C-DASB and 11C-MDL100907.
Biol. Psychiatry 72 (2012), 1004 - 1011.

Usage: panames [-p 0|1|2|3|4|5] filename[s]

 -p n   print the names of the objects in the probabilistic atlas `n' and exit

Example 1: Obtain the object name list of atlas 2, i.e. the list with 68 entries

% panames -p 2

The following object names are defined in the Probabilistic Brain Atlas 2:
  Object  1: "Original"
  Object  2: "Hippocampus_r"
  Object  3: "Hippocampus_l"
  Object  4: "Amygdala_r"
  Object  5: "Amygdala_l"
  Object  6: "Ant_TL_med_r"
  Object  7: "Ant_TL_med_l"
  Object  8: "Ant_TL_lat_r"
  Object  9: "Ant_TL_lat_l"
  Object 10: "G_paraH_amb_r"
  Object 11: "G_paraH_amb_l"
  Object 12: "G_sup_temp_r"
  Object 13: "G_sup_temp_l"
  Object 14: "G_tem_midin_r"
  Object 15: "G_tem_midin_l"
  Object 16: "G_occtem_la_r"
  Object 17: "G_occtem_la_l"
  Object 18: "Cerebellum_r"
  Object 19: "Cerebellum_l"
  Object 20: "Brainstem"
  Object 21: "Insula_l"
  Object 22: "Insula_r"
  Object 23: "OL_rest_lat_l"
  Object 24: "OL_rest_lat_r"
  Object 25: "G_cing_ant_l"
  Object 26: "G_cing_ant_r"
  Object 27: "G_cing_post_l"
  Object 28: "G_cing_post_r"
  Object 29: "FL_mid_fr_G_l"
  Object 30: "FL_mid_fr_G_r"
  Object 31: "PosteriorTL_l"
  Object 32: "PosteriorTL_r"
  Object 33: "PL_rest_l"
  Object 34: "PL_rest_r"
  Object 35: "CaudateNucl_l"
  Object 36: "CaudateNucl_r"
  Object 37: "NuclAccumb_l"
  Object 38: "NuclAccumb_r"
  Object 39: "Putamen_l"
  Object 40: "Putamen_r"
  Object 41: "Thalamus_l"
  Object 42: "Thalamus_r"
  Object 43: "Pallidum_l"
  Object 44: "Pallidum_r"
  Object 45: "Corp_Callosum"
  Object 46: "FrontalHorn_r"
  Object 47: "FrontalHorn_l"
  Object 48: "TemporaHorn_r"
  Object 49: "TemporaHorn_l"
  Object 50: "ThirdVentricl"
  Object 51: "FL_precen_G_l"
  Object 52: "FL_precen_G_r"
  Object 53: "FL_strai_G_l"
  Object 54: "FL_strai_G_r"
  Object 55: "FL_orbitofr_l"
  Object 56: "FL_orbitofr_r"
  Object 57: "FL_inf_fr_G_l"
  Object 58: "FL_inf_fr_G_r"
  Object 59: "FL_sup_fr_G_l"
  Object 60: "FL_sup_fr_G_r"
  Object 61: "PL_postce_G_l"
  Object 62: "PL_postce_G_r"
  Object 63: "PL_sup_pa_G_l"
  Object 64: "PL_sup_pa_G_r"
  Object 65: "OL_ling_G_l"
  Object 66: "OL_ling_G_r"
  Object 67: "OL_cuneus_l"
  Object 68: "OL_cuneus_r"

Example 2: Change the object name list in an Object Map file

% panames t00782.obj

Object Map file    : t00782.obj
  Number of objects: 68
  object names succesfully changed using atlas 2.

obj2ima - convert Analyze Object Map file(s) into Analyze 7.5 Image file(s)

Type binary executable, AVW library required
Location /opt/wmic/bin (Solaris/Linux wrapper script)
\\MMIC_FS1\WMIC_Apps, \\MMIC-FS1\WMIC_Apps\win64 (32-bit/64-bit Windows binaries)
Version1.2

Description: ima2obj implements the two setp sequence "Load As" of an Object Map file (*.obj) followed by "Save As" with the "Format" set to "AnalyzeImage(7.5)" in the Analyze Main Workspace. As the Analyze Object Map files do not carry information about their pixel sizes, the pixel dimensions of the saved output images is set to the default value of 1.0 mm as width, height and depth of the voxels.
By specifying an optional reference image the voxel width, height and depth of the reference image can be transcribed into the output images. If the reference image also contains a valid SPM orign, then this is transcribed into the output images, too.

Usage: obj2ima [-o] [-r refer.hdr] file1.obj [file2.obj [file3.obj ...]]


 -o             overwrite ON, default: if the output files `filen.img'
                or `filen.hdr' (n= 1, 2, ...) already exist, then they
                will not be overwritten.
 -r refer.hdr   optional reference image in Analyze 7.5 Image format.
                Without specifying this reference image, all output
                images have the pixel dimensions of 1 mm and no SPM
                origin set. If a reference image is given, then the
                voxel width, height and depth and the SPM origin of
                the output images are set to those read from the header
                file of the reference image.
 filen.obj      Analyze Object Map file(s) to be converted (n= 1, 2,
                ...). The output files are all in Analyze 7.5 Image
                format, data type AVW_UNSIGNED_CHAR (unsigned 8-bit
                integer).

Example:

% obj2ima -r h00840_mr2pet.hdr wh00840_mask.obj
Reference file: "h00840_mr2pet.hdr"
  Data format =   4  AnalyzeImage(7.5)
  Data type   =   4  DT_SIGNED_SHORT
  NumVols     =   1
  Width       = 130
  Height      = 160
  Depth       = 124
  Voxel width = -1.21875 mm
  Voxel height= 1.21875 mm
  Voxel depth = 1.21875 mm
  SPM Origin  = [ 66, 96, 54]

Object Map  1 : "wh00840_mask.obj"
  Version     = 20050829
  NumObjects  =   2
Output file  1: "wh00840_mask.hdr"
  glmin       =   0
  glmax       =   1

tacstats - create time activity curve statistics

Type binary executable, AVW library required
Location /opt/wmic/bin (Solaris/Linux wrapper script)
\\MMIC_FS1\WMIC_Apps, \\MMIC-FS1\WMIC_Apps\win64 (32-bit/64-bit Windows binaries)
Version2.13

Description: tacstats is a command line program alternative to the Sample Images procedure in the Region Of Interest module of Analyze. It saves a lot of time when time-activity curves are to be generated from sampling dynamic images (multiple frames) with an Analyze Object Map. It is also convenient to sample the series of single frame Analyze files which are created as the output of various parametric imaging programs. The images to be sampled can be of data type 16-bit signed integer, single precision (32-bit) float or double precision (64-bit) floating point.
The tacstats output in WMIC CSV format is printed on the standard output stream. It can easily be piped through filter programs and redirected into files. The format of the floating point values can be configured via the -f command line option.
As opposed to the STATS files created with the Region Of Interest module of Analyze, with tacstats it is possible to incorporate information on the frame times and total counts in the header section of the output. This requires to specify the Scan Information File in WMIC CSV format of the dynamic image as the third command line argument when invoking tacstats.

Caveat: tacstats does not issue a warning or error message if planes which are entirely zero (as often the outer planes of 3D images are) are sampled! This is likely to result in wrong results for minval, mean and stddev. The parameters skewness and excess derived from the third and fourth order sample central moments may be more sensitive to this problem and should therefore be carefully checked!

Let xj denote the voxel value (intensity) in the voxel of the ROI with the subscript j and let N be the total number of voxels in the ROI. Let the ordered set of voxel values be x1*x2* ≤ ... ≤ xN*. Then the following equations are used by tacstats:

Notes:

For the terminology positive skewness and negative skewness and examples, refer to webpages such as Wikipedia or Wolfram MathWorld.
For the terminology mesokurtic, leptokurtic and platykurtic and examples, refer to webpages such as Wikipedia or Wolfram MathWorld.
For the statistical median, refer to the the Wolfram MathWorld webpage and the excellent notes of Nicolas Devillard.

The command line option -v can be used to investigate the distribution of the voxel values within a region of interest. Note, however, that the created output of comma-separated values (CSV) does not comply with the WMIC CSV file format guideline. Rather it is recommended to pipe the output through filter tools to create an output that can easily be imported into standard statistical analysis software.

Usage: tacstats [-f format] [-s] [-v] [-w] objectmap.obj dynamic.hdr [id_sif.csv] [> tac_stats.csv]

 -f format      a string specifying the output conversion of the
                floating point values (default: %.6f)
                See the Standard C Library Functions printf(3C)
                manpage for examples.
 -s             summing ON (default: an output line for every
                slice will be printed)
 -v             print the voxel values instead of performing the
                statistics. This option can be used for subsequent
                data analyis with statistical stand alone software.
 -w             alter the default behaviour of printing a message
                "WARNING: object XY does not mask anything - skipped"
                which results in no line for this object in the output.
                If this warning message is switched off, then a
                line with NaN (not a number) entries is inserted
                in the output for each empty object encountered.
 objectmap.obj  the name of the Analyze Object Map file defining
                the volumes of interest
 dynamic.hdr    the name of the dynamic image file in Analyze file format 
                to be sampled
 id_sif.csv     optional argument, the name of the Scan Information
                File in CSV format
                If given, the scan information will be transcribed as
                CSV file metadata.
 tac_stats.csv  optional redirection of the output into a TAC
                statistics file in CSV format
                If omitted, the standard output will be used which
                can be piped through filters (such as grep) for
                reformatting.

Example 1: Sample a dynamic PET image and save the full statistics in a WMIC CSV file

% tacstats rct1.obj hirez_20060623_160920_s09_nf02.hdr hirez_20060623_160920_s09_nf02_sif.csv > h00005_stats.csv

WARNING: object 11 "11.Object" does not mask anything - skipped.
The output has been saved in the file h00005_stats.csv. The information from the Scan Information File has been transcribed into the header section scan information.

Example 2: Sample a dynamic PET image and save the short statistics in a WMIC CSV file

% tacstats -s rct1.obj hirez_20060623_160920_s09_nf02.hdr hirez_20060623_160920_s09_nf02_sif.csv > h00005s_stats.csv
WARNING: object 11 "11.Object" does not mask anything - skipped.
The output has been saved in the file h00005s_stats.csv. The output is summed across image planes such that there is one line for each region and frame.

Example 3: Sample a dynamic PET image including the unused object[s] and save the short statistics in a WMIC CSV file

% tacstats -sw rct1.obj hirez_20060623_160920_s09_nf02.hdr hirez_20060623_160920_s09_nf02_sif.csv > h00005sw_stats.csv

The output has been saved in the file h00005sw_stats.csv. In contrast to the previous example, no WARNING message about "11.Object" is printed. Rather this object is now included in the output file with a voxel number of 0 in the last column and all other numeric readouts set to NaN (not a number).

Example 4: Sample a static PET image and save the voxel statistics in a WMIC CSV file

% tacstats -v c1h00313_r17.obj h00313_g2_add_dc.hdr > h00313c1r17_vstats.csv

The voxel statistics file h00313c1r17_vstats.csv can be further processed with vstats2vec.

Combining two regions, e.g. left and right

After the results are imported into spread sheet software, sometimes the question arises: What would the results be if two regions were already combined in the Analyze ROI tool and the results were calculated for that combined region?

Under the assumption that the two regions do not overlap, i.e. no pixel is member of both regions, the following formulae may be used:

N1... number of voxels region 1 N2... number of voxels region 2 N1+2... number of voxels regions 1 and 2 combined
mean1... mean value from region 1 mean2... mean value from region 2 mean1+2... mean value from regions 1 and 2 combined
var1... variance from region 1 var2... variance from region 2 var1+2... variance from regions 1 and 2 combined
Note: var = stddev2

The Excel file t00813_Ki_rl.xls gives an example how the results for left and right regions combined can be calculated.


stats2xls - read cohort of STATS CSV files and write the data into an XLS file

Type binary executable (deployed Matlab R2009b SP1 application)
Location \\MMIC_FS1\WMIC_Apps, \\MMIC-FS1\WMIC_Apps\win64 (32-bit/64-bit Windows binaries)
Version4.1

Description: This function loads from the current working directory all WMIC CSV (*.csv) files. Each of the WMIC CSV STATS files must be produced from a single frame image with the `tacstats -s' command to generate one line of statistics output per region. It is a requirement that the list of the region names is the same in all the STATS files. This is usually the case if all STATS files were generated with the same Analyze Object Map file, for example in template space.
A a separate Worksheet in an Excel Workbook is inserted for each of the outcome parameters 'maxval', 'minval', 'mean', 'stddev', 'skewness', 'excess' and 'median'. The first column of each Worksheet contains the names of the volume files sampled. The two top rows of each Worksheet consist of the names of the regions and the number of voxels per region. If the number of voxels per region is not the same for all the STATS files loaded, then an additional Worksheet 'voxels' is added to the Excel Workbook.
The user is prompted to name an output file to save (default: "output.xlsx"). If a file with the selected name already exists, a dialogue requests confirmation that it can be replaced with the new file. Note that the version of the saved Excel file depends on the Microsoft Excel installed on the local machine and not on the Matlab version.

Optional input: A pattern for the regular expression to select the WMIC CSV files to read can be specified. The default pattern is '\w+\.csv$' i.e. all files with the extension '.csv' are selected. See Regular Expressions in the MATLAB Programming Fundamentals documentation for more information on how to match patterns. For example in the default pattern, '\w' matches any alphabetic, numeric, or underscore character and the quantifier '+' matches that character one or more times. The positional operator '$' defines that the file name must end with the four characters '.csv'.

Examples:

    \\MMIC-FS1\WMIC_Apps\win64\stats2xls \w+_brain.*\.csv$ brain.xlsx
    \\MMIC-FS1\WMIC_Apps\win64\stats2xls \w+_cereb.*\.csv$
  
The pattern '.*' matches any single character (including white space) zero or more times.

Example: Process the STATS CSV files from 11 subjects generated with a 28-region brain atlas.

Run in a DOS Command Window:

\\MMIC-FS1\WMIC_Apps\stats2xls
11 files matching the pattern "\w+\.csv" found.
  1 file "17015i_brain.csv" read.
  2 file "17016i_brain.csv" read.
  3 file "17017i_brain.csv" read.
  4 file "17018i_brain.csv" read.
  5 file "17019i_brain.csv" read.
  6 file "17020i_brain.csv" read.
  7 file "17021i_brain.csv" read.
  8 file "17022i_brain.csv" read.
  9 file "17023i_brain.csv" read.
 10 file "17024i_brain.csv" read.
 11 file "17025i_brain.csv" read.
Processing data from 28 region(s) for each file...
 - done.
Saving the output in "output.xlsx" ...
  1 worksheet 'maxval' appended.
  2 worksheet 'minval' appended.
  3 worksheet 'mean' appended.
  4 worksheet 'stddev' appended.
  5 worksheet 'skewness' appended.
  6 worksheet 'excess' appended.
  7 worksheet 'median' appended.


vstats2vec - extract region vectors from voxel statistics CSV data

Type GAWK or NAWK script
Location /opt/wmic/bin
Version1.2

Description: This GAWK script reformats the voxel statistics output from the tacstats program and creates a vector file for each region in the current working directory. The vector files are plain text files containing one column with the (integer) voxel values separated by commas. These vector files can easily be loaded into standard statistics software to perform further analyses on the distribution of the voxel values.
The program vec2xls can be used to load a cohort of vector files and then write the data into one Microsoft Excel Workbook file.

Usage:
vstats2vec n01234_vstats.csv
or:
tacstats -v objectmap.obj image.hdr | vstats2vec -

Example: Process the voxel statistics file h00313c1r17_vstats.csv from the Example 3 above.

% vstats2vec h00313c1r17_vstats.csv
    1: "                    MesialTemp_r.vec" written:    1607 voxels.
    2: "                    MesialTemp_l.vec" written:     935 voxels.
    3: "                   TemporaLobe_r.vec" written:   27906 voxels.
    4: "                   TemporaLobe_l.vec" written:   20902 voxels.
    5: "                    Cerebellum_r.vec" written:   24895 voxels.
    6: "                    Cerebellum_l.vec" written:   26466 voxels.
    7: "                       Brainstem.vec" written:    4300 voxels.
    8: "                        Insula_l.vec" written:    2037 voxels.
    9: "                        Insula_r.vec" written:    2832 voxels.
   10: "                   FrontalLobe_l.vec" written:   31774 voxels.
   11: "                   FrontalLobe_r.vec" written:   35916 voxels.
   12: "                   OccipitLobe_l.vec" written:   20105 voxels.
   13: "                   OccipitLobe_r.vec" written:   21272 voxels.
   14: "                   ParietalLob_l.vec" written:   25426 voxels.
   15: "                   ParietalLob_r.vec" written:   28443 voxels.
   16: "                       Central_l.vec" written:    3418 voxels.
   17: "                       Central_r.vec" written:    3705 voxels.
  NumVoxels   =  281939

vec2xls - load cohort of VEC files and write the data into an XLS file

Type binary executable (deployed Matlab R2009b SP1 application)
Location \\MMIC_FS1\WMIC_Apps, \\MMIC-FS1\WMIC_Apps\win64 (32-bit/64-bit Windows binaries)
Version3.2

Description: This function loads from the current working directory all vector (*.vec) files. These vector files are usually generated with the (N)AWK script `vstats2vec' from a voxel statistics CSV file produced from a single frame image with `tacstats -v'. They are plain text files with just a single column of (integer) numbers.
Then these vectors are horizontally concatenated into a double matrix X. To allow for vectors of variable length, the number of rows of X is equal to the length of the longest vector. The other (shorter) vectors are filled up with NaN (Not-a-Number) to the same length. The number of columns of X is equal to the number of vector files loaded.
The cell array regions contains the names of the vector files loaded with the '.vec' extension removed. It has one row and as many columns as X. The cell array stat contains statistic output such as the numnber of voxels n and the maximum data value, minimum data value, mean, standard deviation, median and skewness for each data vector. Where applicable, statistics are also provided for the combined left and right regions.

Output: A Microsoft Excel file 'output.xls' is written in the current working directory replacing any previous file with the same name that may already exist. It contains the regions name vector and the data matrix X.

Example: Process the 17 vector files created in the Example above.

Run in a DOS Command Window:

\\MMIC-FS1\WMIC_Apps\vec2xls
    1: "                       Brainstem.vec" read:    4300 voxels.
    2: "                       Central_l.vec" read:    3418 voxels.
    3: "                       Central_r.vec" read:    3705 voxels.
    4: "                    Cerebellum_l.vec" read:   26466 voxels.
    5: "                    Cerebellum_r.vec" read:   24895 voxels.
    6: "                   FrontalLobe_l.vec" read:   31774 voxels.
    7: "                   FrontalLobe_r.vec" read:   35916 voxels.
    8: "                        Insula_l.vec" read:    2037 voxels.
    9: "                        Insula_r.vec" read:    2832 voxels.
   10: "                    MesialTemp_l.vec" read:     935 voxels.
   11: "                    MesialTemp_r.vec" read:    1607 voxels.
   12: "                   OccipitLobe_l.vec" read:   20105 voxels.
   13: "                   OccipitLobe_r.vec" read:   21272 voxels.
   14: "                   ParietalLob_l.vec" read:   25426 voxels.
   15: "                   ParietalLob_r.vec" read:   28443 voxels.
   16: "                   TemporaLobe_l.vec" read:   20902 voxels.
   17: "                   TemporaLobe_r.vec" read:   27906 voxels.
  NumVoxels   =  281939
"output.xls" written: 35930 rows x 18 columns.

decay - decay or undecay dynamic PET image in Analyze Image 7.5 file format

Type binary executable, AVW library required
Location /opt/wmic/bin (Solaris/Linux wrapper script)
\\MMIC_FS1\WMIC_Apps, \\MMIC-FS1\WMIC_Apps\win64 (32-bit/64-bit Windows binaries)
Version2.3

Description: decay is a command line tool to either correct or uncorrect dynamic PET images for radioactive decay relative to the start time of the scan.
This is done by either multiplying or dividing every voxel value of a frame by the decay correction factor dc of the frame.

In the formula, tframestart is the frame start time, tframeend is the frame end time and λ is the the radioactive decay constant. The start and end times of the frames are retrieved from the Scan Information File.
The following table links the half lives T1/2 with the decay constants λ for the isotopes most commonly used in PET.

SymbolHalf life T1/2 Decay constant λ
decay-corrected datainfinity0
18F109.7 min0.0001053 s-1
11C20.4 min0.0005663 s-1
15O122.55 s0.005656 s-1

Usage: decay [-o] [-u] id_sif.csv dynamic.hdr altered.hdr

 -o             overwrite ON (default: if the output file `altered.hdr'
                already exists, it will not be overwritten)
 -u             undecay `dynamic.hdr' (default: decay `dynamic.hdr')
 id_sif.csv     the name of the Scan Information File in CSV format
                The old SIF file format is still supported.
 dynamic.hdr    the name of the dynamic image file in Analyze file
                format to be [un]decayed
 altered.hdr    the name of the altered image file in Analyze Image 7.5
                file format which will be created

Example: Correct a dynamic [15O]H2O study from the HiREZ scanner for radioactive decay, creating decay-corrected images

% decay -u h00005_20060623_160920_s15_nf29_sif.csv h00005_20060623_160920_s15_nf29.hdr h00005_20060623_160920_s15_nf29_dc.hdr
Scan Information File         : "h00005_20060623_160920_s15_nf29_sif.csv"
  Number of frames in the scan: 29
  Radioactive deacy           : isotope= O-15, lambda= 0.005656 1/s, T???= 2.04251 min

Dynamic Image File            : "h00005_20060623_160920_s15_nf29.hdr"
                  NumVols     =  29
                  Width       = 256
                  Height      = 256
                  Depth       =  81
                  Voxel width = 2.66615 mm
                  Voxel height= 2.66615 mm
                  Voxel depth = 2 mm
                  ROIScale    = 0.0972374901175499
                  glmin       =             -28858
                  glmax       =              32767
                  cal_min     =         -2806.0793
                  cal_max     =          3186.1807

  Frame  frame start   frame end      undecay   frame   frame
  number     (s)           (s)         factor     min     max
       1           0         140   1.44763288    -601     523
       2         140         145   2.23881493   -8434   10600
       3         145         150   2.30303237  -13008   14203
       4         150         155   2.36909180  -15976   20896
       5         155         160   2.43704607  -18523   15785
       6         160         165   2.50694950  -13057   17024
       7         165         170   2.57885803  -21830   20079
       8         170         175   2.65282916  -20863   22907
       9         175         180   2.72892205  -24369   28142
      10         180         185   2.80719756  -26168   32767
      11         185         190   2.88771831  -28858   24912
      12         190         195   2.97054868  -25056   22895
      13         195         200   3.05575494  -14920   18921
      14         200         205   3.14340522  -20080   22271
      15         205         210   3.23356963  -25854   28055
      16         210         220   3.37335133  -16220   15410
      17         220         230   3.56964700  -13225   14811
      18         230         240   3.77736513  -18309   15483
      19         240         250   3.99717040  -11845   12432
      20         250         260   4.22976616  -13434   13802
      21         260         280   4.60244132   -7414    8826
      22         280         300   5.15365867  -10090    9807
      23         300         320   5.77089329  -10667    7731
      24         320         350   6.64297995   -7002    6608
      25         350         380   7.87143710   -5285    5035
      26         380         410   9.32706744   -3827    4407
      27         410         440  11.05188111   -3352    4916
      28         440         470  13.09565702   -3458    4308
      29         470         500  15.51737944   -2976    3555

Reading the dynamic image and calculating the altered undecayed image
Volume 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, done.

Altered Image File            : "h00005_20060623_160920_s15_nf29_dc.hdr"
                  NumVols     =  29
                  Width       = 256
                  Height      = 256
                  Depth       =  81
                  Voxel width = 2.66615 mm
                  Voxel height= 2.66615 mm
                  Voxel depth = 2 mm
                  ROIScale    = 0.2729648649692535
                  glmin       =             -29781
                  glmax       =              32767
                  cal_min     =         -8129.1666
                  cal_max     =          8944.2397

addimg - add frames of a dynamic PET image in Analyze file format

Type binary executable, AVW library required
Location /opt/wmic/bin (Solaris/Linux wrapper script)
\\MMIC_FS1\WMIC_Apps, \\MMIC-FS1\WMIC_Apps\win64 (32-bit/64-bit Windows binaries)
Version2.5

Description: addimg is an efficient implementation (written in the programming language C) to create add images which can be corrected for radioactive decay (command line option: -d). See the description of the command decay for further details on the decay correction factors used. Because addimg processes the dynamic image slice by slice, it achieves a better memory locality than many other programs which require the whole dynamic data set to be loaded. This is a particular advantage for data from the HRRT scanner which can be bigger than one gigabyte for a dynamic image sequence with 37 frames.
A Scan Information File is mandatory. Add images will be calculated correctly for noncontiguous frames.
The data can be devided by an activity value A0 (option: -a) such that ratio images are generated.

Usage: addimg [-a A0] [-d] [-f first_frame] [-l last_frame] [-o] id_sif.csv dynamic.hdr addimage.hdr

 -a A0          divide the add image by the (constant) activity value A0
                defined at scan start time of the Scan Information File
                This option can be used to create ratio images of apparent
                volumes of distribution or apparent binding potentials.
 -d             decay correction ON (default: no decay correction will
                be applied to the data)
 -f first_frame the number of the first frame (default: 1)
 -l last_frame  the number of the last frame (default: the last frame
                of the scan)
 -o             overwrite ON (default: if the output files `addimage.hdr'
                or `addimage.img' already exist, then they will not
                be overwritten)
 id_sif.csv     the name of the Scan Information File in CSV format
                The old SIF file format is still supported.
 dynamic.hdr    the name of the dynamic image file in Analyze file format
                to be added
 addimage.hdr   the name of the add image file in Analyze file format
                which will be created

Example: Dynamic [18F]FDG study from the High Resolution Research Tomograph (HRRT)

Create an add image from 35 min (2100 s) to 55 min (3300 s) post injection. Correct for radioactive decay back to the start of the emission scan.
Here it is assumed that the intravenous infusion of [18F]FDG commenced 440 s after the start of the emission scan.

% addimg -d -f 29 -l 32 image_10_sif.csv image_10.hdr image_10_35to55min.hdr
Scan Information File         : "image_10_sif.csv"
  Number of frames in the scan: 33
  Number of the first frame   : 29
  Number of the last frame    : 32
  Radioactive deacy           : isotope= F-18, lambda= 0.0001053 1/s, T1/2= 109.71 min
  Frame  frame start   frame end  decay correc-
  number     (s)           (s)     tion factor
       1           0         450   1.0238796    
       2         450         455   1.04880166    
       3         455         460    1.049354    
       4         460         465   1.04990663    
       5         465         470   1.05045955    
       6         470         475   1.05101277    
       7         475         480   1.05156627    
       8         480         485   1.05212007    
       9         485         490   1.05267415    
      10         490         495   1.05322853    
      11         495         500   1.0537832    
      12         500         505   1.05433817    
      13         505         510   1.05489342    
      14         510         520   1.05572681    
      15         520         530   1.05683908    
      16         530         560   1.05906674    
      17         560         590   1.06241762    
      18         590         620   1.0657791    
      19         620         680   1.07083995    
      20         680         740   1.07762693    
      21         740         800   1.08445693    
      22         800         920   1.09477772    
      23         920        1040   1.1086991    
      24        1040        1340   1.13344925    
      25        1340        1640   1.16982647    
      26        1640        1940   1.20737118    
      27        1940        2240   1.24612087    
      28        2240        2540   1.28611419    
      29        2540        2840   1.32739108   *** first frame *** 
      30        2840        3140   1.36999271    
      31        3140        3440   1.41396161    
      32        3440        3740   1.45934167    ### last frame ###
      33        3740        4040   1.50617816    

Dynamic Image File            : "image_10.hdr"
                  NumVols     =  33
                  Width       = 256
                  Height      = 256
                  Depth       = 207
                  Voxel width = 1.21875 mm
                  Voxel height= 1.21875 mm
                  Voxel depth = 1.21875 mm
                  ROIScale    = 0.2228407561779022
                  glmin       =                  0
                  glmax       =              32767
                  cal_min     =                  0
                  cal_max     =          7301.8232

Reading the dynamic image and calculating the add image
Slice 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, done.

Add Image File                : "image_10_35to55min.hdr"
                  NumVols     =   1
                  Width       = 256
                  Height      = 256
                  Depth       = 207
                  Voxel width = 1.21875 mm
                  Voxel height= 1.21875 mm
                  Voxel depth = 1.21875 mm
                  ROIScale    = 0.0043513062410057
                  glmin       =                  0
                  glmax       =              32767
                  cal_min     =                  0
                  cal_max     =          142.57925

mulimg - multiply a thresholded image with another image

Type binary executable, AVW library required
Location /opt/wmic/bin (Solaris/Linux wrapper script)
\\MMIC_FS1\WMIC_Apps, \\MMIC-FS1\WMIC_Apps\win64 (32-bit/64-bit Windows binaries)
Version1.3

Description: mulimg can conveniently be used to convert an image input1 into a binary mask and then applying this mask to another image input2 saving the result as output.
Currently, input2 is limited to a single volume image, multi frame dynamic images are not yet supported.

Usage: mulimg [-l lower_thresh] [-o] [-u upper_thresh] input1 input2 output

 input1         The first image file which will be converted into a
                binary image by setting all of the voxels greater than or
                equal to the lower_thresh and less than or equal to
                the upper_thresh to 1 and the rest of the voxels to 0.
 input2         The second image file.
                Both image1 and image2 can be of any file format that can
                be opened by AVW_OpenImageFile(). However, they each must
                not contain more than a single volume.
 output         The name of the output file in Analyze Image 7.5 format
                which will be created. The data type of output will be
                the same as of input2. Equation:
 output= ((input1 >= lower_thresh) & (input1 <= upper_thresh)) * input2

 -l lower_thresh A scalar value defining the lower threshold for input1
                (default: lower_thresh= 0.5).
 -o             overwrite ON (default: If the output file already exists,
                it will not be overwritten.)
 -l upper_thresh A scalar value defining the upper threshold for for input1
                (default: upper_thresh= 127.0).

Example:

Apply an 80% threshold to the probabilistic grey matter map (class 1) generated with SPM5 and multiply with the 83-region brain atlas.

% mulimg -l 0.8 c1h00311_mr2pet.hdr wh00311_pa.hdr c1h00311_pa
Input1 file   : "c1h00311_mr2pet.hdr"
  Data format =  46  NIFTI
  Data type   =  64  AVW_FLOAT
  NumVols     =   1
  Width       = 120
  Height      = 160
  Depth       = 124
  Voxel width = 1.21875 mm
  Voxel height= 1.21875 mm
  Voxel depth = 1.21875 mm
  glmin       =   0
  glmax       = 1.00011

Input1 thresholded:
  Lower thresh= 0.8
  Upper thresh= 127
  Data type   =   1  AVW_UNSIGNED_CHAR
  VoxelsPerVol= 2380800
  MaskedVoxels= 290960

Input2 file   : "wh00311_pa.hdr"
  Data format =  46  NIFTI
  Data type   =   1  AVW_UNSIGNED_CHAR
  NumVols     =   1
  Width       = 120
  Height      = 160
  Depth       = 124
  Voxel width = 1.21875 mm
  Voxel height= 1.21875 mm
  Voxel depth = 1.21875 mm
  glmin       =   0
  glmax       =  83

Output file   : "c1h00311_pa"
  Data type   =   1  AVW_UNSIGNED_CHAR
  Data format =   4  AnalyzeImage(7.5)
  NumVols     =   1
  Width       = 120
  Height      = 160
  Depth       = 124
  Voxel width = 1.21875 mm
  Voxel height= 1.21875 mm
  Voxel depth = 1.21875 mm
  glmin       =   0
  glmax       =  83

The output image c1h00311_pa.hdr can then be converted into an Object Map file using ima2obj and properly named with panames.


normi - normalise dynamic image, create voxel histogram

Type binary executable, AVW library required
Location /opt/wmic/bin (Solaris/Linux wrapper script)
\\MMIC_FS1\WMIC_Apps, \\MMIC-FS1\WMIC_Apps\win64 (32-bit/64-bit Windows binaries)
Version2.5

Description: normi is a command line tool to normalise dynamic PET images. Dynamic PET images are normalised by subtracting from each frame its mean and dividing it by its standard deviation.
Normalised images are needed to perform certain operations independently of the absolute scale of the image. An example is cluster analysis which aims at classifying time series by using similarity measures.
During the run normi generates an output table with the minimum voxel value, the maximum voxel value, the mean voxel value and the standard deviation of the voxel values for each frame of the dynamic image sequence.
If the -h option is specified, a histogram of the voxel values is saved in the binary file voxhist.dat in the current directory.
Using the -m option, a mask image can be loaded. The lower and upper thresholds for the conversion of the mask image into a binary mask can be set with the -l and -u options, respectively.

Usage: normi [-a] [-h] [-l lower_thresh] [-m mask] [-o] [-u upper_threshd] dynamic output


 -a             Calculate all voxels in a masked volume (default:
                only the masked voxels will be calculated and all other
                voxels are set to zero in the output image). Warning:
                This option is only provided for compatibility and it
                may cause data overflow!
 -h             histogram ON. If this flag is set, a histogram file
                `voxhist.dat' will be saved to the disk which contains
                voxel histograms (32-bit unsigned integer values) for
                each frame of the dynamic.
 -l lower_thresh A scalar value defining the lower threshold for the
                optional mask image (default: lower_thresh= 0.5).
 -m mask        the name of an optional mask image file. If no
                mask file is specified, then all voxels will be
                normalised (the default).
 -o             overwrite ON (default: if either of the .hdr or .img 
                output files already exist, they will not be
                overwritten)
 -u upper_thresh A scalar value defining the upper threshold for the
                optional mask image (default: upper_thresh= 3.40282e+38).
 dynamic        the name of the dynamic image file to be normalised. 
                Data type must be 16-bit signed integer.
 output         the name of the normalised image to be created.
                Data type will be 16-bit signed integer, file format 
		will be AnalyzeImage(7.5).

 Dynamic PET images are normalised by subtracting from each frame its
 mean and dividing it by its standard deviation.

 If an optional mask image is specified, then a binary mask is calculated
 binary_mask= (mask_image >= lower_thresh) & (mask_image <= upper_thresh)
 and applied to select the voxels to include in the calculation of 'frame
 mean' and 'frame std dev'.

Example 1: Dynamic [11C]-(R)-PK11195 study from the High Resolution Research Tomograph (HRRT)

This dynamic image has been obtained from iterative image reconstruction. Therefore, there are no negative values in the image, and the distribution of the voxel values is positively skewed.

% normi -h h00094.hdr normi22.hdr
Dynamic Image : "h00094.hdr"
  Data format =   4  AnalyzeImage(7.5)
  Data type   =   8  AVW_SIGNED_SHORT
  NumVols     =  18
  Width       = 130
  Height      = 168
  Depth       = 126
  Voxel width = 1.21875 mm
  Voxel height= 1.21875 mm
  Voxel depth = 1.21875 mm
  ROIScale    = 0.0126550681889057
  glmin       =                  0
  glmax       =              32767
  cal_min     =                  0
  cal_max     =          414.66861
  MaskedVoxels= 2751840

  Frame    frame   frame        frame        frame   normalised   normalised
  number     min     max         mean      std dev          min          max
       1       0     104     0.030940     0.517831    -0.059749   200.777842
       2       0   12033   126.659932   316.673485    -0.399970    37.598159
       3       0   32767   258.966779   682.848639    -0.379245    47.606499
       4       0   20002   354.607806   752.219985    -0.471415    26.119211
       5       0   11638   317.900548   526.445300    -0.603862    21.502898
       6       0    8452   262.985571   377.996232    -0.695736    21.664275
       7       0    7348   235.643544   340.028644    -0.693011    20.916933
       8       0    6574   224.081126   323.560196    -0.692548    19.625155
       9       0    7421   213.315857   309.648351    -0.688897    23.276998
      10       0    4467   189.161766   226.948224    -0.833502    18.849402
      11       0    4519   156.171273   188.513314    -0.828436    23.143345
      12       0    3843   125.902737   154.463503    -0.815097    24.064567
      13       0    2533    99.907360   125.660566    -0.795057    19.362420
      14       0    2240    80.318421   104.083982    -0.771669    20.749414
      15       0    2015    64.762914    86.259918    -0.750788    22.608845
      16       0    1451    52.405403    71.646261    -0.731446    19.520832
      17       0    1033    39.330155    51.149534    -0.768925    19.426763
      18       0     711    26.604856    36.358061    -0.731746    18.823753

Histogram matrix "voxhist.dat" saved: 18 volumes with 65536 histogram bins (uint32) each.

Reading the dynamic image and calculating the normalised image
Volume 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, done.

Output Image  : "normi22.hdr"
  Data format =   4  AnalyzeImage(7.5)
  Data type   =   8  AVW_SIGNED_SHORT
  NumVols     =  18
  Width       = 130
  Height      = 168
  Depth       = 126
  Voxel width = 1.21875 mm
  Voxel height= 1.21875 mm
  Voxel depth = 1.21875 mm
  ROIScale    = 0.006127440836280584
  glmin       =               -136
  glmax       =              32767
  cal_min     =        -0.83333195
  cal_max     =          200.77785

Example 2: Some Matlab code to read and display the voxel histogram

fid= fopen('voxhist.dat', 'rb');
hist= fread( fid, '*uint32');
fclose(fid);

hist= reshape( hist, 65536, 18);      % 18 frames in total

plot(-32768:32767, hist(:,3))         % plot the histogram of the 3rd frame

plot(-32768:32767, sum(hist,2))       % plot the histogram of the whole dynamic

Example 3: Using a NIfTI floating point image as mask image

This example shows how a floating point image that represents probabilities for each voxel to belong to tissue class 1 (c1) is used as mask. The default threshold values apply for the conversion of the mask image into a binary mask.

% normi -m c1h00094_mr2pet.hdr h00094.hdr h00094_c1.hdr
Dynamic Image : "h00094.hdr"
  Data format =   4  AnalyzeImage(7.5)
  Data type   =   8  AVW_SIGNED_SHORT
  NumVols     =  18
  Width       = 130
  Height      = 168
  Depth       = 126
  Voxel width = 1.21875 mm
  Voxel height= 1.21875 mm
  Voxel depth = 1.21875 mm
  ROIScale    = 0.0126550681889057
  glmin       =                  0
  glmax       =              32767
  cal_min     =                  0
  cal_max     =          414.66861

Mask Image    : "c1h00094_mr2pet.hdr"
  Data format =  46  NIFTI
  Data type   =  64  AVW_FLOAT
  NumVols     =   1
  Width       = 130
  Height      = 168
  Depth       = 126
  Voxel width = 1.21875 mm
  Voxel height= 1.21875 mm
  Voxel depth = 1.21875 mm
  glmin       = 0
  glmax       = 1.00011

Mask Image thresholded:
  Lower thresh= 0.5
  Upper thresh= 3.40282e+38
  Data type   =   1  AVW_UNSIGNED_CHAR
  VoxelsPerVol= 2751840
  MaskedVoxels= 384101

  Frame    frame   frame        frame        frame   normalised   normalised
  number     min     max         mean      std dev          min          max
       1       0      91     0.031138     0.622275    -0.050038   146.187548
       2       0    8439   292.406458   412.957301    -0.708079    19.727448
       3       0   20455   576.535154   915.076042    -0.630041    21.723293
       4       0   15446   797.909854   940.602859    -0.848296    15.573087
       5       1   10421   732.788444   619.943415    -1.180412    15.627574
       6       5    4722   613.718592   429.525821    -1.417187     9.564690
       7       2    4624   540.455005   393.101172    -1.369762    10.388025
       8       2    4800   506.328429   373.053254    -1.351894    11.509541
       9       2    4444   474.912856   354.905986    -1.332502    11.183489
      10      11    2124   410.395232   192.085905    -2.079253     8.921033
      11       4    1664   310.230603   157.772481    -1.940963     8.580517
      12       3    1381   229.109992   128.650644    -1.757550     8.953628
      13       1    1373   168.198344   104.606418    -1.598356    11.517474
      14       1    1195   125.893031    86.381660    -1.445828    12.376550
      15       1     859    95.722576    71.784451    -1.319542    10.632907
      16       0     860    73.452956    60.398240    -1.216144    13.022682
      17       1     486    53.180627    38.684988    -1.348860    11.188303
      18       0     428    34.808772    29.142094    -1.194450    13.492209

Reading the dynamic image and calculating the normalised image
Volume 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, done.

Output Image  : "h00094_c1.hdr"
  Data format =   4  AnalyzeImage(7.5)
  Data type   =   8  AVW_SIGNED_SHORT
  NumVols     =  18
  Width       = 130
  Height      = 168
  Depth       = 126
  Voxel width = 1.21875 mm
  Voxel height= 1.21875 mm
  Voxel depth = 1.21875 mm
  ROIScale    = 0.004461425822228193
  glmin       =               -466
  glmax       =              32767
  cal_min     =         -2.0790244
  cal_max     =          146.18754

Example 4: Using a 16-bit signed integer image as mask image

As the default values for thresholding the mask images are floating point numbers, it is crucial to manually set with the -l and -u options values that are representable by the actual data type of the particular mask image.
In this example a 16-bit signed integer image is used as mask image. Hence the lower threshold is set to 1, and the upper threshold is set to 32767.

% normi -l 1 -h -m h00094_MASK.hdr -u 32767 h00094.hdr h00094_normi22.hdr
Dynamic Image : "h00094.hdr"
  Data format =   4  AnalyzeImage(7.5)
  Data type   =   8  AVW_SIGNED_SHORT
  NumVols     =  18
  Width       = 130
  Height      = 168
  Depth       = 126
  Voxel width = 1.21875 mm
  Voxel height= 1.21875 mm
  Voxel depth = 1.21875 mm
  ROIScale    = 0.0126550681889057
  glmin       =                  0
  glmax       =              32767
  cal_min     =                  0
  cal_max     =          414.66861

Mask Image    : "h00094_MASK.hdr"
  Data format =   4  AnalyzeImage(7.5)
  Data type   =   8  AVW_SIGNED_SHORT
  NumVols     =  18
  Width       = 130
  Height      = 168
  Depth       = 126
  Voxel width = 1.21875 mm
  Voxel height= 1.21875 mm
  Voxel depth = 1.21875 mm
  glmin       = 0
  glmax       = 32767

Mask Image thresholded:
  Lower thresh= 1
  Upper thresh= 32767
  Data type   =   1  AVW_UNSIGNED_CHAR
  VoxelsPerVol= 2751840
  MaskedVoxels= 1359806

  Frame    frame   frame        frame        frame   normalised   normalised
  number     min     max         mean      std dev          min          max
       1       0     104     0.034836     0.612600    -0.056866   169.711354
       2       0   12033   237.877951   417.139866    -0.570259    28.276180
       3       0   32767   474.067982   896.290813    -0.528922    36.029525
       4       0   20002   652.117841   953.783184    -0.683717    20.287506
       5       0   11638   590.802654   622.792046    -0.948636    17.738180
       6       1    8452   491.344076   417.290909    -1.175065    19.076993
       7       1    7348   440.917790   376.456739    -1.168575    18.347612
       8       1    6574   418.291538   358.798592    -1.163024    17.156445
       9       0    7421   398.003100   344.471547    -1.155402    20.387742
      10       5    4467   355.107350   214.922929    -1.628990    19.131940
      11       3    4519   293.136061   180.174594    -1.610305    23.454272
      12       2    3843   235.087729   151.303000    -1.540536    23.845610
      13       0    2533   185.407572   126.962241    -1.460336    18.490477
      14       1    2240   148.117177   108.532391    -1.355514    19.274272
      15       1    2015   118.779866    92.045828    -1.279579    20.600827
      16       0    1451    95.643434    77.941281    -1.227122    17.389457
      17       0    1033    71.491167    53.961845    -1.324847    17.818309
      18       0     711    48.320360    39.647822    -1.218739    16.714150

Histogram matrix "voxhist.dat" saved: 18 volumes with 65536 histogram bins (uint32) each.

Reading the dynamic image and calculating the normalised image
Volume 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, done.

Output Image  : "h00094_normi22.hdr"
  Data format =   4  AnalyzeImage(7.5)
  Data type   =   8  AVW_SIGNED_SHORT
  NumVols     =  18
  Width       = 130
  Height      = 168
  Depth       = 126
  Voxel width = 1.21875 mm
  Voxel height= 1.21875 mm
  Voxel depth = 1.21875 mm
  ROIScale    = 0.005179337225854397
  glmin       =               -319
  glmax       =              32767
  cal_min     =         -1.6522086
  cal_max     =          169.71134


hdr2sif - convert Inveon Interfile header data into CSV Scan Information Files

Type script using /usr/bin/gawk, the GNU Project's implementation of the pattern scanning and processing language AWK
Location /opt/wmic/bin
Version1.2

Description: hdr2sif, a simple script written in the pattern scanning and processing language AWK, reformats the contents of the Interfile header file created by the Inveon image reconstruction software. The output is formatted in the WMIC's comma-separated value (CSV) standard and is normally redirected into a Scan Information File (SIF).

Example: hdr2sif a00760.pet.img.hdr > a00760_sif.csv


inveon_i2ana - convert the Inveon dynamic binary interfile into Analyze 7.5 format

Type binary executable (deployed Matlab R2009b SP1 application)
Location /data/secondary/rhinz/bin (Solaris/Linux wrapper script)
\\MMIC_FS1\WMIC_Apps, \\MMIC-FS1\WMIC_Apps\win64 (32-bit/64-bit Windows binaries)
Version1.1

Description: inveon_i2ana converts the dynamic binary interfile created by the Inveon image reconstruction software (*.pet.img) into an Analyze 7.5 Image file pair .hdr/.img. To calibrate the image data, it requires the Scan Information File (SIF) in WMIC CSV format of the scan, typically generated with hdr2sif. The output image is in default radiological orientation, calibrated in kBq/ml not corrected for radioactive decay.

Based on the data read from the SIF, each frame of the dynamic image is scaled as follows.

  1. Multiply with 10-3 to convert Bq/ml into kBq/ml,
  2. divide by the frame specific decay correction factor,
  3. divide by the isotope specific branching fraction,
  4. multiply with the appropriate calibration factor,
  5. divide by the length of the frame (in seconds).

The output image is saved as 32-bit single precision float data. Use the command sthg2ana to further convert the output image into 16-bit signed integer data for the subsequent use by other tools such as addimg or tacstats.

Usage: inveon_i2ana siffile iname oname

 siffile A string containing the name of a Scan Information File
        (SIF) in WMIC CSV format. Typically, this file is generated
        from the Inveon dynamic interfile header (*.pet.img.hdr)
        with the command `hdr2sif'.
 iname  A string containing the name of the Inveon dynamic binary
        interfile (*.pet.img) to be converted.
 oname  A string defining the path for the Analyze 7.5 Image files
        to be written. The file name extensions `.hdr' and `.img'
        will be appended to the oname string. If the output files
        (hdr/img) already exist, then an attempt will be made to
        overwrite them.

Output:
        The Analyze 7.5 Image file pair byte order (big endian or
        little endian) is that of the machine on which the program
        is run. The data type is 16 (32-bit single precision float).
        Use the command `sthg2ana' to further convert the output
        image into data type 4 (16-bit signed integer).

Example:

% inveon_i2ana a00760_sif.csv a00760.pet.img a00760
  Scan Informat. File: "a00760_sif.csv"
  Scan Date          : "2011-06-14"
  Scan Time          : "11:09:46"
  Number Of Time Sl. =  21
  Original Width     = 128
  Original Height    = 128
  Original Depth     = 159
  Voxel Width        = 0.776383 mm
  Voxel Height       = 0.776383 mm
  Voxel Depth        = 0.796 mm
  Isotope            : "C-11" (bf= 0.998)
  ....................... Z flip ..... Y flip ........................
  ..... calibrating image data ..... into kBq/ml ..... decaying ......
  Frame  frame start   frame end  frame     Decay      prompts  delayeds
  number     (s)           (s)    length    Factor
                                  (s)
       1           0          30       30    1.00852   2923135    371251
       2          30          60       30    1.02582   7985292   1392574
       3          60          90       30    1.04341   9079716   1571832
       4          90         120       30     1.0613   9318788   1563466
       5         120         150       30     1.0795   9422925   1497454
       6         150         180       30    1.09801   9538119   1460007
       7         180         240       60    1.12633  18874475   2804010
       8         240         300       60    1.16528  18334568   2586932
       9         300         360       60    1.20559  17795986   2392233
      10         360         480      120    1.26849  33874628   4362698
      11         480         600      120    1.35775  31784337   3805424
      12         600         720      120     1.4533  29794825   3301422
      13         720         840      120    1.55557  28275999   2899854
      14         840         960      120    1.66504  26270435   2584236
      15         960        1080      120    1.78221  24943377   2253318
      16        1080        1200      120    1.90763  23654348   1961143
      17        1200        1500      300    2.14654  52573012   3943790
      18        1500        1800      300    2.54434  45036378   2854052
      19        1800        2400      600    3.27162  71418000   3514981
      20        2400        3000      600    4.59659  51880015   1834110
      21        3000        3600      600    6.45814  37228085    952282
  Binary Interfile   : "a00760.pet.img"
  Analyze 7.5 Dynamic: "a00760.hdr|img"
  Data Type          : "single"
  ROI Scale Factor   = 1.0000000000000000 (single precision)
       1 ifm=[ 0.208276; 0.000000] fsf= 6169.87753 ofm=[1285.038330; 0.000000]
       2 ifm=[ 0.500311; 0.000000] fsf= 6065.82528 ofm=[3034.797852; 0.000000]
       3 ifm=[ 0.598478; 0.000000] fsf= 5963.56647 ofm=[3569.066406; 0.000000]
       4 ifm=[ 0.513827; 0.000000] fsf= 5863.04051 ofm=[3012.590820; 0.000000]
       5 ifm=[ 0.491587; 0.000000] fsf= 5764.19165 ofm=[2833.600342; 0.000000]
       6 ifm=[ 0.426429; 0.000000] fsf= 5667.02024 ofm=[2416.583252; 0.000000]
       7 ifm=[ 0.711539; 0.000000] fsf= 2762.26545 ofm=[1965.459961; 0.000000]
       8 ifm=[ 0.673439; 0.000000] fsf= 2669.9355 ofm=[1798.038940; 0.000000]
       9 ifm=[ 0.656249; 0.000000] fsf= 2580.66378 ofm=[1693.557495; 0.000000]
      10 ifm=[ 1.233394; 0.000000] fsf= 1226.34883 ofm=[1512.570679; 0.000000]
      11 ifm=[ 1.293754; 0.000000] fsf= 1145.72729 ofm=[1482.289062; 0.000000]
      12 ifm=[ 1.405996; 0.000000] fsf= 1070.39924 ofm=[1504.977051; 0.000000]
      13 ifm=[ 1.332499; 0.000000] fsf= 1000.0265 ofm=[1332.533936; 0.000000]
      14 ifm=[ 1.269559; 0.000000] fsf= 934.278589 ofm=[1186.122192; 0.000000]
      15 ifm=[ 1.348324; 0.000000] fsf= 872.855176 ofm=[1176.891846; 0.000000]
      16 ifm=[ 1.439322; 0.000000] fsf= 815.468001 ofm=[1173.720825; 0.000000]
      17 ifm=[ 3.150705; 0.000000] fsf= 289.88255 ofm=[913.334290; 0.000000]
      18 ifm=[ 3.278511; 0.000000] fsf= 244.560275 ofm=[801.793518; 0.000000]
      19 ifm=[ 5.376124; 0.000000] fsf= 95.0973048 ofm=[511.254883; 0.000000]
      20 ifm=[ 5.564751; 0.000000] fsf= 67.6854461 ofm=[376.652618; 0.000000]
      21 ifm=[ 5.541458; 0.000000] fsf= 48.175209 ofm=[266.960907; 0.000000]
  Calibration Maximum=          3569.0664 kBq/ml (single precision)
  Calibration Minimum=                  0 kBq/ml (single precision)

Conversion completed.
Please close the open figure to return to the command line prompt.


sthg2ana - convert "something float" into a signed short Analyze Image 7.5 file

Type binary executable, AVW library required
Location /opt/wmic/bin (Solaris/Linux wrapper script)
\\MMIC_FS1\WMIC_Apps, \\MMIC-FS1\WMIC_Apps\win64 (32-bit/64-bit Windows binaries)
Version2.7

Description: sthg2ana is a command line program that is meant to convert any dynamic PET image into a signed 16-bit Analyze Image 7.5 file. To open the image file, a call of the function AVW_OpenImageFile() of the AVW library is made. Therefore, the capabilities of sthg2ana with respect to supported input file formats are determined by the AVW library.
sthg2ana takes care of properly finding the global minimum value, the global maximum value and the scale factor. Use the command line flag -c to calculate input file minimum and maximum values as for some image file formats (for example some versions of the NIfTI Data Format) the value 0 is returned as global minimum and global maximum, respectively.

Usage: sthg2ana [-c] [-o] file[s]

 file[s]	the name[s] of the image file[s] to be converted. They must
		be "something" which is read by the AVW library as FLOAT
		(Data type= 64 AVW_FLOAT or 16384 AVW_DOUBLE_FLOAT).
		The output images will be 16-bit signed integer data
		(Data type=  8 AVW_SIGNED_SHORT) with the appropriate
		ROIScaleFactor stored in the header file.
		The original file name extensions will be replaced with
		`.hdr' and `.img', respectively. If the input files are
		already in AnalyzeImage(7.5) format, then a '1' will be
		appended to the base name of the files.
 -c		calculate input file minimum and maximum values.
		For some image file formats, AVW_OpenImageFile() does not
		return the actual MinimumDataValue and MaximumDataValue
		for the input file[s]. Use this flag to calculate the
		global minimum and maximum values.
 -o		overwrite ON (default: overwrite OFF - if the output files
		already exist, then they will not be overwritten)

Example 1: Convert a dynamic PET study from a GEADVANCE file into an Analyze Image 7.5 file

% sthg2ana 16800102_DD_PET_bsl_nonatten.iee
Input file    : "16800102_DD_PET_bsl_nonatten.iee"
  Data format =  11  GEADVANCE
  NumVols     =  26
  Width       = 128
  Height      = 128
  Depth       =  35
  Voxel width = 2.34375 mm
  Voxel height= 2.34375 mm
  Voxel depth = 4.25 mm
  glmin       =          -0.002764
  glmax       =           0.007328
  --> a scale factor of 0.0000002236396374 (double precision)
       will be applied to convert the image data into signed short

    volume   0: min=  -0.0027635545 (-12357), max=   0.0032541733 ( 14551)
    volume   1: min=  -0.0021226688 ( -9491), max=   0.0073283855 (-32767)
  Hmm, the integer max should actually be 32769. I try it again with an
  updated glmax value.
  glmin       =          -0.002764
  glmax       =       0.0073283855
  --> a scale factor of 0.0000002236514019 (double precision)
       will be applied to convert the image data into signed short

    volume   0: min=  -0.0027635545 (-12357), max=   0.0032541733 ( 14550)
    volume   1: min=  -0.0021226688 ( -9491), max=   0.0073283855 ( 32767)
    volume   2: min=  -0.0021626423 ( -9670), max=   0.0049025002 ( 21920)
    volume   3: min=  -0.0023246598 (-10394), max=   0.0065824515 ( 29432)
    volume   4: min=  -0.0023461808 (-10490), max=   0.0060981419 ( 27266)
    volume   5: min=  -0.0014876558 ( -6652), max=   0.0048609907 ( 21735)
    volume   6: min=  -0.0016661918 ( -7450), max=   0.0053821108 ( 24065)
    volume   7: min=  -0.0014612994 ( -6534), max=   0.0054523339 ( 24379)
    volume   8: min=  -0.0010024582 ( -4482), max=   0.0054889899 ( 24543)
    volume   9: min=   -0.001128411 ( -5045), max=    0.005620101 ( 25129)
    volume  10: min=  -0.0010891993 ( -4870), max=    0.005042186 ( 22545)
    volume  11: min= -0.00073882204 ( -3303), max=   0.0044765132 ( 20016)
    volume  12: min= -0.00074835977 ( -3346), max=   0.0038151864 ( 17059)
    volume  13: min= -0.00070397067 ( -3148), max=   0.0036536546 ( 16336)
    volume  14: min= -0.00065414753 ( -2925), max=   0.0033836644 ( 15129)
    volume  15: min= -0.00072272785 ( -3231), max=   0.0029330335 ( 13114)
    volume  16: min= -0.00058612489 ( -2621), max=   0.0028217703 ( 12617)
    volume  17: min= -0.00051442458 ( -2300), max=   0.0028146172 ( 12585)
    volume  18: min= -0.00049125892 ( -2197), max=   0.0026030187 ( 11639)
    volume  19: min= -0.00060776836 ( -2717), max=   0.0020727254 (  9268)
    volume  20: min= -0.00046873366 ( -2096), max=   0.0017879589 (  7994)
    volume  21: min= -0.00045446554 ( -2032), max=   0.0019034527 (  8511)
    volume  22: min= -0.00042255118 ( -1889), max=   0.0016251947 (  7267)
    volume  23: min= -0.00038577712 ( -1725), max=   0.0015312384 (  6847)
    volume  24: min= -0.00042828752 ( -1915), max=   0.0014196591 (  6348)
    volume  25: min= -0.00036300253 ( -1623), max=   0.0013784897 (  6164)

Output file   : "16800102_DD_PET_bsl_nonatten.hdr"
  Data format =   4  AnalyzeImage(7.5)
  NumVols     =  26
  Width       = 128
  Height      = 128
  Depth       =  35
  Voxel width = 2.34375 mm
  Voxel height= 2.34375 mm
  Voxel depth = 4.25 mm
  glmin       =             -12357
  glmax       =              32767
  cal_min     =      -0.0027635545
  cal_max     =       0.0073283855
  ROIScale    = 0.0000002236514019 (double precision)
              = 0.0000002236513978 (single precision)

Example 2: Convert a dynamic PET study from an ECAT 7 file into an Analyze Image 7.5 file

% sthg2ana m99016.v
Input file    : "m99016.v"
  Data format =   9  CTIECAT7
  Data type   =  64  AVW_FLOAT
  NumVols     =  18
  Width       = 128
  Height      = 128
  Depth       =  35
  Voxel width = 2.34375 mm
  Voxel height= 2.34375 mm
  Voxel depth = 4.25 mm
  glmin       =         -14308.289
  glmax       =          34631.726
  --> a scale factor of 1.0569086569391033 (double precision)
       will be applied to convert the image data into signed short

    volume   0: min=     -14308.289 (-13538), max=      15084.472 ( 14272)
    volume   1: min=     -12093.518 (-11442), max=      34631.727 ( 32767)
    volume   2: min=     -11032.296 (-10438), max=      32186.289 ( 30453)
    volume   3: min=      -5740.502 ( -5431), max=        26222.4 ( 24810)
    volume   4: min=     -5756.7603 ( -5447), max=      24164.234 ( 22863)
    volume   5: min=     -5182.6094 ( -4904), max=      23069.336 ( 21827)
    volume   6: min=     -4075.1941 ( -3856), max=      20426.467 ( 19327)
    volume   7: min=     -7647.3188 ( -7236), max=      19454.352 ( 18407)
    volume   8: min=     -6098.1265 ( -5770), max=      18679.182 ( 17673)
    volume   9: min=     -4733.5093 ( -4479), max=      17491.615 ( 16550)
    volume  10: min=     -5992.1484 ( -5670), max=       16008.05 ( 15146)
    volume  11: min=     -7412.2119 ( -7013), max=      15981.348 ( 15121)
    volume  12: min=      -7010.856 ( -6633), max=      16710.389 ( 15811)
    volume  13: min=     -7183.4961 ( -6797), max=      17113.162 ( 16192)
    volume  14: min=     -10562.646 ( -9994), max=       18414.24 ( 17423)
    volume  15: min=     -8743.4717 ( -8273), max=      18286.117 ( 17302)
    volume  16: min=     -8392.2109 ( -7940), max=      16023.494 ( 15161)
    volume  17: min=     -10225.085 ( -9675), max=      21682.314 ( 20515)

Output file   : "m99016.hdr"
  Data format =   4  AnalyzeImage(7.5)
  Data type   =   8  AVW_SIGNED_SHORT
  NumVols     =  18
  Width       = 128
  Height      = 128
  Depth       =  35
  Voxel width = 2.34375 mm
  Voxel height= 2.34375 mm
  Voxel depth = 4.25 mm
  glmin       =             -13538
  glmax       =              32767
  cal_min     =         -14308.289
  cal_max     =          34631.727
  ROIScale    = 1.0569086569391033 (double precision)
              = 1.0569086074829102 (single precision)
  descrip     = "2.3 (10030,10000) 1368550922: -o m99016.v" (41 characters)

Example 3: Convert a parametric map in Analyze Image 7.5 format from single precision float to signed 16-bit integer

% sthg2ana h03136dy1_BP.hdr
Input file    : "h03136dy1_BP.hdr"
  Data format =   4  AnalyzeImage(7.5)
  Data type   =  64  AVW_FLOAT
  NumVols     =   1
  Width       = 128
  Height      = 128
  Depth       =  95
  Voxel width = 2.096 mm
  Voxel height= 2.096 mm
  Voxel depth = 2.425 mm
  glmin       =         -1.5091565
  glmax       =          6.3636827
  --> a scale factor of 0.0001942101122131 (double precision)
       will be applied to convert the image data into signed short

    volume   0: min=     -1.5091565 ( -7771), max=      6.3636827 ( 32767)

Output file   : "h03136dy1_BP1.hdr"
  Data format =   4  AnalyzeImage(7.5)
  Data type   =   8  AVW_SIGNED_SHORT
  NumVols     =   1
  Width       = 128
  Height      = 128
  Depth       =  95
  Voxel width = 2.096 mm
  Voxel height= 2.096 mm
  Voxel depth = 2.425 mm
  glmin       =              -7771
  glmax       =              32767
  cal_min     =         -1.5091565
  cal_max     =          6.3636827
  ROIScale    = 0.0001942101122131 (double precision)
              = 0.0001942101080203 (single precision)
  descrip     = "2.3 (10030,10000) 1368550925: -o h03136dy1_BP.hdr" (49 characters)

Example 4: Round float values to nearest integer values in the probabilistic brain atlas NIfTI image

The example file h00013_01_hammers_gm.nii was written by SPM12 in NIfTI format. Because AVW_OpenImageFile() returns 0 as MinimumDataValue and MaximumDataValue, respectively, a scale factor of 1 is used to convert the float image data into signed short which is a simple round to the nearest integer operation without scaling of the values.

% sthg2ana h00013_01_hammers_gm.nii |& fgrep -v 'nifti_datatype:<4>'
Input file    : "h00013_01_hammers_gm.nii"
  Data format =  10  NIFTI
  Data type   =  64  AVW_FLOAT
  NumVols     =   1
  Width       = 256
  Height      = 256
  Depth       = 150
  Voxel width = 1 mm
  Voxel height= 1 mm
  Voxel depth = 1 mm
  glmin       =                  0
  glmax       =                  0
  --> a scale factor of 1.0000000000000000 (double precision)
       will be applied to convert the image data into signed short

    volume   0: min=              0 (     0), max=             85 (    85)

Output file   : "h00013_01_hammers_gm.hdr"
  Data format =   4  AnalyzeImage(7.5)
  Data type   =   8  AVW_SIGNED_SHORT
  NumVols     =   1
  Width       = 256
  Height      = 256
  Depth       = 150
  Voxel width = 1 mm
  Voxel height= 1 mm
  Voxel depth = 1 mm
  glmin       =                  0
  glmax       =                 85
  cal_min     =                  0
  cal_max     =                 85
  ROIScale    = 1.0000000000000000 (double precision)
              = 1.0000000000000000 (single precision)
  descrip     = "2.4 (10030,10000) 1629792985: h00013_01_hammers_gm.nii" (54 characters)

Now the output file h00013_01_hammers_gm.hdr can be converted into an Analyze Object Map file using ima2obj and then correctly labelled with panames.

Note: Had ima2obj been used on the original SPM12 generated NIfTI file h00013_01_hammers_gm.nii, then the float values would have been truncated (rounded towards zero) for data type conversion into integer. For example, a float value of 16.998962 in the right cerebellum would have been cast into an integer value of 16 which then panames would have labelled as G_occtem_la_l in the Analyze Object Map file created.

Example 5: Convert a parametric map in NIfTI format from double precision float to signed 16-bit integer

The example file h00013_odi.nii was written with the code from the NIFTI Matlab library in NIfTI format. Because AVW_OpenImageFile() returns 0 as MinimumDataValue and MaximumDataValue, respectively, the command line option -c is used to calculate the global minimum and maximum values in the input image. Then the image data are scaled into the signed short range.

% sthg2ana -c h00013_odi.nii |& fgrep -v 'nifti_datatype:<4>'
Input file    : "h00013_odi.nii"
  Data format =  10  NIFTI
  Data type   = 16384  AVW_DOUBLE_FLOAT
  NumVols     =   1
  Width       = 128
  Height      = 128
  Depth       =  60
  Voxel width = 1.875 mm
  Voxel height= 1.875 mm
  Voxel depth = 2.1 mm
  Calculating the global minimum and maximum values:
    volume   0: min=              0       , max=              1
  glmin       =                  0
  glmax       =                  1
  --> a scale factor of 0.0000305185094760 (double precision)
       will be applied to convert the image data into signed short

    volume   0: min=              0 (     0), max=              1 ( 32767)

Output file   : "h00013_odi.hdr"
  Data format =   4  AnalyzeImage(7.5)
  Data type   =   8  AVW_SIGNED_SHORT
  NumVols     =   1
  Width       = 128
  Height      = 128
  Depth       =  60
  Voxel width = 1.875 mm
  Voxel height= 1.875 mm
  Voxel depth = 2.1 mm
  glmin       =                  0
  glmax       =              32767
  cal_min     =                  0
  cal_max     =                  1
  ROIScale    = 0.0000305185094760 (double precision)
              = 0.0000305185094476 (single precision)
  descrip     = "2.7 (10030,10000) 1637056973: -c h00013_odi.nii" (47 characters)

Note: After the data type conversion, the size of the output file h00013_odi.img is only a quarter of the size of the original image h00013_odi.nii.


hrrt_gfilt - Gaussian 3D filter for dynamic Analyze 7.5 PET images

Type binary executable (deployed Matlab R2008a application)
Location /data/secondary/rhinz/bin (Solaris/Linux wrapper script)
Version3.1

Description: hrrt_gfilt is a deployed Matlab application to perform Gaussian 3D filtering of dynamic PET images in Analyze 7.5 format.
Two methods are available: either convolution in images space (default) using the function imfilter of the Matlab Image Processing Toolbox or multiplication in the frequency domain after 3D Fourier transform using the built-in Matlab functions fftn and ifftn, respectively.

Usage: hrrt_gfilt fname fwhm [fouriermeth]

Command line arguments:
 fname       A string containing the file name of the Analyze 7.5 image
             file to filter. The file name can be without file name
             extension or with either '.hdr' or '.img' extension.
             Supported data types are 4 (16-bit signed integer) and
             16 (single precision float).
 fwhm        A scalar floating point number specifying the Full Width
             at Half Maximum (FWHM) value for the Gaussian 3D filter in
             millimetres.
 fouriermeth Set this flag to perform the convolution of the 3D images
             with the Gaussian 3D filter as multiplication of the two
             Fourier transforms in the frequency domain. This method
             becomes efficient for big kernels (i.e. large FWHM) as
             the execution time practically only depends on the image
             volume size.

Outputs:
             The Analyze 7.5 image with the Point Spread Function (PSF)
             of the Gaussian 3D filter will be written into the current
             working directory.
             The filtered PET images in Analyze 7.5 format will be
             written where the input files are located. The file names
             will be derived from the fname argument extended by the
             suffix '_g' and the value of the filter FWHM. If the output
             files already exist, they will not be overwritten.

Comments on the use of the image space convolution method versus using the Fourier method

The execution times of the plot were obtained filtering a single frame image volume from the HRRT scanner (140 x 160 x 128 voxels) on an IBM Blade Server node with Xeon 3.06 GHz processor and 2.5 Gigabytes RAM running SuSe Linux Enterprise Server 10.
Note that for the image space convolution with a 3D Gaussian of 10 mm FWHM the resident set size was about 63 megabytes and the total virtual memory used was 111 megabytes. To perform the same filtering in the Fourier domain, up to 815 megabytes of memory were used as resident set size and a peak of 863 megabytes as total virtual memory.

The execution time of hrrt_gfilt performing the convolution in image space (green line) is proportional to the number of elements in the Gaussian filter kernel (red line) which in turn is approximately proportional to the third power of the width of the Gaussian. Performing the filtering as a multiplication in the Fourier domain, the execution time of hrrt_gfilt practically only depends on the image volume size and not on the Gaussian filter width (blue line).

In summary, for systems low on memory hrrt_gfilt is best run performing the convolution in images space (default method). On systems with sufficient physical memory, the Gaussian 3D filtering can be performed considerably faster in the Fourier domain for filter widths greater than about 3.5 mm FWHM. For large filters (width of 10 mm FWHM or more), Gaussian 3D filtering has to be performed in the Fourier domain because the time needed for the convolution in image spaces is prohibitively long.

Example 1: Single frame HRRT image, FWHM= 2.5 mm (convolution in image space)

This image has been iteratively reconstructed and therefore contains only nonnegative voxel values.

% hrrt_gfilt data/pk11195/h00050/h00050_20070417_nf02_i06_v2 2.5
PET Image:
----------
  File Name          : "data/pk11195/h00050/h00050_20070417_nf02_i06_v2"
  Byte Order         : Little Endian
  Subject Identifier : "h00050    " (10 characters)
  Description        : "Default                                                                        " (80 characters)
  Series Number      : "6         " (10 characters)
  Series Date        : "2007-04-17" (10 characters)
  Series Time        : "10:26:46  " (10 characters)
  Patient Position   : "HFS" (3 characters)
  Data Type          = 4   SIGNED_SHORT
  Width              = 140
  Height             = 180
  Depth              = 128
  Number Of Time Sl. =   1
  Voxel Width        = 1.21875 mm  
  Voxel Height       = 1.21875 mm  
  Voxel Depth        = 1.21875 mm  
  ReconstructionMeth : "-OSEM3D-OP" (10 characters)
  Maximum Data Value =              32767
  Minimum Data Value =                  0
  ROI Scale Factor   = 0.0005724382936023 (single precision)
  Calibration Maximum=          18.757086 kBq/ml   (single precision)
  Calibration Minimum=                  0 kBq/ml   (single precision)
  Radioactive decay  : lambda= Inf 1/s, T1/2= 0 s= 0 min

Gaussian Lowpass Filter:
------------------------
  FWHM               = 2.5 mm
  Gaussian's sigma   = 1.06165 mm
  Filter size        = [9, 9, 9] voxels

  Performing 3-D image filtering, volume 1, done.
  Elapsed time       : 95.0 seconds with convolution in image space using IMFILTER

       1 ifm=[  32767;      0] ofm=[  19338;      0] is=     3.9770136e+09 os=      3.962529e+09

Filtered PET Image:
-------------------
  File Name          : "data/pk11195/h00050/h00050_20070417_nf02_i06_v2_g2.5"
  Byte Order         : Big Endian
  Subject Identifier : "h00050    " (10 characters)
  Description        : "Default                                                                        " (80 characters)
  Series Number      : "6         " (10 characters)
  Series Date        : "2007-04-17" (10 characters)
  Series Time        : "10:26:46  " (10 characters)
  Patient Position   : "HFS" (3 characters)
  Data Type          = 4   SIGNED_SHORT
  Width              = 140
  Height             = 180
  Depth              = 128
  Number Of Time Sl. =   1
  Voxel Width        = 1.21875 mm  
  Voxel Height       = 1.21875 mm  
  Voxel Depth        = 1.21875 mm  
  ReconstructionMeth : "-OSEM3D-OP" (10 characters)
  Maximum Data Value =              19338
  Minimum Data Value =                  0
  ROI Scale Factor   = 0.0005724382936023 (single precision)
  Calibration Maximum=          11.069812 kBq/ml   (single precision)
  Calibration Minimum=                  0 kBq/ml   (single precision)
  Radioactive decay  : lambda= Inf 1/s, T1/2= 0 s= 0 min

Two files psf2.5.hdr and psf2.5.img have been saved in the current working directory. They are Analyze 7.5 Images of the 3D Gaussian filter used.

Example 2: Dynamic HiREZ image, FWHM= 10 mm (multiplication in the Fourier domian)

This image was generated using filtered backprojection and has hence positive and negative voxel values.

% hrrt_gfilt h00005/160920/h00005_20060623_160920_s15_nf29.hdr 10 fft
PET Image:
----------
  File Name          : "h00005/160920/h00005_20060623_160920_s15_nf29"
  Byte Order         : Little Endian
  Subject Identifier : "h00005    " (10 characters)
  Description        : "PET Water Ranging Study - Pelvis (Adult)                                        " (80 characters)
  Series Number      : "15        " (10 characters)
  Series Date        : "2006-06-23" (10 characters)
  Series Time        : "16:09:20.9" (10 characters)
  Patient Position   : "FFS" (3 characters)
  Data Type          = 4   SIGNED_SHORT
  Width              = 256
  Height             = 256
  Depth              =  81
  Number Of Time Sl. =  29
  Voxel Width        = 2.66615 mm  
  Voxel Height       = 2.66615 mm  
  Voxel Depth        = 2 mm  
  ReconstructionMeth : "DIFT      " (10 characters)
  Maximum Data Value =              32767
  Minimum Data Value =             -28858
  ROI Scale Factor   = 0.0972374901175499 (single precision)
  Calibration Maximum=          3186.1807 kBq/ml   (single precision)
  Calibration Minimum=         -2806.0793 kBq/ml   (single precision)
  Radioactive decay  : lambda= 0.00567038 1/s, T1/2= 122.24 s= 2.03733 min

Gaussian Lowpass Filter:
------------------------
  FWHM               = 10 mm
  Gaussian's sigma   = 4.24661 mm
  Filter size        = [15, 15, 19] voxels
  Fourier domain vol = [512, 512, 128] complex elements
  FFT of the filter  : 14.4 seconds

  Performing 3-D image filtering, volume 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, done.
  Elapsed time       : 891.4 seconds with FFT, multiplication and IFFT

       1 ifm=[    523;   -601] ofm=[     22;    -15] is=            977772 os=            954499
       2 ifm=[  10600;  -8434] ofm=[    351;   -277] is=          -3509256 os=          -3502999
       3 ifm=[  14203; -13008] ofm=[    342;   -378] is=          -4060605 os=          -4065483
       4 ifm=[  20896; -15976] ofm=[    445;   -330] is=          -3469000 os=          -3461777
       5 ifm=[  15785; -18523] ofm=[    566;   -443] is=           -485374 os=           -516673
       6 ifm=[  17024; -13057] ofm=[    666;   -472] is=          10444445 os=          10254220
       7 ifm=[  20079; -21830] ofm=[    657;   -546] is=          21493813 os=          21058945
       8 ifm=[  22907; -20863] ofm=[    669;   -503] is=          31352821 os=          30746225
       9 ifm=[  28142; -24369] ofm=[    779;   -550] is=          35761011 os=          35013359
      10 ifm=[  32767; -26168] ofm=[    825;   -760] is=          35300224 os=          34560502
      11 ifm=[  24912; -28858] ofm=[    705;   -662] is=          37771160 os=          37075487
      12 ifm=[  22895; -25056] ofm=[    674;   -583] is=          37645430 os=          36897564
      13 ifm=[  18921; -14920] ofm=[    661;   -535] is=          41979180 os=          41099870
      14 ifm=[  22271; -20080] ofm=[    686;   -551] is=          39901577 os=          39131415
      15 ifm=[  28055; -25854] ofm=[    813;   -712] is=          37881118 os=          37055749
      16 ifm=[  15410; -16220] ofm=[    512;   -488] is=          35518177 os=          34839504
      17 ifm=[  14811; -13225] ofm=[    481;   -379] is=          35008494 os=          34294511
      18 ifm=[  15483; -18309] ofm=[    501;   -379] is=          32835573 os=          32152621
      19 ifm=[  12432; -11845] ofm=[    412;   -271] is=          32253564 os=          31647440
      20 ifm=[  13802; -13434] ofm=[    437;   -309] is=          29836462 os=          29209363
      21 ifm=[   8826;  -7414] ofm=[    363;   -234] is=          27125580 os=          26597523
      22 ifm=[   9807; -10090] ofm=[    239;   -180] is=          24652161 os=          24145258
      23 ifm=[   7731; -10667] ofm=[    296;   -178] is=          22665229 os=          22188779
      24 ifm=[   6608;  -7002] ofm=[    205;   -153] is=          19604003 os=          19169156
      25 ifm=[   5035;  -5285] ofm=[    174;   -136] is=          16927307 os=          16543720
      26 ifm=[   4407;  -3827] ofm=[    143;    -93] is=          14280570 os=          13972855
      27 ifm=[   4916;  -3352] ofm=[    141;    -93] is=          12310550 os=          12042626
      28 ifm=[   4308;  -3458] ofm=[    117;    -86] is=          10262569 os=          10035164
      29 ifm=[   3555;  -2976] ofm=[    125;    -75] is=           8741869 os=           8571112

Filtered PET Image:
-------------------
  File Name          : "h00005/160920/h00005_20060623_160920_s15_nf29_g10"
  Byte Order         : Little Endian
  Subject Identifier : "h00005    " (10 characters)
  Description        : "PET Water Ranging Study - Pelvis (Adult)                                        " (80 characters)
  Series Number      : "15        " (10 characters)
  Series Date        : "2006-06-23" (10 characters)
  Series Time        : "16:09:20.9" (10 characters)
  Patient Position   : "FFS" (3 characters)
  Data Type          = 4   SIGNED_SHORT
  Width              = 256
  Height             = 256
  Depth              =  81
  Number Of Time Sl. =  29
  Voxel Width        = 2.66615 mm  
  Voxel Height       = 2.66615 mm  
  Voxel Depth        = 2 mm  
  ReconstructionMeth : "DIFT      " (10 characters)
  Maximum Data Value =                825
  Minimum Data Value =               -760
  ROI Scale Factor   = 0.0972374901175499 (single precision)
  Calibration Maximum=          80.220932 kBq/ml   (single precision)
  Calibration Minimum=          -73.90049 kBq/ml   (single precision)
  Radioactive decay  : lambda= 0.00567038 1/s, T1/2= 122.24 s= 2.03733 min

Two files psf10.hdr and psf10.img have been saved in the current working directory. They are Analyze 7.5 Images of the 3D Gaussian filter used.


@(#)toolshelp.html 2.35 23/03/15 15:39:02 © Rainer Hinz, The University of Manchester.