Skip to content
Snippets Groups Projects
Commit 578e455f authored by Stephen Smith's avatar Stephen Smith
Browse files

*** empty log message ***

parent bbf552d4
No related branches found
No related tags found
No related merge requests found
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
Stephen Smith, FMRIB Image Analysis Group Stephen Smith, FMRIB Image Analysis Group
Copyright (C) 1999-2004 University of Oxford */ Copyright (C) 1999-2005 University of Oxford */
/* CCOPYRIGHT */ /* CCOPYRIGHT */
...@@ -48,6 +48,7 @@ void usage(void) ...@@ -48,6 +48,7 @@ void usage(void)
printf("-ero : use (current image>0) to erode using 3x3x3 neighourhood\n"); printf("-ero : use (current image>0) to erode using 3x3x3 neighourhood\n");
printf("-ero2 : use (current image>0) to erode using 3x3 (2D) neighourhood\n"); printf("-ero2 : use (current image>0) to erode using 3x3 (2D) neighourhood\n");
printf("-edge : edge strength\n"); printf("-edge : edge strength\n");
printf("-nms : 3D non-maximum suppression wrt immediate 3x3x3 neighbourhood\n");
printf("-nan : replace NaNs (improper numbers) with 0\n"); printf("-nan : replace NaNs (improper numbers) with 0\n");
printf("-nanm : make NaN (improper number) mask with 1 for NaN voxels, 0 otherwise\n"); printf("-nanm : make NaN (improper number) mask with 1 for NaN voxels, 0 otherwise\n");
printf("-roi <xmin> <xsize> <ymin> <ysize> <zmin> <zsize> <tmin> <tsize> : zero outside roi\n"); printf("-roi <xmin> <xsize> <ymin> <ysize> <zmin> <zsize> <tmin> <tsize> : zero outside roi\n");
...@@ -598,6 +599,47 @@ double tmpd; ...@@ -598,6 +599,47 @@ double tmpd;
in[0]=tmpim; in[0]=tmpim;
} }
/* }}} */
else if (!strncmp(argv[i], "-nms", 4))
/* {{{ nms */
{
int MAXZ=1;
float tmpf=2 * sqrt(1/(im.xv*im.xv) + 1/(im.yv*im.yv) + 1/(im.zv*im.zv));
FDT *tmpim=calloc(size,sizeof(FDT));
if (im.z<3)
MAXZ=0;
for(t=0;t<im.t;t++) for(z=MAXZ;z<im.z-MAXZ;z++) for(y=1;y<im.y-1;y++) for(x=1;x<im.x-1;x++)
{
double cost, mincost=1e10;
int xx, yy, zz, xxx, yyy, zzz;
for(zz=0; zz<=MAXZ; zz++)
for(yy=-1; yy<=1; yy++)
for(xx=-1; xx<=1; xx++)
if ( (zz==1) || (yy==1) || ((yy==0)&&(xx==1)) )
{
cost = in[0][t*xyzsize+(z+zz)*xysize+(y+yy)*im.x+x+xx] + in[0][t*xyzsize+(z-zz)*xysize+(y-yy)*im.x+x-xx];
if (cost<mincost)
{
mincost=cost;
xxx=xx;
yyy=yy;
zzz=zz;
}
}
if ( ( in[0][t*xyzsize+z*xysize+y*im.x+x] >= in[0][t*xyzsize+(z+zzz)*xysize+(y+yyy)*im.x+x+xxx] ) &&
( in[0][t*xyzsize+z*xysize+y*im.x+x] > in[0][t*xyzsize+(z-zzz)*xysize+(y-yyy)*im.x+x-xxx] ) )
tmpim[t*xyzsize+z*xysize+y*im.x+x] = in[0][t*xyzsize+z*xysize+y*im.x+x];
}
free(in[0]);
in[0]=tmpim;
}
/* }}} */ /* }}} */
else if (!strncmp(argv[i], "-nanm", 5)) else if (!strncmp(argv[i], "-nanm", 5))
/* {{{ NaN mask */ /* {{{ NaN mask */
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment