How to create isotropic voxels in an image stack without loosing original dimensions?
Mostrar comentarios más antiguos
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
Guillaume
el 18 de Jun. de 2018
Katharina Hecker
el 18 de Jun. de 2018
Katharina Hecker
el 18 de Jun. de 2018
Katharina Hecker
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.
Sayyed Ahmad
el 18 de Jun. de 2018
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
Katharina Hecker
el 18 de Jun. de 2018
Sayyed Ahmad
el 18 de Jun. de 2018
I could not understand what you mean!
Guillaume
el 18 de Jun. de 2018
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
Katharina Hecker
el 18 de Jun. de 2018
Katharina Hecker
el 18 de Jun. de 2018
Sayyed Ahmad
el 18 de Jun. de 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');
Respuestas (1)
Sayyed Ahmad
el 18 de Jun. de 2018
0 votos
do you have your answer?
Categorías
Más información sobre Color and Styling en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!