How to get the intensity values (data stored) that is stored in the voxels (3D image) at the certain distances from the origin of the sphere?
12 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
blues
el 31 de Ag. de 2018
Comentada: Walter Roberson
el 3 de Sept. de 2018
Hello, I have a 3D medical image with data values stored in its each voxel. I would like to pull out the data values of image at certain radial distances. The origin of my image is (0, 0, 0) and radius of the sphere is 20 mm. I would like to generate 19 concentric shells of equal thickness 1 mm (so total is 20 mm) in between center of sphere and its surface. At each concentric shell, I am interested to extract the value of the data stored in 3D image. How to write simple Matlab code for this situation? Has anyone done this before? Please provide me some ideas and suggestions, may be a little piece of code as well.
3 comentarios
Walter Roberson
el 1 de Sept. de 2018
It looks like the ElementSpacing has the relevant information about pixel sizes.
Respuesta aceptada
Walter Roberson
el 1 de Sept. de 2018
filename = ...;
info = mha_readheader(filename);
V = mha_read_volume(info);
spx = info.ElementSpacing(1);
spy = info.ElementSpacing(2);
spz = info.ElementSpacing(3);
%careful, first dimension is y not x.
sx = size(V,2);
sy = size(V,1);
sz = size(V,3);
cx = sx/2; cy = sy/2; cz = sz/2;
xv = ((1:sx) - cx) * spx;
yv = ((1:sy) - cy) * spy;
zv = ((1:sz) - cz) * spz;
[X, Y, Z] = ndgrid(xv, yv, zv);
D = sqrt(X.^2 + Y.^2 + Z.^2);
rvals = 0 : 19;
rthick = 1;
Nr = length(rvals);
shells = cell(Nr, 2);
for ridx = 1 : Nr
r = rvals(ridx);
mask = (D >= r & D < r+thick);
shells{ridx, 2} = mask;
shells{ridx, 1} = V(mask);
end
Now the first column of the cell array shells contain the extracted data values, and the second column contains the mask of locations that were extracted (in case you need it later.)
6 comentarios
Walter Roberson
el 2 de Sept. de 2018
No, avgpixelvals is the mean for each concentric shell. shells is a cell array in which the first column contains only values that lie within the particular concentric sphere for that one radius.
Más respuestas (1)
blues
el 3 de Sept. de 2018
1 comentario
Walter Roberson
el 3 de Sept. de 2018
Your graph appears to show a y value peaking about 8.4*10^-8
Anyhow, you used the wrong numeric syntax
axis([0 120 5E-11 8E-8])
or
axis([0 120 5*10.^(-11) 8*10.^(-8)]);
With 5E-11 being only about 1/1600 of 8E-8, you should expect that MATLAB will probably round the lower bound to 0. After all, you would need your y resolution to be at least 1600 for it to make a 1 pixel difference.
Ver también
Categorías
Más información sobre Biomedical Imaging en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!