Corrected expressions for c1 in run2D,run2DC,run3D, and run3DC.
authorilb@NIH.GOV <ilb@NIH.GOV@ba61647d-9d00-f842-95cd-605cb4296b96>
Wed, 21 Feb 2018 21:55:41 +0000 (21:55 +0000)
committerilb@NIH.GOV <ilb@NIH.GOV@ba61647d-9d00-f842-95cd-605cb4296b96>
Wed, 21 Feb 2018 21:55:41 +0000 (21:55 +0000)
git-svn-id: https://citdcbmipav.cit.nih.gov/repos-pub/mipav/trunk@15385 ba61647d-9d00-f842-95cd-605cb4296b96

mipav/src/gov/nih/mipav/model/algorithms/filters/AlgorithmCoherenceEnhancingDiffusion.java

index a9cb96d..2ebe810 100644 (file)
@@ -1011,7 +1011,12 @@ public class AlgorithmCoherenceEnhancingDiffusion extends AlgorithmBase {
 \r
                             exponent = ((lambdaOne - lambdaTwo) * (lambdaOne - lambdaTwo) / (float) k2);\r
 \r
-                            c1 = max(0.01f, (float) (1.0 - Math.exp(-exponent)));\r
+                            if (exponent == 0.0f) {\r
+                               c1 = 0.0f;\r
+                            }\r
+                            else {\r
+                               c1 = (float)(0.01 + (1 - 0.01)*Math.exp(-1.0/exponent));\r
+                            }\r
 \r
                             d11[idx] = 0.5f * (c1 + c2 + ((c2 - c1) * (s11[idx] - s22[idx]) / (alpha + epsilon)));\r
                             d12[idx] = (c2 - c1) * s12[idx] / (alpha + epsilon);\r
@@ -1380,7 +1385,12 @@ public class AlgorithmCoherenceEnhancingDiffusion extends AlgorithmBase {
 \r
                             exponent = ((lambdaOne - lambdaTwo) * (lambdaOne - lambdaTwo) / (float) k2);\r
 \r
-                            c1 = max(0.01f, (float) (1.0 - Math.exp(-exponent)));\r
+                            if (exponent == 0.0f) {\r
+                               c1 = 0.0f;\r
+                            }\r
+                            else {\r
+                               c1 = (float)(0.01 + (1 - 0.01)*Math.exp(-1.0/exponent));\r
+                            }\r
 \r
                             d11[idx] = 0.5f * (c1 + c2 + ((c2 - c1) * (s11[idx] - s22[idx]) / (alpha + epsilon)));\r
 \r
@@ -1762,7 +1772,12 @@ public class AlgorithmCoherenceEnhancingDiffusion extends AlgorithmBase {
                                          ((lambdaOne - lambdaThree) * (lambdaOne - lambdaThree)) +\r
                                          ((lambdaTwo - lambdaThree) * (lambdaTwo - lambdaThree))) / (float) k2);\r
 \r
-                            c1 = max(0.01f, (float) (1.0 - Math.exp(-exponent)));\r
+                            if (exponent == 0.0f) {\r
+                               c1 = 0.0f;\r
+                            }\r
+                            else {\r
+                               c1 = (float)(0.01 + (1 - 0.01)*Math.exp(-1.0/exponent));\r
+                            }\r
                             cArray[0][0] = c1;\r
                             cArray[1][1] = c2;\r
                             cArray[2][2] = c3;\r
@@ -2328,7 +2343,12 @@ public class AlgorithmCoherenceEnhancingDiffusion extends AlgorithmBase {
                                          ((lambdaOne - lambdaThree) * (lambdaOne - lambdaThree)) +\r
                                          ((lambdaTwo - lambdaThree) * (lambdaTwo - lambdaThree))) / (float) k2);\r
 \r
-                            c1 = max(0.01f, (float) (1.0 - Math.exp(-exponent)));\r
+                            if (exponent == 0.0f) {\r
+                               c1 = 0.0f;\r
+                            }\r
+                            else {\r
+                               c1 = (float)(0.01 + (1 - 0.01)*Math.exp(-1.0/exponent));\r
+                            }\r
                             cArray[0][0] = c1;\r
                             cArray[1][1] = c2;\r
                             cArray[2][2] = c3;\r