Differences between revisions 15 and 16
Deletions are marked like this. Additions are marked like this.
Line 1: Line 1:
<<Include(https://surfer.nmr.mgh.harvard.edu/pub/docs/html/mri_convert.help.xml.html)>>

## Note: This page was created with the CommandTemplate
##
## If you're modifying this page please take a look at the
## latest version of CommandTemplate to ensure that you're
## using the latest version of the CommandTemplate
##
## See HelpOnCommandTemplate for description of formatting


<<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>|| || This may prompt rescale. To disable that, use no_scale option. ||
|| -rt, --resample_type <interpolate|weighted|nearest|sinc|cubic> (default is interpolate)|| ||
|| -ns, --no_scale <value>: 1 = dont rescale values for COR or MGH/MGZ output || || example: --no_scale 1 ||
|| -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>||
|| -r, --reorder olddim1 olddim2 olddim3|| reorder dimensions || 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 || applies 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 ||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 || 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> || || ||
|| -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)||

=== Applying Transforms ===
|| -T, -at, --apply_transform xfmfile || apply tranform given by xfm or m3z files || ||
|| -ait, --apply_inverse_transform xfmfile || apply inverse of tranform given by xfm or m3z files || ||
|| --devolvexfm subjectid || || ||
|| --like vol: output is embedded in a volume like vol|| || ||

= 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 (deprecated) ||
|| mgh || MGH-NMR format ||
|| mgz || MGH-NMR gzipped (compressed) mgh 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)||
|| nifti1 || NIfTI-1 volume (separate image and header files)||
|| nii || NIfTI-1 volume (single file), if input/output has extension .nii.gz, then compressed is used||

Notes:

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

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.

= Examples =
== Example 1 ==
APPLYING TRANSFORMS (INCLUDING TALAIRACH)


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 ==
From the subject directory:


mri_convert -at mri/transforms/talairach_one.m3z mri/norm.mgz mri/norm_transformed_by_gca_one.mgz

= Bugs =
None

= See Also =
[[mris_convert]]

= Links =
FreeSurfer, FsFast

= Methods Description =
{{{
N/A
}}}

= References =
None

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

= Author/s =
YasunariTosa, DougGreve, BruceFischl
 . <<Include(https://surfer.nmr.mgh.harvard.edu/pub/docs/html/mri_convert.help.xml.html)>>

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