
Displaying a 3D object with the nearest 2 quadrants to the viewer cut out.
조회 수: 4 (최근 30일)
이전 댓글 표시
I would like to have the 3D intensity, ie I(X,Y,Z) displayed in isometric view with the first 2 quadrants cut out so the the intensities in the exposed inner parts are clearly revealed. The code I wrote below is for both 3D and 2 D displaying, but only the 2D code works with xz, and not the 3D X,Y,Z. As an aside comment, this represents work on the electron field angular momentum in the hydrogen atom which I will be submitting soon for publication. The particular case here is for the so called 7,3,0 state I had hoped to follow thru on the isocaps function with it's MRI example introduced with "help isocaps", but the code is too cryptic to follow and understand. Here is the code for the 2D option. Changes to select 3D after making the appropriate manual changes in the program including adding the z-axis to the axes limits.
% Program called: Image_7f0
clf; clear all; U = 'units'; N = 'normalized';
vector = [-200:1:-1 1:1:200]; f = 2/7; % Skipping zero
[X,Y,Z] = meshgrid(vector,vector,vector); % Bohr units
r = (X.^2+Y.^2 +Z.^2).^.5;
O = ones(400,400,400);
% -----------------ANGULAR AND RADIAL FNCS --------------------')
CosThetas2 = (Z./r).^2;
Trig_func = CosThetas2.*(5*CosThetas2 - 3*O).^2;
% ******************************************************************
b = -f^3; c = 30*f^2; d = -270*f; e = 720;
R_bracket = (b*r.^3 + c*r.^2 + d*r.^1 + e*O).^2;
I = R_bracket.*exp(-f*r).*r.^6.*Trig_func;
I = I.^.5; % Image compression
% **************************************************************
[x,z] = meshgrid(1:400,1:400 ); % Used for 2D displays
for J = 1:400
for K = 1:400
Slice(J,K) = I(200,J,K); % Mid X-axis point selected for slice view
end
end
h_fig = figure(U,N);
set(h_fig,'pos',[.01 .05 .95 .9]);
h_axes = axes('pos',[.1 .1 .5 .7]);
set(h_axes,'XtickMode','manual','YtickMode','manual',...
'XLim',[1 400],'YLim',[1 400],'Nextplot','add',...
'XTickLabelMode','manual','YTickLabelMode','manual',...
'Box','off')
grid 'off'
axis([1 400 1 400])
contourf(x,z,Slice,128)
shading interp
hold on
댓글 수: 0
채택된 답변
추가 답변 (1개)
Tim Jackman
2025년 7월 18일
To display a 3-d intensity volume, I would recommend using volshow. You may want to take a look at this example for help placing clipping planes to remove a quadrant:
I would approach the problem with something like this for the variable I in your code:
obj = volshow(I,"Colormap",turbo);
viewer = obj.Parent;
Then I would click on the option in the toolbar to add a clipping plane, doing it twice to get two planes added (you can programmatically add clipping planes, its just easier to quickly do it from the toolbar). Once I have the two planes, I would the ClipIntersection on so only the region that intersects both clipping planes will be removed. Then I would adjust the interactions so the clipping planes can no longer be manually modified.
viewer.ClipIntersection = "on";
viewer.Interactions = ["zoom","pan","rotate"];

Depending on how you want to view the data, you may want to modify the volume's alphamap and turn off the lighting
obj.Alphamap = 1;
viewer.Lighting = "off";

참고 항목
카테고리
Help Center 및 File Exchange에서 Migrate GUIDE Apps에 대해 자세히 알아보기
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!