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

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 comentarios

How does this question differ from your previous question for which you accepted the answer?
This differs because, in the last question I had the problem to visualize the 3D volume. The original dimensions 1186x1834x121 double were changed to 50x50x50 instead of changing to the isotrop. voxel size and still get the volume with the dimensions of the image stack: x = 13 mm, y = 10 mm z = 6.05 mm) Maybe I missunderstand something or I`m explaining it not good enough...
after I tried out the answer
Maybe another try to explain it: right now my image stack has the dimensions x = 13 mm y = 10 mm and z = is not recognized as dimension I want to change z so that I have z = 6.05 mm and that the image stack consists of isotropic voxel sizes... Can somebody explain me a solution? I would be really thankful.
Guillaume
Guillaume el 18 de Jun. de 2018
Editada: Guillaume el 18 de Jun. de 2018
I'm not clear on what you're asking. A 3D matrix representation of a volumne does not have an inherent voxel size. The voxel size is whatever you say it is and you'll have to store that independently of the matrix.
When calculating volume size or when displaying you may need to tell the calculating / display function what the voxel size is but as far as the matrix is concerned nothing change if your voxels are 1x1x1 or 0.1x0.2x0.3.
edit: Note that matlab has functions to carry the voxel size information. Again, it's independent of the voxel matrix. Have a look at imref3d.
is that the answer of your quastion?
[X,Y] = meshgrid(linspace(0,13,11186),linspace(0,10,1834));
Z=X.*sin(X)+Y.*cos(Y);
ind=find(Z>=6.05);
Z(ind)=6.05;
mesh(X,Y,Z)
axis equal
Can I just ask you something? The code I almost had similar, but where is the integration than of the matrix (from image stack) should I asign Matrix = [X,Y]?
I could not understand what you mean!
right now my image stack has the dimensions x = 13 mm y = 10 mm and z = is not recognized as dimension I want to change z so that I have z = 6.05
  • How is the dimension defined? Do you just have 3 variables, x, y and z, or a 3 element vector, or an imref3d object, or ...?
  • What does not recognize as dimension? There's very few function in matlab that care about the size of your voxels.
It may be better if you post some example code
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?
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)
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');

Iniciar sesión para comentar.

Categorías

Más información sobre Color and Styling en Centro de ayuda y File Exchange.

Preguntada:

el 18 de Jun. de 2018

Respondida:

el 18 de Jun. de 2018

Community Treasure Hunt

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

Start Hunting!

Translated by