Differences between revisions 1 and 10 (spanning 9 versions)
Revision 1 as of 2004-08-03 22:19:10
Size: 1029
Editor: EvelinaBusa
Comment: set up command template, brief summary of command
Revision 10 as of 2007-06-09 02:56:14
Size: 7993
Comment: Added notes on gotcha with -odt option, and clarified --no_scale option
Deletions are marked like this. Additions are marked like this.
Line 1: Line 1:
= mri_convert = ## 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
Line 3: Line 9:
mri_convert - converts MRI data from any of a number of native formats to the specified format (usually COR) required for FreeSurfer processing
[[Navigation(children)]]
'''Index'''
[[TableOfContents]]

= Name =
mri_convert - converts MRI data format/file type
Line 6: Line 18:
 command argA argB -flag1 <arg1> -flag2 <arg2> -flag3 <arg3> mri_convert [<options>] involume outvolume
Line 8: Line 20:
= Positional Arguments =
 argA
= Arguments =
== Positional Arguments ==
|| involume || input volume ||
|| outvolume || output volume ||
Line 11: Line 25:
 Description == Required Flagged Arguments ==
None
Line 13: Line 28:
 argB == Optional Flagged Arguments ==
Line 15: Line 30:
 Description || -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)||
Line 17: Line 93:
= Required Flagged Arguments =
 -flag1 <arg1>

 Description

 - flag2 <arg2>

 Description

= Optional Flagged Arguments =

 -flag3 <arg3>

 Description.
=== Applying Transforms ===
|| -T, -at, --apply_transform xfmfile || apply tranform given by xfmfile || ||
|| -ait, --apply_inverse_transform xfmfile || apply inverse of tranform given by xfmfile || ||
|| --devolvexfm subjectid || || ||
|| --like vol: output is embedded in a volume like vol|| || ||
Line 33: Line 100:
 file1 || outvolume || output volume ||
Line 35: Line 102:
 Description = 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:
Line 37: Line 106:
 file2 || 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)||
Line 39: Line 127:
 Description Notes:
Line 41: Line 129:
= Example 1 =
 command argA argB -flag1 foo -flag2 goo
If the user specifies any of the direction cosines, the ras_good_flag is set.
Line 44: Line 131:
 Description CONVERTING TO SPM-ANALYZE FORMAT
Line 46: Line 133:
= Example 2 =
 command argA argB -flag1 foo -flag2 goo -flag3 hoo
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.
Line 49: Line 139:
 Description = 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 ==
??

= Bugs =
None
Line 52: Line 167:
 ["command2"]

 ["command3"]

= Author =
 JaneSmith
["mris_convert"]
Line 60: Line 170:
 Command``Guide FreeSurfer, FsFast

= Methods Description =
{{{
N/A
}}}
Line 63: Line 178:
## For example: ["Belliveau1991"]
 NameYear
None
Line 67: Line 181:
 Report bugs to <> Report bugs to <analysis-bugs@nmr.mgh.harvard.edu>
Line 69: Line 183:
= Category =
## For example: CategoryFreeSurferCommandVolumeConversion
 Category``Stream``Command
= Author/s =
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>

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 xfmfile

-ait, --apply_inverse_transform xfmfile

apply inverse of tranform given by xfmfile

--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

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)

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

??

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

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