Interconvert image formats


DICOM \(\rightarrow\) 4dfp

Usage: dcm_to_4dfp [-b base] [-d gggg eeee] [-f] [-g] [-u] file(s)

Slice Spacing Options: [-c] [-t <flt> or S or T]

Slice Position Options: [-X] [-Y] [-Z]


dcm_to_4dfp *
dcm_to_4dfp -b ID101 -f -g -u *IMA
dcm_to_4dfp -d 0008 0030 -t 4.98 -g *.dcm
dcm_to_4dfp -b P0089 -t T -g mydir/*


[-b base] Output base filename follows the -b
[-c] Slice Spacing: By Image Position (0020 0032)
[-d gggg eeee] Divide series by group and element number (Default: ID series time (0008 0031))
[-f] Directories will be created, and dicom files will be moved
[-g] Add image name, XYZ relative position, and number to rec file
[-q] Slice Spacing: Do not compute by Image Position
[-r] Rescale: Use the rescale slope and intercept fields
[-t <flt>] Slice Spacing: Use input value.[-t <flt>]
[-t T] Slice Spacing: Use Slice Thickness 0018 0050.[-t T]
[-t S] Slice Spacing: Use Slice Spacing 0018 0088 [-t S]
[-u] Output files named using sequence tag 0018 0024 plus number

4dfp Coordinant System is determined by Image Position (0020 0032). Multivolume and BOLD images are ordered by REL Image Number (0020 0013). [-X] Sagittal: image positions will be ordered low to high [-Y] Coronal: image positions will be high to low [-Z] Transverse: image positions will be high to low [-@ <b|l>] output big or little endian (default CPU endian)

N.B.: -t S is the default slice spacing
N.B.: Default slice position is transverse ordered by REL Image Number (0020 0013)


report status and interconvert big \(\leftrightarrow\) little endian

Usage: endian_4dfp <(4dfp) image>


-@<b|l|c> make <(4dfp) image> big, little or CPU endian
-t perform var(log(fabs(.))) test

N.B.: <(4dfp) image> may be overwritten
N.B.: absent option -@ endian_4dfp only reports state of <(4dfp) image>


4dfp \(\rightarrow\) analyze 7.5

Usage: 4dfptoanalyze <(4dfp) filename>


-c<flt> scale output values by specified factor
-8 output 8 bit unsigned char
-SPM99 include origin and scale in hdr (http:/
-@<b|l> output big or little endian (default CPU endian)


analyze 7.5 (int or char) \(\rightarrow\) 4dfp

Usage: analyzeto4dfp <analyze_image>


-s apply SPM2 ROIScaleFactor
-x flip first axis
-y flip second axis
-z flip third axis
-@<b|l> toutput big or little endian (default CPU endian)
-O<int> supply orientation code (in range [0-5])

N.B.: to convert SPM2 use options -x and -s


create analyze 7.5 header

Usage: ifh2hdr <(4dfp) file>


ifh2hdr vc654_mpr_atl -r-500to1500


-r<flt>[to<flt>] set range


dump analyze 7.5 header info

Usage: hdr2txt <analyze_image>


hdr2txt brain_asig[.hdr]


convert atlas indices (ASCII text) to mm (e.g. atlas coordinates)

Usage: index2atl <(4dfp) ifhroot> <index_list_file>


index2atl -af time_BOXzstat_333_t88.4dfp.ifh time_BOXzstat_333_t88_index.lst


-f input indices use FORTRAN convention (first index=1) (default first index=0)
-a indices were read under orientation-specific 4dfp<->analyze flips
-o<str> output coordinates to specified file

N.B.: <(4dfp) ifhroot> corresponds to the 4dfp image from which the indices were read


convert text columns to 4dfp format timeseries

Usage: asciito4dfp <text file> <(4dfp) out>


-@<b|l> output big or little endian (default CPU endian)

N.B.: columns in <text file> map to voxels in <(4dfp) out>
N.B.: ‘#’ in <text file> introduce comments
N.B.: <text file> lines beginning with ‘#’ are included in <(4dfp) out>.img.rec


convert microPET images  4dfp

Usage: mpetto4dfp <microPET_data>


mpetto4dfp m1042-cft1_v1


-x flip x
-y flip y
-z flip z
-w create frame duration listing for use with actmapf_4dfp -w
-c<flt> scale all voxel values by specified factor
-o<str> name 4dfp output using specified string (default same as input)
-@<b|l> output big or little endian (default input endian)


Varian fid/procpar \(\rightarrow\) 4dfp

Usage: vto4dfp <varian file path>


vto4dfp /home/usr/shimonyj/vto4dfp/hard_010703 -odwi_010703


-v verbose mode
-D suppress subtraction of k-space DC offset
-I perform Fourier interpolation; output voxel count will be quadrupled
-F phase reverse odd echos in multi-echo data
-o<str> specify 4dfp outroot (default=”fid”)
-c<flt> intensity scale output (mag) image by specified constant
-m<flt> scale voxel dimensions by specified constant
-@<b|l> output big or little endian (default CPU endian)

N.B.: vto4dfp expects <varian file path> to contain files “fid” and “procpar”


interconvert nii \(\leftrightarrow\) 4dfp

Usage: nifti_4dfp -<4|n> <infile> <outfile> [options]


nifti_4dfp -n time_BOXzstat_333_t88.4dfp.ifh time_BOXzstat_333_t88.nii


-T <t4 file> specify a t4 file to use converting TO NIfTI from 4dfp
-n convert TO NIfTI from 4dfp
-4 convert TO 4dfp from NIfTI
-N suppress saving of mmppix and center fields in output ifh
-@<val> specify endianness for output, b or B for big, l or L for little

N.B.: exactly one of -4 or -n must be specified
N.B.: “.4dfp.ifh” or “.nii” are appended to filenames specified without extension
N.B.: option -N has effect only on converting nii->4dfp
N.B.: option -T has effect only on converting 4dfp->nii


interconvert nii.gz \(\leftrightarrow\) 4dfp (nifti_4dfp wrapper)

Usage: niftigz_4dfp -<4|n> <infile> <outfile> [options]


niftigz_4dfp -4 VB18896_mpr_n1_333_t88.nii.gz VB18896_mpr_n1_333_t88

Options (for more options, see nifti_4dfp)

-v verbose mode
-s<int> skip specified number of frames at run start on 4dfp->NIfTI coversion

N.B.: niftigz_4dfp always gzips NIfTI output but unzipped NIfTI input is left unchanged