1 
2 #define PROCESS_ROIS_SEPARATELY 0   // Applies to marching parabolas
3 #define BIG 10000000000.0
4 
5 #include "3ddata.h"
6 #include "distanceField.h"
7 
8 
9 typedef float flt;
10 
11 typedef enum METRIC_TYPE {
12          MARCHING_PARABOLAS,
13          EROSION
14  } METRIC_TYPE ;
15 
16 
17 int Cleanup(char *inputFileName, char *outputFileName, THD_3dim_dataset *din);
18 int afni_edt(THD_3dim_dataset * din, float *outImg, bool do_sqrt, bool edges_are_zero_for_nz, bool debugMode);
19 int erosion(THD_3dim_dataset * din, float *outImg);
20 int open_input_dset(THD_3dim_dataset ** din, char * fname);
21 int outputDistanceField(THD_3dim_dataset *dout, char *outputFileName);
22 int outputDistanceFieldDebug(float *outImg, THD_3dim_dataset *din, char *outputFileName);
23 void edt_local(float scale, flt * f, int n);
24 float sqr(float x);
25 static flt vx(flt * f, int p, int q);
26 bool sixConnectedAllHi(BYTE *buffer, int index, int nx, int ny, int nz);
27 int getIndex(int x, int y, int z, int nx, int ny, int nz);
28 ERROR_NUMBER getNonzeroIndices(int nvox, int *inputImg, int *numIndices, int **indices);
29 ERROR_NUMBER processIndex(int index, int *inputImg, float **outImg, THD_3dim_dataset *din);
30 int usage();
31 ERROR_NUMBER img3d_Euclidean_DT(int *im, int nx, int ny, int nz,
32                        bool do_sqrt, bool edges_are_zero_for_nz, float *ad3, float *odt);
33 ERROR_NUMBER run_EDTD_per_line(int *roi_line, float *dist2_line, int Na,
34                        float delta, bool edges_are_zero_for_nz);
35 float * Euclidean_DT_delta(float *f, int n, float delta);
36 ERROR_NUMBER  getDistanceFieldDataSet(THD_3dim_dataset *din, THD_3dim_dataset **dout, int metric,
37     bool do_sqrt, bool edges_are_zero_for_nz, bool debugMode);
38 ERROR_NUMBER getDistanceFields(char *inputFileName, char *outputFileName, int metric, bool do_sqrt,
39     bool edges_are_zero_for_nz, bool debugMode);
40 float sqr(float x);
41 
42 // Debugging variables
43 int debugNx, debugNy, debugNz;
44 float   debugScaleFactors[3], *debugOutImage;
45 
46