Skip to main content
added 153 characters in body
Source Link
s0rce
  • 9.7k
  • 4
  • 47
  • 79

Here is my extremely slow volume rendering solution. It is based on placing a Cuboid[] for each voxel of the data.

I switched from MapThread to ParallelMap as for some reason MapThread cannot be parallelized.

slices = Import["https://dl.dropbox.com/u/3730003/slicedata.wdx"]
data = Developer`ToPackedArray[Map[ImageData, slices]];

(*downsampling slices*)
resized = ImageResize[#, 64] & /@ slices;
data = Developer`ToPackedArray[Map[ImageData, resized]];

(*3D*)
dims = Dimensions@data;
coordswithdata = Table[{data[[x, y, z]], {x, y, z}}, {x, 1, dims[[1]]}, {y, 1, dims[[2]]}, {z, 1, dims[[3]]}];
cubes = {Hue @@ #1, EdgeForm[], Cuboid@#2} &
output = ParallelMap[cubes @@ # &, coordswithdata, {3}];
Graphics3D@output

still rendering... When I tried to rotate the view Mathematica crashed so here is an ugly screenshot, but it works (sort of)!

screenshot

(*2D*)
dims = Dimensions@data[[45]];
coordswithdata = Table[{data[[45, x, y]], {x, y, 1}}, {x, 1, dims[[1]]}, {y, 1, dims[[2]]}];
cubes = {Hue @@ #1, EdgeForm[], Cuboid@#2} &
output = ParallelMap[cubes, coordswithdata, {2}];
Graphics3D@output

"Mathematica graphic"

Here is my extremely slow volume rendering solution. It is based on placing a Cuboid[] for each voxel of the data.

I switched from MapThread to ParallelMap as for some reason MapThread cannot be parallelized.

slices = Import["https://dl.dropbox.com/u/3730003/slicedata.wdx"]
data = Developer`ToPackedArray[Map[ImageData, slices]];

(*downsampling slices*)
resized = ImageResize[#, 64] & /@ slices;
data = Developer`ToPackedArray[Map[ImageData, resized]];

(*3D*)
dims = Dimensions@data;
coordswithdata = Table[{data[[x, y, z]], {x, y, z}}, {x, 1, dims[[1]]}, {y, 1, dims[[2]]}, {z, 1, dims[[3]]}];
cubes = {Hue @@ #1, EdgeForm[], Cuboid@#2} &
output = ParallelMap[cubes @@ # &, coordswithdata, {3}];
Graphics3D@output

still rendering...

(*2D*)
dims = Dimensions@data[[45]];
coordswithdata = Table[{data[[45, x, y]], {x, y, 1}}, {x, 1, dims[[1]]}, {y, 1, dims[[2]]}];
cubes = {Hue @@ #1, EdgeForm[], Cuboid@#2} &
output = ParallelMap[cubes, coordswithdata, {2}];
Graphics3D@output

"Mathematica graphic"

Here is my extremely slow volume rendering solution. It is based on placing a Cuboid[] for each voxel of the data.

I switched from MapThread to ParallelMap as for some reason MapThread cannot be parallelized.

slices = Import["https://dl.dropbox.com/u/3730003/slicedata.wdx"]
data = Developer`ToPackedArray[Map[ImageData, slices]];

(*downsampling slices*)
resized = ImageResize[#, 64] & /@ slices;
data = Developer`ToPackedArray[Map[ImageData, resized]];

(*3D*)
dims = Dimensions@data;
coordswithdata = Table[{data[[x, y, z]], {x, y, z}}, {x, 1, dims[[1]]}, {y, 1, dims[[2]]}, {z, 1, dims[[3]]}];
cubes = {Hue @@ #1, EdgeForm[], Cuboid@#2} &
output = ParallelMap[cubes @@ # &, coordswithdata, {3}];
Graphics3D@output

When I tried to rotate the view Mathematica crashed so here is an ugly screenshot, but it works (sort of)!

screenshot

(*2D*)
dims = Dimensions@data[[45]];
coordswithdata = Table[{data[[45, x, y]], {x, y, 1}}, {x, 1, dims[[1]]}, {y, 1, dims[[2]]}];
cubes = {Hue @@ #1, EdgeForm[], Cuboid@#2} &
output = ParallelMap[cubes, coordswithdata, {2}];
Graphics3D@output

"Mathematica graphic"

added 258 characters in body
Source Link
s0rce
  • 9.7k
  • 4
  • 47
  • 79

Here is my extremely slow volume rendering solution. It is based on placing a Cuboid[] for each voxel of the data.

I switched from MapThread to ParallelMap as for some reason MapThread cannot be parallelized.

slices = Import["https://dl.dropbox.com/u/3730003/slicedata.wdx"]
data = Developer`ToPackedArray[Map[ImageData, slices]];

(*3D**downsampling slices*)
resized = ImageResize[#, 64] & /@ slices;
data = Developer`ToPackedArray[Map[ImageData, resized]];

(*3D*)
dims = Dimensions@data;
coordscoordswithdata = Table[{data[[x, y, z]], {x, y, z}}, {x, 1, dims[[1]]}, {y, 1, dims[[2]]}, {z, 1, dims[[3]]}];
cubes = {Hue @@ #1, EdgeForm[], Cuboid@#2} &
output = MapThread[cubes,ParallelMap[cubes {data@@ # &, coords}coordswithdata, 3];{3}];
Graphics3D@output
 

still rendering...

(*2D*)
 
dims = Dimensions@data[[45]];
coordscoordswithdata = Table[{data[[45, x, y]], {x, y, 1}}, {x, 1, dims[[1]]}, {y, 1, dims[[2]]}];
cubes = {Hue @@ #1, EdgeForm[], Cuboid@#2} &
output = MapThread[cubesParallelMap[cubes, {data[[45]]coordswithdata, coords{2}, 2];];
Graphics3D@output

"Mathematica graphic"

Here is my extremely slow volume rendering solution. It is based on placing a Cuboid[] for each voxel of the data.

slices = Import["https://dl.dropbox.com/u/3730003/slicedata.wdx"]
data = Developer`ToPackedArray[Map[ImageData, slices]];

(*3D*)

dims = Dimensions@data;
coords = Table[{x, y, z}, {x, 1, dims[[1]]}, {y, 1, dims[[2]]}, {z, 1, dims[[3]]}];
cubes = {Hue @@ #1, EdgeForm[], Cuboid@#2} &
output = MapThread[cubes, {data, coords}, 3];
Graphics3D@output
 
(*2D*)
 
dims = Dimensions@data[[45]];
coords = Table[{x, y, 1}, {x, 1, dims[[1]]}, {y, 1, dims[[2]]}];
cubes = {Hue @@ #1, EdgeForm[], Cuboid@#2} &
output = MapThread[cubes, {data[[45]], coords}, 2];
Graphics3D@output

Here is my extremely slow volume rendering solution. It is based on placing a Cuboid[] for each voxel of the data.

I switched from MapThread to ParallelMap as for some reason MapThread cannot be parallelized.

slices = Import["https://dl.dropbox.com/u/3730003/slicedata.wdx"]
data = Developer`ToPackedArray[Map[ImageData, slices]];

(*downsampling slices*)
resized = ImageResize[#, 64] & /@ slices;
data = Developer`ToPackedArray[Map[ImageData, resized]];

(*3D*)
dims = Dimensions@data;
coordswithdata = Table[{data[[x, y, z]], {x, y, z}}, {x, 1, dims[[1]]}, {y, 1, dims[[2]]}, {z, 1, dims[[3]]}];
cubes = {Hue @@ #1, EdgeForm[], Cuboid@#2} &
output = ParallelMap[cubes @@ # &, coordswithdata, {3}];
Graphics3D@output

still rendering...

(*2D*)
dims = Dimensions@data[[45]];
coordswithdata = Table[{data[[45, x, y]], {x, y, 1}}, {x, 1, dims[[1]]}, {y, 1, dims[[2]]}];
cubes = {Hue @@ #1, EdgeForm[], Cuboid@#2} &
output = ParallelMap[cubes, coordswithdata, {2}];
Graphics3D@output

"Mathematica graphic"

added 65 characters in body
Source Link
Szabolcs
  • 236.5k
  • 31
  • 641
  • 1.3k

Here is my extremely slow volume rendering solution. It is based on placing a Cuboid[] for each voxel of the data.

slices = Import["https://dl.dropbox.com/u/3730003/slicedata.wdx"]
data = Developer`ToPackedArray[Map[ImageData, slices]];

(*3D*)

dims = Dimensions@data;
coords = Table[{x, y, z}, {x, 1, dims[[1]]}, {y, 1, dims[[2]]}, {z, 1, dims[[3]]}];
cubes = {Hue @@ #1, EdgeForm[], Cuboid@#2} &
output = MapThread[cubes, {data, coords}, 3];
Graphics3D@output

(*2D*)

dims = Dimensions@data[[45]];
coords = Table[{x, y, 1}, {x, 1, dims[[1]]}, {y, 1, dims[[2]]}];
cubes = {Hue @@ #1, EdgeForm[], Cuboid@#2} &
output = MapThread[cubes, {data[[45]], coords}, 2];
Graphics3D@output

Here is my extremely slow volume rendering solution.

slices = Import["https://dl.dropbox.com/u/3730003/slicedata.wdx"]
data = Developer`ToPackedArray[Map[ImageData, slices]];

(*3D*)

dims = Dimensions@data;
coords = Table[{x, y, z}, {x, 1, dims[[1]]}, {y, 1, dims[[2]]}, {z, 1, dims[[3]]}];
cubes = {Hue @@ #1, EdgeForm[], Cuboid@#2} &
output = MapThread[cubes, {data, coords}, 3];
Graphics3D@output

(*2D*)

dims = Dimensions@data[[45]];
coords = Table[{x, y, 1}, {x, 1, dims[[1]]}, {y, 1, dims[[2]]}];
cubes = {Hue @@ #1, EdgeForm[], Cuboid@#2} &
output = MapThread[cubes, {data[[45]], coords}, 2];
Graphics3D@output

Here is my extremely slow volume rendering solution. It is based on placing a Cuboid[] for each voxel of the data.

slices = Import["https://dl.dropbox.com/u/3730003/slicedata.wdx"]
data = Developer`ToPackedArray[Map[ImageData, slices]];

(*3D*)

dims = Dimensions@data;
coords = Table[{x, y, z}, {x, 1, dims[[1]]}, {y, 1, dims[[2]]}, {z, 1, dims[[3]]}];
cubes = {Hue @@ #1, EdgeForm[], Cuboid@#2} &
output = MapThread[cubes, {data, coords}, 3];
Graphics3D@output

(*2D*)

dims = Dimensions@data[[45]];
coords = Table[{x, y, 1}, {x, 1, dims[[1]]}, {y, 1, dims[[2]]}];
cubes = {Hue @@ #1, EdgeForm[], Cuboid@#2} &
output = MapThread[cubes, {data[[45]], coords}, 2];
Graphics3D@output
edited body
Source Link
s0rce
  • 9.7k
  • 4
  • 47
  • 79
Loading
Source Link
s0rce
  • 9.7k
  • 4
  • 47
  • 79
Loading