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  

slider.c

Go to the documentation of this file.
00001 #include "mrilib.h"
00002 
00003 int main( int argc , char * argv[] )
00004 {
00005    MRI_IMAGE * inim , * outim ;
00006    byte      * inby , * outby ;
00007    int ii , nx,ny , npix ;
00008    byte rr,gg,bb ;
00009 
00010    if( argc < 3 ){
00011       printf("Usage: slider infile.ppm outfile.ppm\n") ;
00012       exit(0) ;
00013    }
00014 
00015    inim = mri_read_ppm( argv[1] ) ;
00016    if( inim == NULL ){
00017       fprintf(stderr,"Cannot read input file!\n") ;
00018       exit(1) ;
00019    }
00020 
00021    inby = MRI_RGB_PTR(inim) ;
00022    nx   = inim->nx ; ny = inim->ny ; npix = nx * ny ;
00023 
00024    outim = mri_new( nx , ny , MRI_rgb ) ;
00025    outby = MRI_RGB_PTR(outim) ;
00026 
00027    for( ii=0 ; ii < 3*npix ; ii+=3 ){
00028 
00029       rr = inby[ii] ; gg = inby[ii+1] ; bb = inby[ii+2] ;
00030 
00031       if( rr==255 && gg==255 && bb==255 ){
00032          rr = 0 ; gg = 0 ; bb = 111 ;
00033       } else if( rr==143 && gg==143 && bb > 200 ){
00034          rr = 255 ; gg = 255 ; bb = 0 ;
00035       }
00036 
00037       outby[ii] = rr ; outby[ii+1] = gg ; outby[ii+2] = bb ;
00038    }
00039 
00040    mri_write_pnm( argv[2] , outim ) ;
00041    exit(0) ;
00042 }
 

Powered by Plone

This site conforms to the following standards: