# Tag Info

38

Introduction I propose a solution to this object separation problem, which simply was inspired by one of the application examples of DistanceTransform. It uses a simple method to split virtually connected (blurred) objects in 3D. A LoG filter (Marr-Hildreth operator) is detecting edges in the Euclidean distance transform by this doing a tesselation required ...

18

Image3D can do this if we overcome two problems. imgs = Import["http://i.stack.imgur.com/CQX0Q.gif"]; imgs = MapThread[SetAlphaChannel, {imgs, Binarize /@ imgs}] Image3D[imgs, Background -> Black] The second line makes all black in all the images transparent, this was the first problem. The second problem is that the broccoli will be very flat. In ...

16

MyImagePartition In the meantime, before Mathematica 10 will come out, you can enjoy my on-foot solution MyImagePartition, which both saves memory and time using the PartitionMap function from the Developer context: MyImagePartition[im_, wh_, dwdh_List: {0, 0, 0}] := Module[{it = ImageType@im, cs = First@Options[im, ColorSpace], il = ...

14

According to the documentation of Image3D, "an interactive color function editor is available via the Image3D contextual (right-click) menu". (And yes! I only found it after reading your question!) And you can get the explicit function by clicking the "Copy Function" button. Blend[{ {0., RGBColor[0.05635, 0.081, 0.07687, 0.00343663]}, {0....

14

If you already have a Graphics3D object, then you can recreate an Image3D object by stacking slices of your graphics along an axis. Here's an example. We start with your object: obj = Plot3D[x^2 - y^2, {x, -1, 1}, {y, -1, 1}] Using the following rudimentary "slice" function, we can generate slices of the function at a given value of $x$: slice[obj_, x_,...

13

This is not a direct answer to your question but it can help you. I see your question is about adaptive thresholding. I propose finding threshold values without exact partitioning. img = Import["http://homepages.inf.ed.ac.uk/rbf/HIPR2/images/son1.gif"] The simplest is GaussianFilter which is analog to $T = mean$ in your link. GF = GaussianFilter[img, ...

12

I post this as for this particular "puzzle" there is a straightforward approach. However, as has been commented some evidence of attempt is the norm. triang[x_, y_] := {{x, 0, 1}, {x, -y, 0}, {x, y, 0}} Now visualizing for this particular isoceles triangle. Graphics3D[{Polygon[ Table[triang[j, Sqrt[1 - j^2]], {j, -1, 1, 0.005}]], Polygon[Table[{...

12

You could use ListContourPlot3D and DiscretizeGraphics: Quiet @ DiscretizeGraphics @ Normal @ ListContourPlot3D[arr, Contours -> {0}, Mesh -> None]

11

Let's say we have the following 3 shapes. An isosceles triangle with base and height $(b, h)$ centered at $(x_0,z_0)$, The shape is given by 3 equations: $$z > z_0- h/2$$ $$z < 2 h /b (x- (x_0-b/2)) +(z_0 -h/2)$$ $$z < -( 2 h /b (x- (x_0-b/2))) -2 h -(z_0 -h/2)$$ with a rectangle with width and height set by the triangle $(b,h)$ and ...

10

I have not fully diagnosed the problem, but it appears as if vv and vp are not initialized when you effectively wrap a Dyanmic module within a dynamic module (which is what you've done with the Manipulate. Changing your DynamicModule into the Manipulate seems to get the result you desire if you Initialize vv and vp: Clear[vv, vp] Manipulate[ With[{img1 = ...

10

I'm a consultant at Wolfram Research. It is a bug which will be fixed in Mathematica 10. Here is a workaround for Mathematica 9.0.1: Image3D[ListDeconvolve[GaussianMatrix[{{1, 1, 1}, 1}], ImageData[img3d], Method -> {"RichardsonLucy", "Preconditioned" -> True}, MaxIterations -> 16]]

9

You can use ImageResize to resample the z-direction for your purpose. imgs = Import /@ { "http://i.stack.imgur.com/CXvgm.jpg", "http://i.stack.imgur.com/RJJnL.jpg", "http://i.stack.imgur.com/xdbmR.jpg", "http://i.stack.imgur.com/auRS8.jpg"}; mask = Import["http://i.stack.imgur.com/6S4Vj.png"]; slices = ImageMultiply[#, mask] & /@ imgs;...

8

Here is something to get you started, look at Cuboid Show[Graphics3D[{Directive[#1], Cuboid[{0, 0, 0}, #2]}] & @@@ { {Red, {1, 1, 1}}, {Blue, {1, -1, 1}}, {Green, {-1, -1, 1}}, {Gray, {-1, 1, -1}}, {Blue, {-1, 1, 1}}} , Boxed -> False]

7

In Mathematica 9, ImagePartition uses ImageData and Partition so it is slow and requires a lot of memory. This issue will be fixed in Mathematica 10.

7

Edit Thanks to matheorem for simplifying this a good deal. Image3D is relatively new and doesn't have all the options that other Graphics3D objects have, but we can work with it because it can be used with Show like any other 3D graphics object. The strategy here is to only give those options to Image3D which are unique to it, while giving all other ...

7

Here is some code I used, which may partially answer your question. The key is to calculate efficiently points near the border of the Mandelbrot set. These points have large iteration counts which, when iterated, produce the Buddhabrot form. The algorithm linked to in the question uses an adaptive mesh of squares to locate border points. The alternate code ...

6

It looks like you can do this using the Method option in Image3D. Image3D[RandomReal[1, {5, 10, 10}], Method -> "InterpolateValues"] makes the image crisp (as in the OP's version) while Image3D[RandomReal[1, {5, 10, 10}], Method -> {"InterpolateValues" -> True}] gives the anti-aliased (smoother) version. Now I'm really confused... here it ...

5

You could create a region using DiscretizeGraphics and find points within a certain distance of the surface using RegionDistance g = Normal @ Plot3D[x^2 - y^2, {x, -1, 1}, {y, -1, 1}]; f = RegionDistance @ DiscretizeGraphics @ g; data = Array[f[{##}] &, {60, 60, 60}, {-1.1, 1.1}]; Image3D[Clip[data, {0.05, 0.05}, {1, 0}]]

5

Here is something quick and dirty to convert from a Graphics3D to Image3D (the second argument is sort of a quality knob, the higher the number the more slices are taken): img3Dify[gr3d_Graphics3D, qu_] := Module[{pr, br, slices}, pr = PlotRange /. AbsoluteOptions[gr3d, PlotRange]; br = Map[Norm@Differences[#] &, pr]; slices = ParallelMap[ ...

5

Firstly, you need to apply {50,50,50} shift to DiskMatrix. It is because DiskMatrix produces sphere with the center at {50,50,50}. Image3D has different axes directions than Graphics3D so you need to search through numerous variants of transpositions and reflections. I found the following combination: z = 10; p = RandomInteger[100, {z, 3}]; r = ...

5

First, here is how I understand your question: How do I take a region described in a voxel array (binary 3D array), and convert it to a polygonal mesh (obtain a the boundary of the region as a list of polygons) in Mathematica? Here is my code that takes a binary voxel array and converts it to a list of polygons / Graphics3D object. Note that this ...

5

How about adding `ColorFunction' to your Image3D: m = RandomChoice[{1/4, 1/2, 3/4, 1}, {4, 4, 4}]; Image3D[m, ColorFunction -> Hue] Play with the Colorfunction to get different color schemes: m = RandomChoice[{1/4, 1/2, 3/4, 1}, {5, 10, 10}]; Image3D[m, ColorFunction -> "TemperatureMap"]

5

Importing: img = Import["http://i.stack.imgur.com/wMZN4.jpg"]; Inverting the colors and stretching the range: improved = img // ColorNegate // ImageAdjust Preparing a mask to remove some of the artefacts: mask = Dilation[Binarize[improved, .45], DiskMatrix[3]] Trying to remove the artefacts: inp = Inpaint[improved, mask] Plot the result (...

5

To whom it may concern, as far as I recall, the MRI data of my knee were obtain at the TU Eindhoven more than 12 years ago. The acquisition returned the isotropic volume as is. I assume, that in the academic setting we had sufficient time to generate a dense volume instead of a sparse stack of slices. -- Markus

4

Image3D is great, but if you want to have fine-tuned control over the opacity then you need to go to DensityPlot3D, or, in this case, ListDensityPlot3D. These are new functions in version 10.2. In the absence of OP's data, we'll have to invent some data. OP has a set of slices that together make up a 3D object. We can mimic this using Image3DSlices, and ...

4

Your text doesn't really match your example. You start with the grid coordinates, so just create your array. Image3D[SparseArray[# -> 1 & /@ Position[DiskMatrix[{12, 10, 8}], 1]]] or just Image3D[DiskMatrix[{12, 10, 8}]]

4

If you want to resample the data, not only the resulting Image imgData = ImageData /@ slices (* Resample for 10 points in each dimension) *) Image /@ ArrayResample[imgData, 10 {1, 1, 1}] // Image3D (* If you need finer-grained z sampling) *) Image /@ ArrayResample[imgData, 10 {2, 1, 1}] // Image3D[#, BoxRatios -> {1, 1, 1}] & Here's a sample 3d ...

4

There are several ways to reduce the size of the image. Perhaps the simplest is to reduce the number of pixels when it is generated. For example, if you do: test = Image3D[Table[Sin[x + y + z], {x, 1, 100, 3}, {y, 1, 100, 3}, {z, 1, 100, 3}]] Then you get an image that looks much the same and the memory is 0.3 MB ByteCount[test]/1024/1024 ...

3

Data type You wrote: Many MRI volumes, however, have values ranging from 0-256 or higher. I want to returning an Image3D object in which the data has not been modified, so I would like to keep the values between 0 and 256 in this case. If integer values [0, 255] are acceptable you can specify the "Byte" data type for Image3D: Image3D[255*volumeData,...

3

You can fit your data to a plane surface and use ComponentMeasurements to detect the bumps on the surface. data3Ds = Round[data3D, 0.02] // DeleteDuplicates; plane = LinearModelFit[data3D, {x, y}, {x, y}] data3Dp = ParallelMap[{#[[1]], #[[2]], #[[3]] - plane[#[[1]], #[[2]]]} &, data3Ds]; projection = Rasterize[ ListPlot3D[Reverse[SortBy[data3Dp,...

Only top voted, non community-wiki answers of a minimum length are eligible