Mathematica Asked on January 15, 2021
I have this image:
and I would like to measure the average distance between the red dots.
It is important to know that they are distributed in 3D and we are looking through a slice 50nm thick (in other words, we are look at a projections of the 3D sample).
First attempt: I implemented the algorithm (for objects distributed in 2D) in the post: Radial distribution function
pts = ComponentMeasurements[Binarize@ImageSubtract[image, BilateralFilter[image, 4, 1]], "Centroid"][[All, 2]];
radialDistributionFunction2D[pts_?MatrixQ, boxLength_Real,nBins_: 500] := Module[{gr, r, binWidth = boxLength/(2 nBins), npts = Length@pts,rho}, rho = npts/boxLength^2;(*area number density*){r, gr} = HistogramList[(*compute and bin the distances between points of interest*)Flatten@DistanceMatrix@pts,{0.005, boxLength/4., binWidth}];
r = MovingMedian[r, 2];(*take center of each bin as r*)gr = gr/(2 Pi r rho binWidth npts);(*normaliza g(r)*)Transpose[{r, gr}] (*combine r and g(r)*)]
rdf = radialDistributionFunction2D[pts, 1024];
ListLinePlot[rdf, PlotRange -> {All, All}, Mesh -> 100]
and it gives:
How to interpret these results (2D vs 3D)? How do I make use of the scale bar in the microscopy image?
Get help from others!
Recent Questions
Recent Answers
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP