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  

arentest.c

Go to the documentation of this file.
00001 #include "aren.h"
00002 #include <stdlib.h>
00003 
00004 int main( int argc , char * argv[] )
00005 {
00006    THD_3dim_dataset * dset , * oset ;
00007    MRI_IMAGE * grim , * opim , * renim ;
00008    float theta , phi , sx,sy,sz ;
00009    void * arh ;
00010    char fname[128] ;
00011    int nopt ;
00012 
00013    dset = THD_open_dataset( argv[1] ) ;
00014    if( dset == NULL ) exit(1) ;
00015    DSET_load(dset) ; if( !DSET_LOADED(dset) ) exit(1) ;
00016    grim = DSET_BRICK(dset,0) ;
00017    sx = DSET_NX(dset) * DSET_DX(dset) ;
00018    sy = DSET_NY(dset) * DSET_DY(dset) ;
00019    sz = DSET_NZ(dset) * DSET_DZ(dset) ;
00020 
00021    oset = THD_open_dataset( argv[2] ) ;
00022    if( oset == NULL ) exit(1) ;
00023    DSET_load(oset) ; if( !DSET_LOADED(oset) ) exit(1) ;
00024    opim = DSET_BRICK(oset,0) ;
00025 
00026    { int nvox = DSET_NVOX(oset) , ii ;
00027      byte * opar = MRI_BYTE_PTR(opim) ;
00028      for( ii=0        ; ii < nvox/4 ; ii++ ) opar[ii] = 0 ;
00029      for( ii=3*nvox/4 ; ii < nvox   ; ii++ ) opar[ii] = 0 ;
00030    }
00031 
00032    arh = new_AREN_renderer() ; AREN_be_verbose(arh) ;
00033 
00034 #if 1
00035    AREN_set_graybrick( arh , grim ) ;
00036 #else
00037    AREN_set_rgbbricks( arh , grim,grim,grim ) ;
00038 #endif
00039 
00040    AREN_set_opabrick ( arh , opim ) ;
00041    AREN_set_size     ( arh , sx,sy,sz ) ;
00042 
00043 #if 0
00044    DSET_delete(dset) ; DSET_delete(oset) ;
00045 #endif
00046 
00047    for( nopt=3 ; nopt < argc-1 ; nopt+=2 ){
00048       theta = strtod( argv[nopt]   , NULL ) ;
00049       phi   = strtod( argv[nopt+1] , NULL ) ;
00050       AREN_set_viewpoint( arh , theta , phi ) ;
00051       renim = AREN_render( arh , 256 ) ;
00052       sprintf(fname,"aren.%03d.pnm",(nopt-1)/2) ;
00053       mri_write_pnm( fname , renim ) ;
00054       mri_free(renim) ;
00055    }
00056 
00057    exit(0) ;
00058 }
 

Powered by Plone

This site conforms to the following standards: