Doxygen Source Code Documentation
imnoneg.c File Reference
#include "mrilib.h"Go to the source code of this file.
| Functions | |
| int | main (int argc, char *argv[]) | 
Function Documentation
| 
 | ||||||||||||
| \** File : SUMA.c 
 Input paramters : 
 
 
 Definition at line 9 of file imnoneg.c. References argc, MRI_IMAGE::kind, machdep(), mri_data_pointer(), mri_read(), mri_write(), MRI_IMAGE::nx, and MRI_IMAGE::ny. 
 00010 {
00011    MRI_IMAGE * imin ;
00012    short *     sar ;
00013    int npix , ii ;
00014 
00015    if( argc < 3 || strncmp(argv[1],"-help",4) == 0 ){
00016       printf("Usage: imnoneg input_image output_image\n"
00017              "Zeros out all negative pixel in input_image\n"
00018              "Only works on images of shorts!\n" ) ;
00019       exit(0) ;
00020    }
00021 
00022    machdep() ;
00023 
00024    imin = mri_read(argv[1]) ;
00025    if( imin == NULL || imin->kind != MRI_short ) exit(1) ;
00026    npix = imin->nx * imin->ny ;
00027    sar  = (short *) mri_data_pointer(imin) ;
00028 
00029    for( ii=0 ; ii < npix ; ii++ )
00030       if( sar[ii] < 0 ) sar[ii] = 0 ;
00031 
00032    mri_write(argv[2],imin) ;
00033    exit(0) ;
00034 }
 | 
 
                             
                             
                             
                             
                             
                             
                             
                             
                             
                             
                             
                             
 
 
 
 
       
	   
	   
	   
	  