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 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[]
 

\** File : SUMA.c

Author:
: Ziad Saad Date : Thu Dec 27 16:21:01 EST 2001
Purpose :

Input paramters :

Parameters:
param  Usage : SUMA ( )
Returns :
Returns:
Support :
See also:
OpenGL prog. Guide 3rd edition , varray.c from book's sample code
Side effects :

Definition at line 3 of file slider.c.

References argc, mri_new(), mri_read_ppm(), MRI_RGB_PTR, mri_write_pnm(), MRI_IMAGE::nx, and MRI_IMAGE::ny.

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: