Doxygen Source Code Documentation
        
Main Page   Alphabetical List   Data Structures   File List   Data Fields   Globals   Search   
plug_ppm.c
Go to the documentation of this file.00001 
00002 
00003 
00004 
00005 
00006    
00007 #include "afni.h"
00008 
00009 #ifndef ALLOW_PLUGINS
00010 #  error "Plugins not properly set up -- see machdep.h"
00011 #endif
00012 
00013 
00014 
00015 char * IM_main( PLUGIN_interface * ) ;  
00016 
00017 
00018 
00019 static PLUGIN_interface * global_plint = NULL ;
00020 
00021 
00022 
00023 
00024 
00025 
00026 
00027 
00028 
00029 
00030 
00031 
00032 
00033 
00034 
00035 DEFINE_PLUGIN_PROTOTYPE
00036 
00037 PLUGIN_interface * PLUGIN_init( int ncall )
00038 {
00039    PLUGIN_interface * plint ;     
00040 
00041    if( ncall > 0 ) return NULL ;  
00042 
00043    plint = PLUTO_new_interface( "Images" ,
00044                                 "Images" ,
00045                                 NULL ,
00046                                 PLUGIN_CALL_VIA_MENU , IM_main  ) ;
00047 
00048    global_plint = plint ;  
00049 
00050    PLUTO_set_sequence( plint , "A:misc" ) ;
00051 
00052    PLUTO_add_option( plint ,
00053                      "Input" ,  
00054                      "Input" ,  
00055                      TRUE       
00056                    ) ;
00057 
00058    PLUTO_add_string( plint , "Filename" , 0 , NULL , 19 ) ;
00059 
00060    return plint ;
00061 }
00062 
00063 
00064 
00065 
00066 
00067 
00068 
00069 char * IM_main( PLUGIN_interface * plint )
00070 {
00071    char * str ;
00072    MRI_IMAGE * im ;
00073 
00074    PLUTO_next_option(plint) ;
00075 
00076    str  = PLUTO_get_string(plint) ;
00077    im   = mri_read_ppm(str) ;
00078    if( im == NULL ) return "Can't open\nimage file" ;
00079 
00080    (void) PLUTO_popup_image(NULL,im) ;
00081    mri_free(im) ;
00082    return NULL ;
00083 }