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_clustarr.c File Reference

#include "mrilib.h"

Go to the source code of this file.


Functions

void EDIT_cluster_array (MCW_cluster_array *clar, int edit_clust, float dxyz, float vmul)

Function Documentation

void EDIT_cluster_array MCW_cluster_array   clar,
int    edit_clust,
float    dxyz,
float    vmul
 

Definition at line 25 of file edt_clustarr.c.

References amax, MCW_cluster_array::clar, ECFLAG_AMAX, ECFLAG_MAX, ECFLAG_MEAN, ECFLAG_ORDER, ECFLAG_SIZE, ECFLAG_SMAX, ENTRY, MCW_cluster::mag, MCW_cluster_array::num_clu, MCW_cluster::num_pt, and SORT_CLARR.

Referenced by EDIT_one_dataset().

00027 {
00028    int iclu;       /* cluster index */
00029    int nclu;       /* non-empty cluster index */
00030    int ii;         /* voxel index */
00031    float
00032       mag,         /* voxel intensity */
00033       sum,         /* sum of voxel intensities */
00034       max,         /* maximum of voxel intensities */
00035       amax,        /* maximum of absolute voxel intensities */
00036       smax,        /* signed maximum of absolute voxel intensities */
00037       mean,        /* mean of voxel intensities */
00038       size;        /* size of cluster (multiples of vmul) */
00039 
00040 ENTRY("EDIT_cluster_array") ;
00041 
00042    if( edit_clust == ECFLAG_ORDER ){
00043       SORT_CLARR(clar) ;
00044    }
00045 
00046    nclu = 0;
00047    for (iclu = 0; iclu < clar->num_clu; iclu++)
00048    {
00049       if ((clar->clar[iclu] != NULL) && (clar->clar[iclu]->num_pt > 0))
00050       {
00051          nclu++;
00052 
00053          /* initialization of basic statistics for this cluster */
00054          sum = max = smax = clar->clar[iclu]->mag[0];
00055          amax = fabs(smax);
00056 
00057          /* calculate basic statistics for this cluster */
00058          for (ii = 1; ii < clar->clar[iclu]->num_pt; ii++)
00059          {
00060             mag = clar->clar[iclu]->mag[ii];
00061             switch (edit_clust)
00062             {
00063                case ECFLAG_MEAN :
00064                   sum += mag;  break;
00065                case ECFLAG_MAX  :
00066                   if (mag > max)  max = mag;   break;
00067                case ECFLAG_AMAX :
00068                   if (fabs(mag) > amax)  amax = fabs(mag);  break;
00069                case ECFLAG_SMAX :
00070                   if (fabs(mag) > fabs(smax))  smax = mag;  break;
00071                case ECFLAG_SIZE : break;
00072                default          : break;
00073             }
00074 
00075          }
00076 
00077          /* additional calculations */
00078          if (edit_clust == ECFLAG_MEAN)
00079             mean = sum / clar->clar[iclu]->num_pt;
00080          if (edit_clust == ECFLAG_SIZE)
00081             size = clar->clar[iclu]->num_pt * dxyz / vmul;
00082 
00083          /* set all voxel intensities in this cluster to the same value */
00084          for (ii = 0; ii < clar->clar[iclu]->num_pt; ii++)
00085          {
00086             switch (edit_clust)
00087             {
00088                case ECFLAG_MEAN :  clar->clar[iclu]->mag[ii] = mean;
00089                case ECFLAG_MAX  :  clar->clar[iclu]->mag[ii] = max;   break;
00090                case ECFLAG_AMAX :  clar->clar[iclu]->mag[ii] = amax;  break;
00091                case ECFLAG_SMAX :  clar->clar[iclu]->mag[ii] = smax;  break;
00092                case ECFLAG_SIZE :  clar->clar[iclu]->mag[ii] = size;  break;
00093                case ECFLAG_ORDER:  clar->clar[iclu]->mag[ii] = nclu;  break;
00094                default          :                                     break;
00095             }
00096          }
00097       }
00098    }  /* iclu */
00099 
00100    EXRETURN ;
00101 }
 

Powered by Plone

This site conforms to the following standards: