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  

nidset.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 nidset.c.

References argc, DSET_load, DSET_LOADED, NI_BINARY_MODE, NI_clock_time(), NI_stream_close(), NI_stream_open(), NI_stream_writecheck(), NI_write_element(), THD_dataset_to_niml(), and THD_open_dataset().

00004 {
00005    THD_3dim_dataset *dset ;
00006    NI_group *ngr ;
00007    NI_stream ns ;
00008    int ct , ii ;
00009 
00010    if( argc < 3 || strcmp(argv[1],"-help") == 0 ){
00011      printf("Usage: nidset tcp:host:53212 dataset\n"); exit(0);
00012    }
00013 
00014    ns = NI_stream_open( argv[1] , "w" ) ;
00015    if( ns == NULL ){
00016      fprintf(stderr,"** Can't open stream '%s'\n",argv[1]); exit(1);
00017    }
00018 
00019    dset = THD_open_dataset( argv[2] ) ;
00020    if( dset == NULL ){
00021      fprintf(stderr,"** Can't open dataset '%s'\n",argv[2]); exit(1);
00022    }
00023    DSET_load(dset) ;
00024    if( !DSET_LOADED(dset) ){
00025      fprintf(stderr,"** Can't load dataset '%s'\n",argv[2]); exit(1);
00026    }
00027    ngr = THD_dataset_to_niml(dset) ;
00028    if( ngr == NULL ){
00029      fprintf(stderr,"** Can't convert dataset to NIML\n"); exit(1);
00030    }
00031 
00032    while(1){
00033      ii = NI_stream_writecheck( ns , 666 ) ;
00034      if( ii == 1 ){ fprintf(stderr,"!READY!\n") ; break ; }
00035      if( ii <  0 ){ fprintf(stderr,"BAD writecheck\n"); exit(1); }
00036      fprintf(stderr,".") ;
00037    }
00038 
00039    ct = NI_clock_time() ;
00040    NI_write_element( ns , ngr , NI_BINARY_MODE ) ;
00041    NI_stream_close( ns ) ;
00042    ct = NI_clock_time() - ct ;
00043    fprintf(stderr,"++ Wrote element in %d ms\n",ct) ;
00044    exit(0) ;
00045 }
 

Powered by Plone

This site conforms to the following standards: