MATLAB Answers

How to create isotropic voxels in an image stack without loosing original dimensions?

3 views (last 30 days)
Katharina Hecker
Katharina Hecker on 18 Jun 2018
Answered: Sayyed Ahmad on 18 Jun 2018
Hi everyone, I was wondering how to change the voxels of an image stack into isotropic voxels (50x50x50) without loosing the dimensions of an image: x = 13 mm, y = 10 mm z = 6.05 mm).
The problem is that I have to adjust the z axis of the stack to get 6.05 mm.
The matrix of the image stack is 1186x1834x121 double.
I was looking over the functions interp3, meshgrid formation and so on, but I could not find the right example, so that I understand which codes to use in which way... Thank you very much for your help!!!

  12 Comments

Show 9 older comments
Katharina Hecker
Katharina Hecker on 18 Jun 2018
well the to connect your code with my image stack (matrix = M) I would need to attach before lines like
>load 'allimages_image_to_matrix.mat'
>size(M)
and then your code
to get one adjusted matrix as result, am I missing something?
Katharina Hecker
Katharina Hecker on 18 Jun 2018
Sorry Guillaume your comments were not shown and I just looked over them: yes this site gives a lot of information unfortunately it does not recognize tif images when I try the codes...
and about my image stack: it has the pixels: 1186x1834x121 the image stack is out of 121 images so since they have a thickness of 50 microns I have to adjust the z axis I want to have an image stack out of isotropic voxels (50x50x50)
Sayyed Ahmad
Sayyed Ahmad on 18 Jun 2018
in matlab you have to diffrent kind of visualisation. 1. one is to visualiasing some vectorial behaviour of the nature for example wind. You kann find in m atlab a very googd example to do that aim.
load wind
xmin = min(x(:));
xmax = max(x(:));
ymax = max(y(:));
zmin = min(z(:));
wind_speed = sqrt(u.^2 + v.^2 + w.^2);
hsurfaces = slice(x,y,z,wind_speed,[xmin,100,xmax],ymax,zmin);
set(hsurfaces,'FaceColor','interp','EdgeColor','none')
colormap jet
hcont = ...
contourslice(x,y,z,wind_speed,[xmin,100,xmax],ymax,zmin);
set(hcont,'EdgeColor',[0.7 0.7 0.7],'LineWidth',0.5)
[sx,sy,sz] = meshgrid(80,20:10:50,0:5:15);
hlines = streamline(x,y,z,u,v,w,sx,sy,sz);
set(hlines,'LineWidth',2,'Color','r')
view(3)
daspect([2,2,1])
axis equal
The other one is the Image manipulation. for example put the Image in the space.
[xSphere,ySphere,zSphere] = sphere(16); %# Points on a sphere
scatter3(xSphere(:),ySphere(:),zSphere(:),'.'); %# Plot the points
axis equal; %# Make the axes scales match
hold on; %# Add to the plot
xlabel('x');
ylabel('y');
zlabel('z');
img = imread('peppers.png'); %# Load a sample image
xImage = [-0.5 0.5; -0.5 0.5]; %# The x data for the image corners
yImage = [0 0; 0 0]; %# The y data for the image corners
zImage = [0.5 0.5; -0.5 -0.5]; %# The z data for the image corners
surf(xImage,yImage,zImage,... %# Plot the surface
'CData',img,...
'FaceColor','texturemap');

Sign in to comment.


Translated by