how to make 3D image from x(50x1doub​le),y(100x​1double),z (80x1double), intensity(50x100x80)

4 次查看(过去 30 天)
I want to make a 3D image of electric field near the gold nanoparticle, similar to the figure below (ACS omega 8.24 (2023): 21493-21505). I have x(50x1double),y(100x1double),z (80x1double), electric field (50x100x80). The electric field only locates near the gold nanoparticle, while the most other area electric field is zero. As such, I need to make it transparent where electric field is zero, to get a clear image. Thank you so much for your advice!
ACS omega 8.24 (2023): 21493-21505

回答(3 个)

Image Analyst
Image Analyst 2025-8-10
Not sure about the transparency but check out the Volume Viewer app and the Volume Segmenter app, both on the apps tab of the tool ribbon under the Image Processing group.

Meg Noah
Meg Noah 2025-8-11
Without having your actual data, perhaps something like ...
efieldimage = repmat(linspace(1,255,255),128,1);
numPoints = 60; % Number of points around the circumference
Length = 2;
Radius= 6;
% Create the mesh grid for the cylinder
[Theta, z] = meshgrid(linspace(0, 2*pi, numPoints), linspace(0, Length, numPoints));
Theta(2:2:end) = Theta(2:2:end) + pi/numPoints;
x = Radius*cos(Theta);
y = Radius*sin(Theta);
for k = 1:10
idx = find(z == z(k,1));
x(idx) = ((k-1)/10)*(Radius)*cos(Theta(idx));
y(idx) = ((k-1)/10)*(Radius)*sin(Theta(idx));
idx = find(z == z(end-k,1));
x(idx) = ((10-k)/10)*(Radius)*cos(Theta(idx));
y(idx) = ((10-k)/10)*(Radius)*sin(Theta(idx));
end
z(1:10,:) = z(11,1);
z(end-9:end, :) = z(end-10,1);
s = surf(x, y, z);
s.CData = efieldimage; % set color data to data
s.FaceColor = 'texturemap'; % use texture mapping
s.EdgeColor = 'none'; % remove edges
s.FaceLighting = 'gouraud'; % preferred lighting for curved surfaces
s.SpecularStrength = 0.1; % change the strength of the reflected light
s.FaceAlpha = 0.25; % transparency
s.SpecularExponent = 25;
s.DiffuseStrength = 1.0;
axis off
view(80,68)

Walter Roberson
Walter Roberson 2025-8-11
The basic 3D volume viewer is volshow or the application VolumeViewer https://www.mathworks.com/help/images/ref/volumeviewer-app.html
Unfortunately, both of those are for uniform volumes with equidistant centers in x y and z .
So... to use the data you will need to use something like
xu = unique(x); xu(isnan(xu)) = [];
assert(numel(xu)>=2, 'not enough unique x');
yu = unique(y); yu(isnan(yu)) = [];
assert(numel(yu)>=2, 'not enough unique x');
zu = unique(z); zu(isnan(zu)) = [];
assert(numel(zu)>=2, 'not enough unique x');
xdelta = min(diff(xu));
ydelta = min(diff(yu));
zdelta = min(diff(zu));
delta = min([xdelta, ydelta, zdelta]);
xvec = xu(1):delta:xu(end);
yvec = yu(1):delta:yu(end);
zvec = zu(1):delta:zu(end);
Egrid = interp3(x, y, z, electric_field, xvec.', yvec, reshape(zvec,1,1,[]));
Now you can run the volume viewer on Egrid
The code gets simpler if only you knew that x or y or z were equal spaced. As it is, we have to assume that the marginal vectors are irregularly spaced and have duplicate values and fold back on themselves multiple times (because we are not told otherwise.) If the vectors are all equally spaced, the code can be mostly replaced with a single call to imresize3

类别

Help CenterFile Exchange 中查找有关 3-D Volumetric Image Processing 的更多信息

标签

产品


版本

R2024a

Community Treasure Hunt

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

Start Hunting!

Translated by