Home My Page Projects Code Snippets Project Openings diderot
Summary Activity Tracker Tasks SCM

SCM Repository

[diderot] View of /branches/charisee/ertest/vispaper/iso3d/cniso3d.diderot
ViewVC logotype

View of /branches/charisee/ertest/vispaper/iso3d/cniso3d.diderot

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2964 - (download) (annotate)
Thu Mar 5 18:06:54 2015 UTC (4 years, 4 months ago) by glk
File size: 1480 byte(s)
fixing missing nrrd file
/*

../../../bin/diderotc cniso3d.diderot \
&& ./cniso3d \
&& unu crop -i cniso3d.txt -min 0 0 -max 1 M | \
   unu jhisto -b 600 600 -min -1.2 -1.2 -max 1.2 1.2 -t float | \
   unu 1op log1p | \
   unu quantize -b 8 -o cniso3d.png \
&& open cniso3d.png

*/

field#4(3)[] V= c4hexic ⊛ load("canny.nrrd");
//field#3(3)[3] G = ∇V;
field#2(3)[3] G = ∇V;
field#2(3)[3,3] H = ∇⊗∇V;
field#2(3)[] F = G•H•G/|G|;

input int grid = 30;
int stepsMax = 10;
real epsilon = 0.0001;

strand RootFind(real xi,real xj, real xk) {
   output vec3 x = [xi,xj,xk];
   int steps = 0;
   update {
      // Stop if we're no longer inside or taken too many steps.
      if (!inside(x, V) || steps > stepsMax)
         die;
      // subsequent expressions are undefined if |∇F| is zero
      if (|∇F(x)| == 0.0)
         die;
      // ALSO, for canny, bail if gradient magnitude is too low
      if (|∇V(x)| < 4)
         die;
      // the Newton-Raphson step
      vec3 delta = normalize(∇F(x)) * F(x)/|∇F(x)|;
      // we've converged if the change is small enough
      if (|delta| < epsilon)
         stabilize;
      print( xi, ",", xj, ",", xk, ": ", x, " -= ", delta, "(step ", steps, ")\n");
      x -= delta;
      steps += 1;
   }
}

initially { RootFind(lerp(-2, 2, -0.5, ui, grid-0.5),
                     lerp(-2, 2, -0.5, vi, grid-0.5),
                     lerp(-2, 2, -0.5, wi, grid-0.5))
            | wi in 0..(grid-1), vi in 0..(grid-1), ui in 0..(grid-1) };

root@smlnj-gforge.cs.uchicago.edu
ViewVC Help
Powered by ViewVC 1.0.0