MRI_TO_ASCII is a C program which reads a file containing MRI information in binary format, and writes an equivalent ASCII text file.
mri_to_ascii file.dat file.txt
The computer code and data files described and made available on this web page are distributed under the GNU LGPL license.
ASCII_TO_MRI is a C program which converts translated ASCII text back to binary format.
REGION is a FORTRAN90 library which reads an ASCII MRI file and groups the voxels into regions.
You can go up one level to the C source codes.