Tag Info

Hot answers tagged

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 ...


21

body[t_] = Integrate[#[u^2], {u, 0, t}] & /@ {Cos, Sin} ParametricPlot3D[body[t]~Join~{t}, {t, -2 Pi, 2 Pi}, BoxRatios -> 1, SphericalRegion -> True]


15

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 = ...


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, ...


13

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]}, ...


11

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}]], ...


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

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'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]]


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.


6

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_, ...


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

Image3D is buggy, doesn't have all the options that other Graphics3D objects have, but we can work with it. The strategy here is to change the tickmarks in an empty ContourPlot3D and then use Show to combine it with the Image3D. Of course, you can edit the tickmarks manually but I like to use the CustomTicks package, available here: ...


4

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[ ...


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[ ...


3

In this approach the main idea is to pre-process the images rather than processing 3D Image. Lets look at some properties of the images. im = Import["...\\smallExample.tif"] (*Resize it for speeding up the process*) img = ImageResize[#, 50] & /@ im; Lets look at image 20 (others are similar) to see it's histogram. 0-0.05 shows us the Black ...


2

Here's a way to do the adaptive thresholding using the built-in ImageFilter function. To apply this to the "Sonnet for Lena" as in ybeltukov's answer, define an auxiliary function that does the local thresholding: adaptThresh[x_, threshRat_] := Module[{center, thisPix}, center = (First[Dimensions[x]] + 1)/2; thisPix = x[[center, center]]; ...


2

Using Raster3D : Graphics3D[{Opacity[.5],Raster3D[RandomReal[1,{5,5,5,3}]]}, Axes-> True] This will generate unit voxels, while the following creates 5x5x5 unit voxels: Graphics3D[{Opacity[.5],Raster3D[RandomReal[1,{5,5,5,3}],{{0,0,0},{25,25,25}}]}, Axes-> True] Perhaps this will clarify the sizes: Show[{ ...


2

Another way to get pseudo-voxels using Cuboid (mainly for versions <9): {dx, dy, dz} = {5, 5, 5}; Graphics3D[ Table[{EdgeForm[], Opacity[.1], Hue[Sqrt[x^2 + y^2 + z^2]/25], Cuboid[{x, y, z} - {dx, dy, dz}/2, {x, y, z} + {dx, dy, dz}/ 2]}, {x, -25, 25, dx}, {y, -25, 25, dy}, {z, -25, 25, dz}]] or using other increments: ... and just to ...


2

Here's another workaround: Use Show to wrap the Image3D with Graphics3D. This changes how the graphics are processed by the Front End (I suspect). Evidently the FE is grabbing the graphics parameters such as the view point, and dealing with it. I don't know enough to give a complete explanation. Certain things are optimized, such as using the GPU ...


2

The documentation of Image3D states: Slices of a 3D image may be stored in separate images file formats or different frames of a file format that support multiple frames (e.g. TIFF, DICOM, etc.). 3D geometry formats do not support 3D images, only Graphics3D.


2

Animate[ParametricPlot3D[{x + a, y + a, x + y + a}, {x, -3, 3}, {y, -2, 2}, PlotRange -> {{-8, 8}, {-8, 8}, {-10, 10}}], {a, 0, 5}] Or, use PlotRange -> {{-2, 8}, {-2, 8}, {-5, 10}}. See also: Animate >> Possible Issues Fix PlotRange to stop animations from jiggling.


1

Use the PlotRange option. PlotRange -> {10,10,10}.


1

You can use the unscaled function and just scale the ticks (see Ticks for details): ticks1 = Table[{n, n*10^6}, {n, -10^-4, 10^-4, 1/2 10^-4}]; Plot3D[F[r, y], {r, -10^-4, 10^-4}, {y, -1.5 10^-4, 10^-4}, PlotRange -> All, AxesLabel -> {Text[Style["r (m)", Italic, 14]], Text[Style["y (m)", Italic, 14]], Text[Style["F (TN)", Italic, 14]]}, Ticks ...


1

You can use Rasterize[plot,"Image"] on each frame as paw suggested. img = Image3D[RandomReal[1, {5, 10, 10}]] imageList = Most@ParallelTable[ Rasterize[ Image3D[img, ViewPoint -> {2.5 Cos[θ], 2.5 Sin[θ], 2}, ViewAngle -> 30 Degree], "Image"], {θ, 0, 2 Pi, 0.01 Pi}]; ListAnimate[imageList] Export["animation.avi", imageList]; ...


1

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: ...


1

The Villegas-Gayley pattern can be used to modify the definition of Image3D so that it outputs rasterized images. This won't help you if you have a bunch of images that you have already generated, but if you have the time to reevaluate the notebook this might be useful. It allows you to get rasterized images without having to change your code. ...


1

This will not work on version 9... Because there are too much points (about 300295) my laptop can not handle the whole data. The main idea is to use Delaunay triangulation DelaunayMesh in Mathematica. dat = data3D[[1 ;; 3000, All]]; mesh = DelaunayMesh[dat]; HighlightMesh[mesh, {Style[0, Directive[PointSize[Medium], Black]], Style[2, Opacity[0.1]]}] ...


1

Here is the code for Plotting voxel grid: PlottingVoxel[{VoxCenter_, VoxH_, VoxL_, VoxP_}] := Module[{Ip, CoordVox}, ( Ip = VoxCenter - N[{VoxH/2, VoxL/2, VoxP/2}]; CoordVox = {{Ip, Ip + {VoxH, 0, 0}, Ip + {VoxH, VoxP, 0}, Ip + {0, VoxP, 0}}, {Ip, Ip + {VoxH, 0, 0}, Ip + {VoxH, 0, VoxL}, Ip + {0, 0, VoxL}}, {Ip + {0, 0, VoxL}, Ip + ...


1

This may not answer your question. I don't quite understand how you built the Image3D object. I notice that the sphere doesn't seem to go where you put the points. For example, if I put the point right in the middle of the coordinate system, they end up out at the corners p = {{50, 50, 50}}; r = {10}; spheres = MapThread[RotateLeft[DiskMatrix[#1, ...



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