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  

plug_ppm.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 "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 * ) ;  /* the entry point */
00016 
00017 /*---------------------------- global data ---------------------------*/
00018 
00019 static PLUGIN_interface * global_plint = NULL ;
00020 
00021 /***********************************************************************
00022    Set up the interface to the user:
00023     1) Create a new interface using "PLUTO_new_interface";
00024 
00025     2) For each line of inputs, create the line with "PLUTO_add_option"
00026          (this line of inputs can be optional or mandatory);
00027 
00028     3) For each item on the line, create the item with
00029         "PLUTO_add_dataset" for a dataset chooser,
00030         "PLUTO_add_string"  for a string chooser,
00031         "PLUTO_add_number"  for a number chooser.
00032 ************************************************************************/
00033 
00034 
00035 DEFINE_PLUGIN_PROTOTYPE
00036 
00037 PLUGIN_interface * PLUGIN_init( int ncall )
00038 {
00039    PLUGIN_interface * plint ;     /* will be the output of this routine */
00040 
00041    if( ncall > 0 ) return NULL ;  /* only one interface */
00042 
00043    plint = PLUTO_new_interface( "Images" ,
00044                                 "Images" ,
00045                                 NULL ,
00046                                 PLUGIN_CALL_VIA_MENU , IM_main  ) ;
00047 
00048    global_plint = plint ;  /* make global copy */
00049 
00050    PLUTO_set_sequence( plint , "A:misc" ) ;
00051 
00052    PLUTO_add_option( plint ,
00053                      "Input" ,  /* label at left of input line */
00054                      "Input" ,  /* tag to return to plugin */
00055                      TRUE       /* is this mandatory? */
00056                    ) ;
00057 
00058    PLUTO_add_string( plint , "Filename" , 0 , NULL , 19 ) ;
00059 
00060    return plint ;
00061 }
00062 
00063 /***************************************************************************
00064   Main routine for this plugin (will be called from AFNI).
00065   If the return string is not NULL, some error transpired, and
00066   AFNI will popup the return string in a message box.
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 }
 

Powered by Plone

This site conforms to the following standards: