From: <kin...@us...> - 2011-06-28 23:08:42
|
Revision: 4893 http://teem.svn.sourceforge.net/teem/?rev=4893&view=rev Author: kindlmann Date: 2011-06-28 23:08:36 +0000 (Tue, 28 Jun 2011) Log Message: ----------- added nrrdTernaryOpLTSmooth and nrrdTernaryOpGTSmooth, smoothed (via erf) versions of nrrdBinaryOpLT and nrrdBinaryOpGT Modified Paths: -------------- teem/trunk/src/nrrd/arith.c teem/trunk/src/nrrd/enumsNrrd.c teem/trunk/src/nrrd/nrrdEnums.h Modified: teem/trunk/src/nrrd/arith.c =================================================================== --- teem/trunk/src/nrrd/arith.c 2011-06-28 23:07:05 UTC (rev 4892) +++ teem/trunk/src/nrrd/arith.c 2011-06-28 23:08:36 UTC (rev 4893) @@ -511,6 +511,12 @@ : airErf((x-tran)*0.886226925452758/(min - tran))*(min - tran) + tran) : AIR_MAX(x, min)); /* transition in wrong place; revert to simple max() */ } +static double _nrrdTernaryOpLTSmooth(double a, double w, double b) { + return AIR_AFFINE(-1.0, airErf((b-a)/w), 1.0, 0.0, 1.0); +} +static double _nrrdTernaryOpGTSmooth(double a, double w, double b) { + return AIR_AFFINE(-1.0, airErf((a-b)/w), 1.0, 0.0, 1.0); +} static double _nrrdTernaryOpClamp(double a, double b, double c) { return AIR_CLAMP(a, b, c); } @@ -554,6 +560,8 @@ _nrrdTernaryOpMinSmooth, _nrrdTernaryOpMax, _nrrdTernaryOpMaxSmooth, + _nrrdTernaryOpLTSmooth, + _nrrdTernaryOpGTSmooth, _nrrdTernaryOpClamp, _nrrdTernaryOpIfElse, _nrrdTernaryOpLerp, Modified: teem/trunk/src/nrrd/enumsNrrd.c =================================================================== --- teem/trunk/src/nrrd/enumsNrrd.c 2011-06-28 23:07:05 UTC (rev 4892) +++ teem/trunk/src/nrrd/enumsNrrd.c 2011-06-28 23:08:36 UTC (rev 4893) @@ -1301,8 +1301,11 @@ "add", "multiply", "min", - "min_smooth", + "min_sm", "max", + "max_sm", + "lt_sm", + "gt_sm", "clamp", "ifelse", "lerp", @@ -1322,6 +1325,8 @@ "smooth minimum of 1st and 3rd value, starting at 2nd", "maximum of three values", "smooth maximum of 1st and 3rd value, starting at 2nd", + "1st less than 3rd, smoothed by 2nd", + "1st greater than 3rd, smoothed by 2nd", "clamp 2nd value to closed interval between 1st and 3rd", "if 1st value is non-zero, then 2nd value, else 3rd value", "linearly interpolate between 2nd value (1st = 0.0) and 3rd (1st = 1.0)", @@ -1343,6 +1348,8 @@ "min_sm", "minsm", /* HEY want to deprecate minsm */ "max", "max_sm", + "lt_sm", + "gt_sm", "clamp", "ifelse", "if", "lerp", @@ -1362,6 +1369,8 @@ nrrdTernaryOpMinSmooth, nrrdTernaryOpMinSmooth, nrrdTernaryOpMax, nrrdTernaryOpMaxSmooth, + nrrdTernaryOpLTSmooth, + nrrdTernaryOpGTSmooth, nrrdTernaryOpClamp, nrrdTernaryOpIfElse, nrrdTernaryOpIfElse, nrrdTernaryOpLerp, Modified: teem/trunk/src/nrrd/nrrdEnums.h =================================================================== --- teem/trunk/src/nrrd/nrrdEnums.h 2011-06-28 23:07:05 UTC (rev 4892) +++ teem/trunk/src/nrrd/nrrdEnums.h 2011-06-28 23:08:36 UTC (rev 4893) @@ -685,17 +685,19 @@ nrrdTernaryOpMinSmooth, /* 4 */ nrrdTernaryOpMax, /* 5 */ nrrdTernaryOpMaxSmooth, /* 6 */ - nrrdTernaryOpClamp, /* 7 */ - nrrdTernaryOpIfElse, /* 8 */ - nrrdTernaryOpLerp, /* 9 */ - nrrdTernaryOpExists, /* 10 */ - nrrdTernaryOpInOpen, /* 11 */ - nrrdTernaryOpInClosed, /* 12 */ - nrrdTernaryOpGaussian, /* 13 */ - nrrdTernaryOpRician, /* 14 */ + nrrdTernaryOpLTSmooth, /* 7 */ + nrrdTernaryOpGTSmooth, /* 8 */ + nrrdTernaryOpClamp, /* 9 */ + nrrdTernaryOpIfElse, /* 10 */ + nrrdTernaryOpLerp, /* 11 */ + nrrdTernaryOpExists, /* 12 */ + nrrdTernaryOpInOpen, /* 13 */ + nrrdTernaryOpInClosed, /* 14 */ + nrrdTernaryOpGaussian, /* 15 */ + nrrdTernaryOpRician, /* 16 */ nrrdTernaryOpLast }; -#define NRRD_TERNARY_OP_MAX 14 +#define NRRD_TERNARY_OP_MAX 16 /* ******** nrrdFFTWPlanRigor This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |