https://surfer.nmr.mgh.harvard.edu/pub/docs/html/mri_convert.help.xml.html

Index

Name

mri_convert

Description

mri_convert is a general purpose utility for converting 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 that end in .img are assumed to be in spm analyze format). Second, the user can explicity set the type of file using --in_type and/or --out_type.

Legal values for --in_tye (-it) and --out_type (-ot) are listed under optional flagged arguments.

A note on specifying orientation:

Do not use this to try to change the orientation for FSL. This is only to be used when the orientation information in the input file is *wrong*. If it is correct, this will make it wrong! If you are having problems with fslview displaying your data, consult the FSL website for methods to reorient.

Ideally, the orientation information is derived from a DICOM file so that you have some confidence that it is correct. It is generally pretty easyto determine which direction Anterior/Posterior or Inferior/Superior are. Left/Right is very difficult. However, if you have some way of knowing which direction is which, you can use these options to incorporate this information into the header of the output format. For analyze files, it will be stored in the output.mat file. For NIFTI, it is stored as the qform matrix. For bshort/bfloat, it is stored in the .bhdr file. For mgh/mgz it is internal. First of all, determining and setting the orientation is hard. Don't fool yourself into thinking otherwise. Second, don't think you are going to learn all you need to know from this documentation. Finally, you risk incorporating a left-right flip in your data if you do it incorrectly. OK, there are two ways to specify this information on the command-line. (1) explicitly specify the direction cosines with -iid, -ijd, -ikd. If you don't know what a direction cosine is, don't use this method. (2) specify an orientation string with --in_orientation ostring and --out_orientation ostring Supply the orientation information in the form of an orientation string (ostring). The ostring is three letters that roughly describe how the volume is oriented. This is usually described by the direction cosine information as originally derived from the dicom but might not be available in all data sets. You'll have to determine the correct ostring for your data. The first character of ostring determines the direction of increasing column. The second character of ostring determines the direction of increasing row. The third character of ostring determines the direction of increasing slice. Eg, if the volume is axial starting inferior and going superior the slice is oriented such that nose is pointing up and the right side of the subject is on the left side of the image, then this would correspond to LPS, ie, as the column increases, you move to the patients left; as the row increases, you move posteriorly, and as the slice increases, you move superiorly. Valid letters are L, R, P, A, I, and S. There are 48 valid combinations (eg, RAS LPI, SRI). Some invalid ones are DPS (D is not a valid letter), RRS (can't specify R twice), RAP (A and P refer to the same axis). Invalid combinations are detected immediately, an error printed, and the program exits. Case-insensitive. Note: you can use tkregister2 to help determine the correct orientation string.

Synopsis

mri_convert [options] <in volume> <out volume>

Arguments

Positional Arguments

involume

Input volume

outvolume

Output volume

Required Flagged Arguments

None

Optional Flagged Arguments

-ro or --read_only

-nw or --no_write

-ii or --in_info

-oi or --out_info

-is or --in_stats

Print statistics on input volume

-os or --out_stats

Print statistics on output volume

-im or --in_matrix

-om or --out_matrix

-upsample N <size>

Reduce voxel size by a factor of N in all dimensions

-iis or --in_i_size <size>

-ijs or --in_j_size <size>

-ikd or --in_k_size <size>

--in_orientation orientation-string

see SPECIFYING THE ORIENTATION

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

-dic or --delta_in_center <dR coordinate> <dA coordinate> <dS coordinate>

--sphinx

Change orientation info to sphinx

-oni or -oic or --out_i_count <count>

-onj or -ojc or --out_j_count <count>

-onk or -okc or --out_k_count <count>

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

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

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

--out_orientation orientation-string

See SETTING ORIENTATION

-oc or --out_center <R direction> <A direction> <S direction>

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

--bfile-little-endian

Write out bshort/bfloat files in little endian

--in_stats_table

Input data is a stats table as produced by asegstats2table or aparcstats2table

--out_stats_table

Output data is a stats table (use --like to pass template table for measure, columns, and rows heads)

-rt or --resample_type <interpolate|weighted|nearest|cubic>

Default is interpolate

-nth

Specify frame number

--no_scale flag <-ns>

1 means don't rescale values for COR

-nc or --nochange

Don't change type of input to that of template

-tr TR

TR in msec

-te TE

TE in msec

||-TI TI || TI in msec (note uppercase flag)||

-flip_angle flip angle

Angle in radians

--autoalign mtxfile

Text file with autoalign matrix

-oval val

||--outside_val val || Set the values outside of the image that may rotate in if a transform is applied to val ||

Applying Transforms Flagged Arguments

Examples

Example 1

Command:

Description:

Example 2

Command:

Description:

See Also

othercommand1, othercommand2

Links

FreeSurfer, FsFast

Reporting Bugs

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

Author/s

DougGreve, BruceFischl