How can a curved surface be generated with a thickness and density?

4 ビュー (過去 30 日間)
Carson Purnell
Carson Purnell 2022 年 4 月 20 日
編集済み: Bruno Luong 2022 年 4 月 21 日
I've got a weird problem here. I'm trying to generate a weird feature in 3d, a cell membrane EM density. Is there some way to generate a psuedorandom surface feature with a consistent thickness and intensity profile? Especially one that can fold back on itself or totally encapsulate a volume?
While i need it to be an array eventually, it seems like generating it as a higher-resolution point density first might be easier to generate in multiple ways with different standards (thickness, and density across depth, etc).
Any strategies to do this sort of thing or existing tools I couldn't find that do something similar?
  3 件のコメント
Carson Purnell
Carson Purnell 2022 年 4 月 20 日
I don't have any representations of the real EM density, but this is a slice of a lower-resolution EM tomogram showing both cell membrane on the right and vesicular membranes on the left. I'm trying to model the actual electron density in order to simulate an actual image from that density.
Sam Chak
Sam Chak 2022 年 4 月 20 日
Perhaps you can consult with @Image Analyst, who may provide some insights on the matter.

サインインしてコメントする。

回答 (2 件)

John D'Errico
John D'Errico 2022 年 4 月 20 日
Sorry, but this is the kind of thing that is virtually impossible to do in any intelligent way. You are asking for some strange behaviours, but you have also been to vague to pin down what you want. And I think that means you don't really have any kind of mathematical definition of what you are looking for. Without an adequate definition, you are just asking for something unspecified. And that is not something you can pin down.
For example, suppose I asked you to generate a random number, but I won't tell you the required properties of that random number. It turns out this is a mathematically meaningless request. The same thing applies to your request. You want some sort of random surface, that may wrap around in any sort of way, and it "may" be a closed surface, but possibly not? Or it may cross itself in some way? Is a Klein bottle valid?
I assume that a surface that you do generate would be in the form of a triangulation. So you might use tools like an alpha shape, or perhaps an iso-surface, both based on random data to generate a surface. But then to have a surface with some thickness, it is no longer a surface, but a volume. And such a volume becomes yet more complicated to deal with.
As I said, one simple thing you can do is an alpha shape. On completely random data, it might look like this:
xyz = randn(10000,3);
S = alphaShape(xyz);
plot(S)
axis equal
The data was scattered following a 3-dimensional normal distribution, but because of the granularity of the data, the alpha shape will carve somewhat arbitrary divots into the surface. But I seriouly doubt this is what you are looking for. It sounds like you want some sort of smooth surface, yet one that is random in some undefined way.
You might do something where you start with essentially a Fourier series, with random coefficients. In spherical coordinates, represent the surface in terms of trigonometric perturbations to the surface of a sphere, or ellipsoid.
[theta,phi] = meshgrid(linspace(-pi,pi,500),linspace(-pi,pi,500));
a = rand(1);
b = rand(1);
c = rand(1);
r = 1 + a(1)*sin(theta + b(1)).*sin(phi + c(1));
x = r.*sin(phi).*cos(theta);
y = r.*sin(phi).*sin(theta);
z = r.*cos(phi);
surf(x,y,z)
shading interp
axis equal
There are infinitely many things you could do. But at the same time, it is inmpossible to know what you really want to do.
  2 件のコメント
Carson Purnell
Carson Purnell 2022 年 4 月 20 日
I'm asking because I have no idea how to go about generating the overall membrane shape. But that's the least important part - I can fudge together something by hand if necessary.
The critical part is, given some binary volume labeling membrane or a surface to outline it (vesicle or cell membrane or otherwise) generate it as an EM density. So I need to, across every arbitrary line from one side of that membrane to the other, distribute EM density (intensity in a volume or point density) according to a standard or function that I can already make in whatever format I need.
If there's some way to generate points at some density within an existing mask, then that's probably halfway there.
John D'Errico
John D'Errico 2022 年 4 月 20 日
These questions always seem to morph into something completely different.

サインインしてコメントする。


Bruno Luong
Bruno Luong 2022 年 4 月 20 日
編集済み: Bruno Luong 2022 年 4 月 21 日
To generate random close surface, one might use spherical harmonics basis to deform a sphere. There is many library on FEX, I choose here a one posted by David Goodmanson for its simplicity:
theta=linspace(0,pi,31);
phi=linspace(0,pi*2,61);
[TT,PHI]=ndgrid(theta,phi);
r = 1;
for n=0:10
sigma = (0.1/(n+1)^(1/2));
for m=-n:n
dmn = harmonicY(n,m,theta,phi);
r = r + sigma*randn()*dmn;
end
end
r = real(r);
Z = r.*cos(TT);
X = r.*sin(TT).*cos(PHI);
Y = r.*sin(TT).*sin(PHI);
figure
surf(X,Y,Z);
axis equal
shading interp
% Code posted by David Goodmanson
% https://fr.mathworks.com/matlabcentral/answers/384348-how-to-find-the-value-of-spherical-harmonic-ylm
function Ylm = harmonicY(n,m,theta,phi)
% spherical harmonics, Condon-Shortley sign convention
% for 0 <= theta <= pi only
% phi and theta are in radians
% if theta and phi are both vectors, result is a matrix with
% theta changing down the columns, phi changing along the rows
%
% Ylm = Ylm(l,m,theta,phi)
%
% caution, no checking on validity of input variables
theta = theta(:);
phi = phi(:)';
Pn = legendre(n,cos(theta),'norm');
% sign change required for odd positive m
if m >= 0
Pn = (-1)^m*Pn(abs(m)+1,:);
else
Pn = Pn(abs(m)+1,:);
end
Ylm = (1/sqrt(2*pi))*Pn'*exp(i*m*phi);
% output of legendre(n,x) is the vector P(n,m,x) for 0<=m<=n.
% P(n,-m,x) = (-)^m P(n,m,x) by convention.
% Sign changes based on Matlab behavior that legendre(n,x) contains
% the Condon-Shortley factor (-)^m, but legendre(n,x,'norm') does not.
end
For the thickness, you can generate an inner surface by computing the rinner as
rinner = r - thickness(TT,PHI) / sqrt(1 + gradient(r)'*inv(FF)*gradient(r))
,
where FF is the first fundamental form.
If you want to draw sample of point cloud on the surface; you need to to specify us how you would specify the density on this surface, it can be done without issue using a mesh of the surface.

カテゴリ

Help Center および File ExchangeSurface and Mesh Plots についてさらに検索

製品

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by