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  

edt_sortmask.c File Reference

#include "mrilib.h"

Go to the source code of this file.


Data Structures

struct  short3

Functions

void MCW_sort_cluster (MCW_cluster *cl)

Function Documentation

void MCW_sort_cluster MCW_cluster   cl
 

Definition at line 9 of file edt_sortmask.c.

References ENTRY, free, MCW_cluster::i, short3::i, MCW_cluster::j, short3::j, MCW_cluster::k, short3::k, MCW_cluster::mag, malloc, MCW_cluster::num_pt, and qsort_floatstuff().

Referenced by TT_whereami().

00010 {
00011    int nn , ii ;
00012    float *aa ;
00013    short3 ** ss ;
00014 
00015 ENTRY("MCW_sort_cluster") ;
00016 
00017    if( cl == NULL || cl->num_pt < 2 ) EXRETURN ;
00018 
00019    nn = cl->num_pt ;
00020    aa = (float *  ) malloc(sizeof(float)   *nn) ;
00021    ss = (short3 **) malloc(sizeof(short3 *)*nn) ;
00022    for( ii=0 ; ii < nn ; ii++ ){
00023       aa[ii] = cl->mag[ii] ;
00024       ss[ii] = (short3 *) malloc(sizeof(short3)) ;
00025       ss[ii]->i = cl->i[ii] ;
00026       ss[ii]->j = cl->j[ii] ;
00027       ss[ii]->k = cl->k[ii] ;
00028    }
00029 
00030    qsort_floatstuff( nn , aa , (void **) ss ) ;
00031 
00032    for( ii=0 ; ii < nn ; ii++ ){
00033       cl->mag[ii] = aa[ii] ;
00034       cl->i[ii] = ss[ii]->i ;
00035       cl->j[ii] = ss[ii]->j ;
00036       cl->k[ii] = ss[ii]->k ;
00037       free(ss[ii]) ;
00038    }
00039 
00040    free(ss) ; free(aa) ; EXRETURN ;
00041 }
 

Powered by Plone

This site conforms to the following standards: