2
$\begingroup$

I've generated a Contourplot3D from a pde[t,x,y,z]. Now, i'm trying to project this contourplot over slices of images that move on the x, y and z axes.

What I want is that when moving the slices a sweep is made through ContourPlot3D and it is projected on the planes of the images in the three axes. Similar to SliceContourPlot3D but specifically on the slices of images.

The following is the code I did to move the slices in the three axes from an image dataset.

arc = "C:\\Users\\SKNT\\Documents\\MEGA\\Progra\\Mathematica\\Inputs\\\...
M4-Axi(skull-full)Stanford";
M4 = Import[arc, #] & /@ Import[arc];
(Image[#, ImageSize -> 32]) & /@ M4;

color = Reverse[
ParallelMap[
With[{img = #}, 
  ColorCombine[{Colorize[img, ColorFunction -> "SolarColors"], 
    Binarize[img]}, "RGB"]] &, M4]];

(Image[#, ImageSize -> 32]) & /@ color;

data = Developer`ToPackedArray[Map[ImageData, color]];

With[{vista = {5, 8, 7}},
Manipulate[
Graphics3D[{Opacity[Dynamic[o]], Texture[data], EdgeForm[], Dynamic[{

  With[{pts = 
     Table[{{x, 0, 0}, {x, 1, 0}, {x, 1, 1}, {x, 0, 1}}, {x, 0, 
       xx, step}]},
   Polygon[pts, VertexTextureCoordinates -> pts]],
  With[{pts = 
     Table[{{0, y, 0}, {1, y, 0}, {1, y, 1}, {0, y, 1}}, {y, 0, 
       yy, step}]},
   Polygon[pts, VertexTextureCoordinates -> pts]],

  With[{pts = 
     Table[{{0, 0, z}, {1, 0, z}, {1, 1, z}, {0, 1, z}}, {z, 0, 
       zz, step}]},
   Polygon[pts, VertexTextureCoordinates -> pts]],


  Polygon[{{x, 0, 0}, {x, 1, 0}, {x, 1, 1}, {x, 0, 1}}, 
   VertexTextureCoordinates -> {{x, 0, 0}, {x, 1, 0}, {x, 1, 
      1}, {x, 0, 1}}], 
  Polygon[{{0, y, 0}, {1, y, 0}, {1, y, 1}, {0, y, 1}}, 
   VertexTextureCoordinates -> {{0, y, 0}, {1, y, 0}, {1, y, 
      1}, {0, y, 1}}], 
  Polygon[{{0, 0, z}, {1, 0, z}, {1, 1, z}, {0, 1, z}}, 
   VertexTextureCoordinates -> {{0, 0, z}, {1, 0, z}, {1, 1, 
      z}, {0, 1, z}}]}]},
      Background -> Black, RotationAction -> "Clip", 
  ViewPoint -> vista],
       {{x, 0.5}, 0, 1}, {{y, 0.5}, 0, 1}, {{z, 0.5}, 0, 
  1}, {{o, 0.75, "Opacidad"}, 0, 1}, {{xx, 0, "X"}, .0, 
  1}, {{yy, 0, "Y"}, .0, 1}, {{zz, 0, "Z"}, .0, 
  1}, {{step, 0.05, "Paso"}, .005, 0.09}]]

This input code generate the output:

Slices of images

The contour plot 3D is this

enter image description here

By the way, the ContourPlot3D evolves over time.

I hope you can help me with some suggestions. I'll be very greatful

P.S. I forgot it!... The dataset of images can be downloaded from: https://graphics.stanford.edu/data/voldata/cthead-8bit.tar.gz

Update 1:

This is a bad attempt to combine SlicesContourPlot3D with slices of head (images). Both slices move independently and the contours of contourplot3D are not projected on the planes of the images or slices of head.

enter image description here

$\endgroup$

1 Answer 1

1
$\begingroup$

It's hard to test without knowing explicitly what goes into ContourPlot3D, but here's my take on it.

We can plot with SliceContourPlot3D and "X(Y)(Z)StackedPlanes" choices that vary with the Manipulate. Since I don't know what to plot, I'll use a placeholder expression with a custom RegionFunction setting.

With[{vista = {5, 8, 7}},
Manipulate[
Show[
Graphics3D[{Opacity[Dynamic[o]], Texture[data], EdgeForm[], Dynamic[{

  With[{pts = 
     Table[{{x, 0, 0}, {x, 1, 0}, {x, 1, 1}, {x, 0, 1}}, {x, 0, 
       xx, step}]},
   Polygon[pts, VertexTextureCoordinates -> pts]],
  With[{pts = 
     Table[{{0, y, 0}, {1, y, 0}, {1, y, 1}, {0, y, 1}}, {y, 0, 
       yy, step}]},
   Polygon[pts, VertexTextureCoordinates -> pts]],

  With[{pts = 
     Table[{{0, 0, z}, {1, 0, z}, {1, 1, z}, {0, 1, z}}, {z, 0, 
       zz, step}]},
   Polygon[pts, VertexTextureCoordinates -> pts]],


  Polygon[{{x, 0, 0}, {x, 1, 0}, {x, 1, 1}, {x, 0, 1}}, 
   VertexTextureCoordinates -> {{x, 0, 0}, {x, 1, 0}, {x, 1, 
      1}, {x, 0, 1}}], 
  Polygon[{{0, y, 0}, {1, y, 0}, {1, y, 1}, {0, y, 1}}, 
   VertexTextureCoordinates -> {{0, y, 0}, {1, y, 0}, {1, y, 
      1}, {0, y, 1}}], 
  Polygon[{{0, 0, z}, {1, 0, z}, {1, 1, z}, {0, 1, z}}, 
   VertexTextureCoordinates -> {{0, 0, z}, {1, 0, z}, {1, 1, 
      z}, {0, 1, z}}]}]},
      Background -> Black, RotationAction -> "Clip", 
  ViewPoint -> vista],
  SliceContourPlot3D[Sin[a] + b^2 - c^3, 
   {{"XStackedPlanes", {x}}, {"YStackedPlanes", {y}}, {"ZStackedPlanes", {z}}}, 
   {a, 0, 1}, {b, 0, 1}, {c, 0, 1}, 
   RegionFunction -> Function[{a, b, c, f}, 0 < f < .5], 
   Contours -> Subdivide[0, .5, 10], PlotTheme -> "CoolColor", 
   PerformanceGoal -> ControlActive["Speed", "Quality"]]
  ],
       {{x, 0.5}, 0, 1}, {{y, 0.5}, 0, 1}, {{z, 0.5}, 0, 
  1}, {{o, 0.75, "Opacidad"}, 0, 1}, {{xx, 0, "X"}, .0, 
  1}, {{yy, 0, "Y"}, .0, 1}, {{zz, 0, "Z"}, .0, 
  1}, {{step, 0.05, "Paso"}, .005, 0.09}]]

enter image description here

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.