Increase one of the dimensions of an array
5 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Sebastian Dahl Sandbu
le 17 Juin 2023
Commenté : Sebastian Dahl Sandbu
le 17 Juin 2023
I have a 190x190x20 array with intensity values of medical images (nifti). The resolution is (1mm, 1mm, 2mm), and I would like to have the same resolution in all directions. In other words, I want 40 pages instead of 20 pages.
Is there any way to increase the number of pages or increase the resolution in one direction? I have looked at interpolation, but I'm not sure if it will work in my case.
Greatful for any ideas.
2 commentaires
Stephen23
le 17 Juin 2023
Modifié(e) : Stephen23
le 17 Juin 2023
"In other words, I want 40 pages instead of 20 pages."
You are making an off-by-one error. Consider:
V = 1:4
W = 1:0.5:4
W has twice the resolution of V, but does it have twice the number of elements in it?
" I have looked at interpolation, but I'm not sure if it will work in my case."
Probably: what you describe is some kind of interpolation (using what method is another question entirely).
What have you tried so far?
Réponse acceptée
Image Analyst
le 17 Juin 2023
Try interp3
help interp3
Something like (untested)
[rows, columns, slices] = size(img)
z = linspace(1, slices, 2 * slices); % Need twice as many slices as the original.
[X, Y, Z] = meshgrid(1:columns, 1:rows, z);
img2 = interp3(img, X, Y, Z);
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Get Started with Image Processing Toolbox dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!