Differences between revisions 7 and 8
Deletions are marked like this. Additions are marked like this.
Line 9: Line 9:

[[Navigation(children)]]
'''Index'''
[[TableOfContents]]
Line 13: Line 18:
mri_convert [options] <in volume> <out volume> mri_convert [<options>] involume outvolume
Line 17: Line 22:
|| in volume || your input file name || involume || input volume ||
||
outvolume || output volume ||
Line 20: Line 26:
None.
The file type can be specified in two ways. First, mri_convert will try
to figure it out on its own from the format of the file name (eg, files thatend in .img are assumed to be in spm analyze format). Second, the user canexplicity set the type of file using --in_type and/or --out_type.
None

== Optional Flagged Arguments ==

|| -ro, --read_only || ||
|| -nw, --no_write || ||
|| -ii, --in_info || ||
|| -oi, --out_info || ||
|| -is, --in_stats || ||
|| -os, --out_stats || ||
|| -im, --in_matrix || ||
|| -om, --out_matrix|| ||
|| -iis, --in_i_size <size> || ||
|| -ijs, --in_j_size <size> || ||
|| -iks, --in_k_size <size> || ||
|| --force_ras_good || use default when orientation info absent||
|| -iid, --in_i_direction <R direction> <A direction> <S direction> || ||
|| -ijd, --in_j_direction <R direction> <A direction> <S direction> || ||
|| -ikd, --in_k_direction <R direction> <A direction> <S direction> || ||
|| -ic, --in_center <R coordinate> <A coordinate> <S coordinate> ||
|| -oni, -oic, --out_i_count <count>|| ||
|| -onj, -ojc, --out_j_count <count>|| ||
|| -onk, -okc, --out_k_count <count>|| ||
|| -ois, --out_i_size <size> || ||
|| -ojs, --out_j_size <size>|| ||
|| -oks, --out_k_size <size>|| ||
|| --nskip n : skip the first n frames|| ||
|| -oid, --out_i_direction <R direction> <A direction> <S direction>|| ||
|| -ojd, --out_j_direction <R direction> <A direction> <S direction>|| ||
|| -okd, --out_k_direction <R direction> <A direction> <S direction>|| ||
|| -oc, --out_center <R coordinate> <A coordinate> <S coordinate>|| ||
|| -odt, --out_data_type <uchar|short|int|float>|| ||
|| -rt, --resample_type <interpolate|weighted|nearest|sinc|cubic> (default is interpolate)|| ||
|| --no_scale flag <-ns>: 1 = dont rescale values for COR|| ||
|| -nc --nochange - don't change type of input to that of template|| ||
|| -tr TR : TR in seconds|| ||
|| --unwarp_gradient_nonlinearity||<sonata | allegra | GE> || <fullUnwarp | through-plane> <JacobianCorrection | noJacobianCorrection> <linear | sinc> <sincInterpHW>||

= Outputs =
|| outvolume || output volume ||

= Description =
mri_convert is a general purpose utility for convertin between different file formats. The file type can be specified in two ways. First, mri_convert will try to figure it out on its own from the format of the file name (eg, files thatend in .img are assumed to be in spm analyze format). Second, the user canexplicity set the type of file using --in_type and/or --out_type.
Line 24: Line 70:
 
Line 59: Line 105:
  gdf - GDF volume (requires image stem for output; use -gis)
 

== Optional Flagged Arguments ==

Options are

  -ro, --read_only

  -nw, --no_write
 
  -ii, --in_info

  -oi, --out_info

  -is, --in_stats

  -os, --out_stats

  -im, --in_matrix

  -om, --out_matrix
 
  -iis, --in_i_size <size>

  -ijs, --in_j_size <size>

  -iks, --in_k_size <size>

  --force_ras_good : use default when orientation info absent
 
  -iid, --in_i_direction <R direction> <A direction> <S direction> -ijd, --in_j_direction <R direction> <A direction> <S direction> -ikd, --in_k_direction <R direction> <A direction> <S direction>

  -ic, --in_center <R coordinate> <A coordinate> <S coordinate>

  -oni, -oic, --out_i_count <count>

  -onj, -ojc, --out_j_count <count>

  -onk, -okc, --out_k_count <count>
 
  -ois, --out_i_size <size>

  -ojs, --out_j_size <size>

  -oks, --out_k_size <size>

 --nskip n : skip the first n frames
 
  -oid, --out_i_direction <R direction> <A direction> <S direction> -ojd, --out_j_direction <R direction> <A direction> <S direction> -okd, --out_k_direction <R direction> <A direction> <S direction>

  -oc, --out_center <R coordinate> <A coordinate> <S coordinate>

  -odt, --out_data_type <uchar|short|int|float>

  -rt, --resample_type <interpolate|weighted|nearest|sinc|cubic> (default is interpolate)
 
  --no_scale flag <-ns>: 1 = dont rescale values for COR
 
  -nc --nochange - don't change type of input to that of template
 
  -tr TR : TR in seconds
 
  --unwarp_gradient_nonlinearity
      <sonata | allegra | GE>
      <fullUnwarp | through-plane>
      <JacobianCorrection | noJacobianCorrection>
      <linear | sinc>
      <sincInterpHW>
 
 
= Outputs =
|| out volume || desired output filename.format ||

= Description =
  gdf - GDF volume (requires image stem for output; use -gis)
Line 139: Line 110:
 
Line 141: Line 112:
  
Line 143: Line 114:
  
Line 145: Line 116:
  
Line 147: Line 118:
 
Line 149: Line 120:
 
Line 151: Line 122:
  
Line 153: Line 124:
  
Line 157: Line 128:
 
Line 159: Line 130:
 
Line 161: Line 132:
 
Line 163: Line 134:
 
Line 166: Line 137:
 
Line 169: Line 140:
 
Line 174: Line 145:
Frame numbers begin at one. By default, the width the of zero padding is 3.This can be controlled with --in_nspmzeropad N where N is the new width.  Frame numbers begin at one. By default, the width the of zero padding is 3.This can be controlled with --in_nspmzeropad N where N is the new width.
Line 181: Line 152:
 
Line 185: Line 156:
 
Line 187: Line 158:
 
Line 191: Line 162:
 
Line 251: Line 222:
 
Line 253: Line 224:
 
If the user specifies any of the direction cosines, the ras_good_flag is set. 

If the user specifies any of the direction cosines, the ras_good_flag is set.
Line 258: Line 229:
["mris_convert"]
Line 276: Line 247:
CherifSahyoun
YasunariTosa, DougGreve, BruceFischl

Navigation(children) Index TableOfContents

Name

mri_convert - converts MRI data format/file type

Synopsis

mri_convert [<options>] involume outvolume

Arguments

Positional Arguments

involume

input volume

outvolume

output volume

Required Flagged Arguments

None

Optional Flagged Arguments

-ro, --read_only

-nw, --no_write

-ii, --in_info

-oi, --out_info

-is, --in_stats

-os, --out_stats

-im, --in_matrix

-om, --out_matrix

-iis, --in_i_size <size>

-ijs, --in_j_size <size>

-iks, --in_k_size <size>

--force_ras_good

use default when orientation info absent

-iid, --in_i_direction <R direction> <A direction> <S direction>

-ijd, --in_j_direction <R direction> <A direction> <S direction>

-ikd, --in_k_direction <R direction> <A direction> <S direction>

-ic, --in_center <R coordinate> <A coordinate> <S coordinate>

-oni, -oic, --out_i_count <count>

-onj, -ojc, --out_j_count <count>

-onk, -okc, --out_k_count <count>

-ois, --out_i_size <size>

-ojs, --out_j_size <size>

-oks, --out_k_size <size>

--nskip n : skip the first n frames

-oid, --out_i_direction <R direction> <A direction> <S direction>

-ojd, --out_j_direction <R direction> <A direction> <S direction>

-okd, --out_k_direction <R direction> <A direction> <S direction>

-oc, --out_center <R coordinate> <A coordinate> <S coordinate>

-odt, --out_data_type <uchar|short|int|float>

-rt, --resample_type <interpolate|weighted|nearest|sinc|cubic> (default is interpolate)

--no_scale flag <-ns>: 1 = dont rescale values for COR

-nc --nochange - don't change type of input to that of template

-tr TR : TR in seconds

--unwarp_gradient_nonlinearity

Expected "=" to follow "sonata"

<fullUnwarp | through-plane> <JacobianCorrection | noJacobianCorrection> <linear | sinc> <sincInterpHW>

Outputs

outvolume

output volume

Description

mri_convert is a general purpose utility for convertin between different file formats. The file type can be specified in two ways. First, mri_convert will try to figure it out on its own from the format of the file name (eg, files thatend in .img are assumed to be in spm analyze format). Second, the user canexplicity set the type of file using --in_type and/or --out_type. Legal values for --in_type (-it) and --out_type (-ot) are:

  • cor - MGH-NMR COR format minc - MNI's Medical Imaging NetCDF format (output may not work) analyze - 3D analyze (same as spm) analyze4d - 4D analyze spm - SPM Analyze format (same as analyze and analyze3d) ge - GE Genesis format (input only) gelx - GE LX (input only) lx - same as gelx ximg - GE XIMG variant (input only) siemens - Siemens IMA (input only) dicom - generic DICOM Format (input only) siemens_dicom - Siemens DICOM Format (input only) afni - AFNI format brik - same as afni bshort - MGH-NMR bshort format bfloat - MGH-NMR bfloat format sdt - Varian (?) outline - MGH-NMR Outline format otl - same as outline gdf - GDF volume (requires image stem for output; use -gis)

Examples

Example 1

APPLYING TRANSFORMS (INCLUDING TALAIRACH)

  • --apply_transform xfmfile (-T or -at) --apply_inverse_transform xfmfile (-ait) --devolvexfm subjectid : --like vol: output is embedded in a volume like vol
  • The volume can be resampled into another space by supplying a transform using the --apply_transform flag. This reads the transform file and applies the transform (when --apply_inverse_transform is used, the transform is inverted and then applied). An example of a transform file is talairach.xfm as found in subjectid/mri/transforms. To convert a subject's orig volume to talairach space, execute the following lines:
    • cd subjectid/mri mkdir talairach mri_convert --apply_transform transforms/talariach.xfm
      • --devolvexfm subjectid --ic 0 0 0 orig talairach
    This properly accounts for the case where the input volume does not have it's coordinate center at 0. To evaluate the result, run:
    • tkmedit -f $SUBJECTS_DIR/talairach/mri/orig -aux talairach
    The main and aux volumes should overlap very closely. If they do not, use tkregister2 to fix it (run tkregister --help for docs).

Example 2

CONVERTING TO SPM-ANALYZE FORMAT

Converting to SPM-Analyze format can be done in two ways, depeding uponwhether a single frame or multiple frames are desired. For a single frame,simply specify the output file name with a .img extension, and mri_convert will save the first frame into the file. For multiple frames, specify the base as the output file name and add --out_type spm. This will save each frame as baseXXX.img where XXX is the three-digit, zero-padded frame number. Frame numbers begin at one. By default, the width the of zero padding is 3.This can be controlled with --in_nspmzeropad N where N is the new width.

Bugs

None

Other Available Options

-r, --reorder olddim1 olddim2 olddim3

  • Reorders axes such that olddim1 is the new column dimension, olddim2 is the new row dimension, olddim3 is the new slice dimension. Example: 2 1 3 will swap rows and cols. --invert_contrast threshold All voxels in volume greater than threshold are replaced with 255-value. Only makes sense for 8 bit images. Only operates on the first frame. -i, --input_volume -o, --output_volume -c, --conform
    • conform to 1mm voxel size in coronal slice direction with 256^3 or more
    -cm, --conform_min
    • conform to the src min direction size
    -cs, --conform_size size_in_mm
    • conform to the size given in mm
    -po, --parse_only -is, --in_stats -os, --out_stats -ro, --read_only -nw, --no_write -sn, --subject_name -rl, --reslice_like

    -tt, --template_type <type> (see above) -f, --frame

    -sc, --scale <scale factor> -il, --in_like -roi -fp, --fill_parcellation -sp, --smooth_parcellation -zo, --zero_outlines -cf, --color_file -nt, --no_translate --status (status file for DICOM conversion) --sdcmlist (list of DICOM files for conversion) -ti, --template_info : dump info about template

    -gis <gdf image file stem> -zgez, --zero_ge_z_offset

    • set c_s=0 (appropriate for dicom files from GE machines with isocenter scanning)

Notes:

If the user specifies any of the direction cosines, the ras_good_flag is set.

See Also

["mris_convert"]

Links

FreeSurfer, FsFast

Methods Description

description
description

References

Reporting Bugs

Report bugs to <analysis-bugs@nmr.mgh.harvard.edu>

Author/s

YasunariTosa, DougGreve, BruceFischl

mri_convert (last edited 2017-11-29 12:05:15 by MorganFogarty)