/************************************************************************/ /* */ /* Program: median.c */ /* Purpose: to perform a 3x3x3 or 5x5x5 median filter on a */ /* 3-D segmented image volume */ /* Programmer: Dale P. Bentz */ /* National Institute of Standards and Technology */ /* 100 Bureau Drive Stop 8621 */ /* Gaithersburg, MD 20899-8621 */ /* Phone: (301) 975-5865 */ /* Fax: (301) 990-6891 */ /* E-mail: dale.bentz@nist.gov */ /* */ /* Date: 2001 */ /* */ /************************************************************************/ #include #include #include #define XSIZE 300 #define YSIZE 300 #define ZSIZE 300 /* Global image array */ static short int image [XSIZE] [YSIZE] [ZSIZE]; short int findmed(ix,iy,iz,imedsize) int ix,iy,iz,imedsize; { short int temp,valback,values[126]; int numtot,itrue,jtrue,id,jd,kd,idx,idy,idz; int numhalf,i,j; /* First store all of the values in the cubic box */ numtot=0; for(id=-imedsize;id<=imedsize;id++){ idx=ix+id; if((idx>=0)&&(idx=0)&&(idy=0)&&(idz