# Tag Info

0

filtfilt does a forwards and then a backwards filtering, as rm -rf suggests. To filter data in this way, you might try forwards = RecurrenceFilter[ToDiscreteTimeModel[ButterworthFilterModel[5], 1], data]; backwards = RecurrenceFilter[ToDiscreteTimeModel[ButterworthFilterModel[5], 1], Reverse[data]]; forwards + Reverse[backwards]

1

Another way to answer this is directly in terms of the white curve: you have a nice binary image and the length of the curve is the number of white pixels. This can be easily calculated: img=Import["http://i.stack.imgur.com/rwDwl.png"] Length@Select[Flatten@ImageData[img], # > 0.9 &] which tells you that the curve is 1563 pixels long. As rasher ...

6

There are a lot of measures in ComponentMeasurements. To find the correct one, you can easily create some test images: i1 = Image[Table[Boole[i == 10], {i, 20}, {j, 20}], "Bit"] i2 = Image[Table[Boole[i == j], {i, 20}, {j, 20}], "Bit"] In the first one, we have 20 pixel in a row. Usually, you measure only the distance from pixel to pixel which ...

2

After tracing through ColorFunction, I found the gradients live in the list DataPacletsColorDataDumpgradientSchemeMain and "RedBlueTones" corresponds to the 14th position. DataPacletsColorDataDumpgradientSchemeMain[[14, 5]] (* {RGBColor[0.450385,0.157961,0.217975],RGBColor[0.599449,0.262748,0.294618], ...

1

With the caveat that this has an answer up to scaling, one can write a function that creates a NearestFunction object that converts from RGBColor triplets to z-values at the unit interval: ClearAll[colorSchemeToUnitZ]; colorSchemeToUnitZ[ColorScheme_String, resolution_: 100] /; (MemberQ[ ColorData["Physical"]~Join~ColorData["Gradients"], ...

0

You could do this: pixelData = ImageData[Import["img.jpg"], "Real32"]; fit[u_, v_, w_] = Normal[LinearModelFit[Table[Append[List @@ Blend["RedBlueTones", #] &[t], t], {t, 0, 1, 1/1000}], Flatten[Table[u^i v^j w^k, {i, 0, 2}, {j, 0, 2}, {k, 0, 2}]], {u, v, w}]]; Plot[fit @@ Function[Blend["RedBlueTones", #]][t] - t, {t, 0, 1}](*Error of fit*) getZ[x_, ...

6

This method is mainly based on the CurvatureFlowFilter function, which can preserve the shape of the area according to the gradient of the graylevel. img = Import["http://i.stack.imgur.com/coBQa.jpg"] // ColorConvert[#, "Grayscale"] &; The threshold of the first Binarize can be determined by checking the graylevel of some sample points of the ...

13

A complete solution that gives essentially the result you want is the following: image = Import["http://i.stack.imgur.com/coBQa.jpg"]; img = ImageResize[image, 300];(*scale down to speed up calculation*) ImageAdjust[img, {4, 0.2}](*increase contrast*) ColorReplace[%, White -> Black, 0.05](*"remove" the black text*) MedianFilter[%, 5](*remove small ...

1

Here is an other image processing alternative. The main idea is as a pre-processing step using Gradient Filter. (I think most of them may work in 3D as well.) img = Import["http://i.stack.imgur.com/g7TFl.png"]; imgG = ColorConvert[img, "Grayscale"]; imgA= ColorNegate@GradientFilter[imgG, 3] // ImageAdjust imgB= ImageMultiply[MeanShiftFilter[imgG, 2, 0.3, ...

0

A third attempt would be to try the WatershedComponent Approach presented by bill s above, as in u = GaussianRandomField[128, 3, Function[k, k^-1]] // Chop //GaussianFilter[#, 15] &; so that the watershed is applied on each slice: WS = Map[WatershedComponents[Image[#], Method -> {"MinimumSaliency", .3}] &, u, 1]; Colorize[#] & /@ ...

9

We can transform the image into polar coordinates, after which averaging across angles is trivial. polarTransform[img_, rmax_] := With[{size = Max@ImageDimensions[img]}, ImageTransformation[img, Function[{r, t}, {r Cos[t], r Sin[t]}] @@ # &, {rmax + 1, 2 Pi rmax}, DataRange -> {{-size/2, size/2}, {-size/2, size/2}}, PlotRange -> ...

6

How about using nesting ImageRotate: t = NestList[ImageRotate[#, 5 Degree, Full] &, img, 71]; ImageData /@ t; out = Total[%] // Image // ImageAdjust Extracting a line looks similar to yours idata = ImageData[out]; ListPlot[idata[[All, 512]], PlotRange -> {{512, 652}, {0.4, 1}}, Frame -> True]

10

You can use ImageTrim to extract the bounding boxes from the image. image = Import["http://i.stack.imgur.com/GjN95.jpg"]; m = MorphologicalComponents@Binarize@ColorNegate@MinFilter[image, 1]; m = SelectComponents[m, "Elongation", # > 0.8 &]; c = ComponentMeasurements[{m, image}, "BoundingBox"]; ImageTrim[image, #] & /@ c[[All, 2]]

7

Another possible path is to extend Vitaliy's function FindCrossings2D to 3D In its current form, it is inefficient and somewhat buggy. Identify all 3D extrema Start with a Gaussian random field u = GaussianRandomField[16, 3, Function[k, k^-1]] // Chop // GaussianFilter[#, 6] &; Build its gradient fu = u // ListInterpolation[#, Method ...

4

Let me start and answer my own question (with what I have so far) since it might trigger some interest before the bounty expires. The motivation is to find rapidly 3D maxima of the field. Posible idea The idea is to define 3D maxima, as the intersection of the union of 2D maxima (using 'MaxDetect') sliced in two different directions. Starting with a ...

3

According to an example here:ImageValue, you could use an extension of this perhaps: ImageValue[yourimage, Table[{i, i}, {i, .5, 10, 1}]]; This takes the values of the diagonal pixels in the image and outputs them as a list - you could then interpolate this for your intensity plot. Extending it to an arbitrary line shouldn't be too much of a leap!

9

Edit: I've included the code from Bresenham's line algorithm which is used to get positions of pixels of interest. Also couple of minor improvements added. Looking forward for any sugesstions :) img = ColorConvert[Import["http://newton.umsl.edu/run//nano/5102D120.png"], "Grayscale"] Deploy@With[{opt = Sequence[Frame -> True, ...

4

You could use ImageTransformation: img = ExampleData[{"TestImage", "Lena"}]; line = {{150., 406.}, {271., 156.}}; ImageTransformation[img, line[[1]] + #[[1]]*(line[[2]] - line[[1]]) &, {100, 1}, PlotRange -> {{0, 1}, {0, 1}}, DataRange -> Full] If you want raw pixel values instead of an image, use ImageData[transformResult][[1]], to get ...

10

You know noisy financial stocks behaviour can be modeled with fractals? Meaning one is the other ;-) So how do you filter one from the other?.. Wavelets can sometimes pick up just the right sort of noise to smooth so it leaves meaningful information mostly untouched. i = Import["http://i.stack.imgur.com/FzHKm.jpg"]; Perform DiscreteWaveletTransform - ...

2

To my knowledge, it is not directly possible to compute the outline of objects with the provided morphological image processing functions. I use the outline of connected components very often too, mostly for visualising, but I think something like this should really be included in ComponentMeasurements. Since you know that the distance between outline pixel ...

2

The problem can be posed as a Traveling Salesman Problem, where we have a salesman starting at a city (or a point) and has to visit every other city once while minimizing his total distance. pts = boundary[[Last@FindShortestTour[boundary, Method -> "CCA", DistanceFunction -> ManhattanDistance]]]; Show[ ListPlot[spiel, PlotStyle -> Gray], ...

5

I think this could be what you're looking for. First let's create a list of patches: img = ExampleData[{"TestImage", "Lena"}]; patches = ImagePartition[img, 256, {128, 128}] I'm not going to use ImageAssemble to put these back together. The trick is to create black and white masks, one for each patch. This is one example: And then to use ImageMultiply ...

2

ip = ImagePartition[ExampleData[{"TestImage", "Lena"}], 40, {10, 10}] ; ImageAssemble[Map[ImageCrop[#, {10, 10}] &, ip, {2}]]

10

To fade the transparency of an image, you need to create a second image which fades from black to white and set it as the alpha channel of the image. Here is a simple interface which will let you adjust the angle, position and sharpness of the fade. image = ImageResize[ExampleData[{"TestImage", "Apples"}], 400]; {w, h} = ImageDimensions[image]; fadex = ...

3

I think bill's tiling and extracting idea in his deleted answer is actually nice, only a little more effort is needed. First we define a handy plot function: Clear[morphPlot] morphPlot[m_] := ArrayPlot[m, ColorFunction -> "Pastel"] /. (List @@ ColorData["Pastel"][0]) -> {0, 0, 0} We generate a test array m, tile it and apply the ...

2

SeedRandom[43]; m = RandomInteger[{0, 1}, {14, 12}]; m1 = ArrayPad[m, 1, "Periodic"]; db = Dimensions@m1; m1[[1, 1]] = m1[[1, db[[2]]]] = m1[[db[[1]], db[[2]]]] = m1[[db[[1]], 1]] = 0 b = MorphologicalComponents[m1, CornerNeighbors -> False]; t[{x_, y_}] := Flatten[{{{#, 1}, {#, y}} & /@ Range@x, {{1, #}, {x, #}} & /@ Range@y}, 1] k = b ...

11

This generates a 20 by 20 binary matrix and finds the morphological components. SeedRandom[11]; m=RandomInteger[{0,1},{20,20}]; a=MorphologicalComponents[m,CornerNeighbors->False] Notice that morphological component 2, in row 1, col 6, abuts morphological component 42 in row 20, col 6. Morphological components 2 and 39 abut in column 8. These ...

3

Quite simple: files = FileNames["somePath/*.dicom"]; imgs = Map[Import, files]; Where Filenames finds all files in some path and Map applies the function Import to every list item in the second parameter. If you want a progress indicator (probably a good idea for 200 images), you can do this: files = FileNames["somePath/*.dicom"]; imgs = ...

13

Your approach is quite good. I would smooth the data a bit and do an Opening to cut one extra part: tom1 = Import["http://i.stack.imgur.com/mZ4fR.jpg"]; smooth = GaussianFilter[tom1, 2]; tumor = SelectComponents[ DeleteBorderComponents[ Opening[Binarize[smooth, {0.8, 1}], 1]], {"Area", "Holes"}, 2000 < #1 < 2200 &]; HighlightImage[tom1, ...

Top 50 recent answers are included