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  

nsize.c

Go to the documentation of this file.
00001 /*****************************************************************************
00002    Major portions of this software are copyrighted by the Medical College
00003    of Wisconsin, 1994-2000, and are released under the Gnu General Public
00004    License, Version 2.  See the file README.Copyright for details.
00005 ******************************************************************************/
00006 
00007 #include "mrilib.h"
00008 #include "string.h"
00009 
00010 #define ERREX(str) ( fprintf(stderr,"ERROR: %s\a\n",str) , exit(1) )
00011 
00012 int main( int argc , char * argv[] )
00013 {
00014    MRI_IMAGE * imin , * imout ;
00015    MRI_IMARR * imar ;
00016 
00017    if( argc < 3 || strncmp(argv[1],"-help",2) == 0 ){
00018       printf(
00019         "Usage: nsize image_in image_out\n"
00020         "  Zero pads 'image_in' to NxN, N=64,128,256,512, or 1024, \n"
00021         "  whichever is the closest size larger than 'image_in'.\n"
00022         "  [Works only for byte and short images.]\n" ) ;
00023       exit(0) ;
00024    }
00025 
00026    machdep() ;
00027 
00028    imar = mri_read_file( argv[1] ) ;  if( imar == NULL ) ERREX("can't continue!") ;
00029    if( imar->num != 1 ) ERREX("more than 1 image in input file!") ;
00030    imin = IMAGE_IN_IMARR(imar,0) ;
00031 
00032    imout = mri_nsize( imin ) ;
00033    if( imout == NULL ){
00034       fprintf(stderr,"*** failed to scale image! error exit!\n") ;
00035       exit(-1) ;
00036    }
00037 
00038    mri_write( argv[2] , imout ) ;
00039    exit(0) ;
00040 }
 

Powered by Plone

This site conforms to the following standards: