# How to make 3D volume from 2D images

42 views (last 30 days)
Haimon on 16 Aug 2013
Answered: James Ryland on 11 May 2017
I do not know if my problem has already been solved before. I tried to find something about it, but the answers are not exactly made for my questions.
Here is the thing:
I work with microtomography. We use Skyscan 1173 model. I acquire several projections which then are reconstructed so I can obtain slices (2D images) of the entire sample. There is also the possibility to quantify several parameters, such as porosity, and also make a 3D visualization through all those 2D images, that are in grayscale (0-255).
The project I'm working on takes each pair of those 2D images, which were acquired into 2 different conditions of energy. After several mathematics, I obtain 2 sets of different data, which I can then make into 2 different sets of 2D images.
So as of right now, I'm able to use N of 2D images, and obtain 2N of 2D images, N for each variable. Those new 2D images are related to other variables which are not important to describe right now. I changed the colormap and put it a colorbar using matlab so I can easily distinguish several features in my 2D images.
My problem is: I have a bunch of those new 2D images but I don't know how to make a 3D visualization of all this data. I asked it, I searched for it, and all I could find were functions which use volumes (3D data) to obtain slices.
I need to do the exact opposite. I need to use my 2D images, and obtain a 3D volume.
So my questions are two:
1 - Has anyone ever done this before? I mean, maybe a function in matlab or in the file exchange which would allow me to use my 2D images, or even the data, and obtain my 3D volume?
2 - I tried to open my 2D images in the software we usually use, but the software can't seem to identify the colormap in the images. I think it is probably because it only recognizes grayscale and rgb. I made my colormap usng HSV. Is this the problem or is there anything else? Does anyone know how to solve it?
Walter Roberson on 16 Aug 2013
Yes.
It is possible that it needs a particular variable name. You might want to examine ExampleData/TestVolume.mat that is supplied with the package.
santosh patil on 13 Nov 2015
hi even i am trying to construct 3d volume from 2d dicom images..did you find how exactly it can be done??

James Ryland on 11 May 2017
If you can save your data as .img files instead of dicom you can use the analyse75 functions to turn them into 3D arrays of scalar density data. If you have multiple channels of data this could get tricky and I don't know how to deal with that.
On the other hand if you have uniformly sized 2D slices readily available as 2D arrays you can stack them in a 3D array just using matlabs indexing functions. array3D(:,:,i) = slice(i)
Once you have your data in a 3D array you have several options for visualizing dense volumetric representations. I would personally choose one of these over matlabs built in volumetric visualization functions because they specifically designed with large arrays in mind, whereas the built in functions do not handle large arrays well.
Solution 1: Volumetric 3 is a full matlab application for visualizing layered 3D density matrices. It was designed to work with fmri and mri but it can handle arbitrary 3D arrays stored as .mat files.
https://www.mathworks.com/matlabcentral/fileexchange/59161-volumetric-3?s_tid=srchtitle
Solution 2: A much simpler tool is Vol3D. But with a lot of programming on your end you can get it to do pretty much anything volumetric 3 does, in that they use highly similar (though distinct) techniques for generating visualizations.