What exactly represents a voxel after loading an image into an array/matrix?
Show older comments
I know a voxel represents a grid in 3d space, but what exactly voxel is when we load an image(s) in matrix? I am not sure but if I load an image in array/matrix foo, then foo(1,1,1) represents a voxel? Is it necessary to load an images(s) in 3d matrix/array?
Will anybody please clear my basic concept by giving a simplest example, I am newbie to matlab and image processing!
Accepted Answer
More Answers (1)
Guillaume
on 22 Dec 2015
0 votes
It all depends what sort of image you're loading. I'm not familiar with 3d image formats at all but the image formats I'm familiar with (bmp, png, jpeg, etc.) only hold 2D data but may result in a 3d array in matlab because the 3rd dimension is used to store the colour information (rgb triplet).
I suppose with a 3d format, you'd either get a 3d array if the image is greyscale / indexed, or a 4d array if the image is colour.
8 Comments
Nitinkumar Ambekar
on 22 Dec 2015
Guillaume
on 22 Dec 2015
If you loaded a single DICOM image and the result is a 3d array, then you have a 2d image with colour information in the third dimension. Therefore there are no voxels, only pixels.
To get voxels, you would have to load several images and concatenate them as a 4d array:
img3d = cat(4, img1, img2, img3, ...);
The voxels would then be img3d(X, Y, :, Z). You could permute the dimensions so that colour is in the 4th dimension rather than the 3rd.
Nitinkumar Ambekar
on 22 Dec 2015
Nitinkumar Ambekar
on 22 Dec 2015
Edited: Nitinkumar Ambekar
on 22 Dec 2015
Guillaume
on 22 Dec 2015
Right, if you have loaded several 2d greyscale images into a 3d array, then yes, each element of the 3d array is a voxel.
You need a 4d array if the images have colour, since you need to store 3 colours per voxel.
Image Analyst
on 22 Dec 2015
Nitinkumar, what are your images from? Four dimensional color images are fairly uncommon. They might arise for example if you were doing color confocal microscopy where you have a full color image at a variety of "z" levels through the depth of your sample. Like Guillaume and I said, a regular color image is 3-D (say 1080 rows by 1920 columns by 3 color channels for HDTV) but the elements are called pixels, not voxels. If you had multiple gray scale images taken at a variety of slice levels, like in a medical CT or MRI image, say 1024 rows by 1024 columns by 512 slices, then that would be a volumetric image and the elements would be called voxels. Exactly what are type of image(s) are you dealing with?
Nitinkumar Ambekar
on 23 Dec 2015
Walter Roberson
on 23 Dec 2015
dicom arrays are usually 2D arrays of data, and the data is often not in the range expected for pixels. You usually have to recenter and scale if you want pixel values. You might choose to impart false colors according to the data, but the data in dicom data is seldom inherently representing color.
Categories
Find more on Image Processing Toolbox in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!