Displaying a 3D object with the nearest 2 quadrants to the viewer cut out.

4 views (last 30 days)
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

Accepted Answer

Matt J
Matt J on 18 Jul 2025
  1 Comment
Jack
Jack on 21 Jul 2025
Thank you Matt... but I dont have the image procesing toolbox. I am tackling this problem the hard way now witha collection of 2D renderings as show below for teh cut out facets. The fat lines should be thinner, I need to work on the dynamic range to do that.

Sign in to comment.

More Answers (1)

Tim Jackman
Tim Jackman on 18 Jul 2025
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";
  1 Comment
Jack
Jack on 21 Jul 2025
I tried the steps and unfortunately I don't have either the image processing or the medical toolboxes. But thank you Tim for pointing this option. Jack

Sign in to comment.

Categories

Find more on Migrate GUIDE Apps in Help Center and File Exchange

Products

Community Treasure Hunt

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

Start Hunting!