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  

bseq.c File Reference

#include "mrilib.h"

Go to the source code of this file.


Data Structures

struct  SEQ

Defines

#define NMAX   48

Functions

SEQexpand_rle (char *str)
int main (int argc, char *argv[])

Variables

char * srle [NMAX+1]

Define Documentation

#define NMAX   48
 

Definition at line 3 of file bseq.c.


Function Documentation

SEQ* expand_rle char *    str
 

Definition at line 61 of file bseq.c.

References malloc, SEQ::num, and SEQ::ss.

Referenced by main().

00062 {
00063    SEQ * seq ;
00064    int * ss , ii , jj , vv ;
00065    char * cpt ;
00066 
00067    if( str == NULL ) return NULL ;
00068    for( ii=0,cpt=str ; *cpt != '\0' ; cpt++ )
00069       ii += (*cpt - '0') ;
00070 
00071    seq = (SEQ *) malloc( sizeof(SEQ) ) ;
00072    seq->ss = ss = (int *) malloc( sizeof(int) * ii ) ;
00073    seq->num = ii ;
00074 
00075    for( vv=1,ii=0,cpt=str ; *cpt != '\0' ; cpt++ ){
00076       jj = (*cpt - '0') ;
00077       for( jj=0 ; jj < (*cpt - '0') ; jj++ ) ss[ii++] = vv ;
00078       vv = -vv ;
00079    }
00080 
00081    return seq ;
00082 }

int main int    argc,
char *    argv[]
 

convert DTIStudio fiber format data to SUMA segment data

Definition at line 84 of file bseq.c.

References argc, expand_rle(), SEQ::num, srle, and SEQ::ss.

00085 {
00086    int ir , ii , num , sum , jj ;
00087    SEQ * seq ;
00088    int * ss ;
00089 
00090    if( argc < 2 || strcmp(argv[1],"-help") == 0 ) exit(0) ;
00091 
00092    ir = strtol( argv[1] , NULL , 10 ) ; if( ir < 3 ) exit(1) ;
00093 
00094    seq = expand_rle( srle[ir] ) ;
00095 
00096    printf("num = %d\n",seq->num) ;
00097    for( ii=0 ; ii < seq->num ; ii++ )
00098       printf(" %d",seq->ss[ii]) ;
00099    printf("\n") ;
00100 
00101    num = seq->num ; ss = seq->ss ;
00102    for( ii=0 ; ii < num-1 ; ii++ ){
00103       sum = 0 ;
00104       for( jj=0 ; jj < num-ii ; jj++ )
00105          sum += ss[jj] * ss[jj+ii] ;
00106       printf(" %d",sum) ;
00107    }
00108    printf("\n") ;
00109 
00110    exit(0) ;
00111 }

Variable Documentation

char* srle[NMAX+1] [static]
 

Definition at line 4 of file bseq.c.

Referenced by main().

 

Powered by Plone

This site conforms to the following standards: