Skip to content

AFNI/NIfTI Server

Sections
Personal tools
You are here: Home » AFNI » Documentation

Doxygen Source Code Documentation


Main Page   Alphabetical List   Data Structures   File List   Data Fields   Globals   Search  

1dtranspose.c File Reference

#include "mrilib.h"

Go to the source code of this file.


Functions

int main (int argc, char *argv[])

Function Documentation

int main int    argc,
char *    argv[]
 

convert three sub-briks to a raw dataset with consecutive triplets

Definition at line 9 of file 1dtranspose.c.

References argc, machdep(), mri_read_1D(), mri_write_ascii(), THD_filename_ok(), and THD_is_file().

00010 {
00011    MRI_IMAGE * inim ;
00012 
00013    /*-- help? --*/
00014 
00015    if( argc < 2 || strcmp(argv[1],"-help") == 0 ){
00016      printf(
00017        "Usage: 1dtranspose infile outfile\n"
00018        "where infile is an AFNI *.1D file (ASCII list of numbers arranged\n"
00019        "in columns); outfile will be a similar file, but transposed.\n"
00020        "You can use a column subvector selector list on infile, as in\n"
00021        "  1dtranspose 'fred.1D[0,3,7]' ethel.1D\n"
00022        "\n"
00023        "* This program may produce files with lines longer than a\n"
00024        "   text editor can handle.\n"
00025        "* If 'outfile' is '-' (or missing entirely), output goes to stdout.\n"
00026      ) ;
00027      exit(0) ;
00028    }
00029 
00030    machdep() ;
00031 
00032    if( argc > 2 && !THD_filename_ok(argv[2]) ){
00033       fprintf(stderr,"** Illegal output filename!\n"); exit(1);
00034    }
00035    if( argc > 2 && strcmp(argv[2],"-") != 0 && THD_is_file(argv[2]) ){
00036       fprintf(stderr,"** Output file already exists!\n"); exit(1);
00037    }
00038 
00039    /* read input file */
00040 
00041    inim = mri_read_1D( argv[1] ) ;
00042    if( inim == NULL ){
00043      fprintf(stderr,"** Can't read input file!\n"); exit(1);
00044    }
00045 
00046    mri_write_ascii( (argc>2) ? argv[2] : "-" , inim ) ;
00047    exit(0) ;
00048 }
 

Powered by Plone

This site conforms to the following standards: