How to make 3D volume from 2D images

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?
Thanks for all your help.

7 Comments

You have 2D images. To check, there is one value per array location? Or are there three values per location (e.g., RGB or HSV) ?
Are the images to be logically "stacked" ? Or are the images different angles of the same basic information and the 3D object needs to be reconstructed based upon the information in the 2D images?
If the images are to be stacked, then why not just cat(3) them all together to create the volume that you then examine using the FEX viewer that you were pointed to in your previous question ?
I'm not sure. I calculated one value for each array location, but I saved those new images with HSV colormap.
The images are from one object. It's exactly as a tomography, but I just changed from a grayscale image to a new one, in color. My ideia is to put them together, one above the other, like you would see in a CT scan, so I can compare to the original image.
Actually I didn't use the cat command.
I just put it on a variable, like, with a 3rd dimension [a(:,:,d) = b]; . Seemed easier since I had several (~3000} images, and I thought it would be easier to find the volume with this data, instead of using the images. But I also have the images.
Does that make any difference?
If not, now I have this variable with all data from all slices.
I looked it up in the Viewer3D and the file-formats it needs are not the ones I have, or at least, I think I don't have them, like
Matlab Files (.mat)
Dicom Files ( .dcm , .dicom )
V3D Philips Scanner ( .v3d )
GIPL Guys Image Processing Lab ( .gipl )
HDR/IMG Analyze ( .hdr )
ISI Files ( .isi )
NifTi ( .nii )
RAW files ( .raw , .* )
VMP BrainVoyager ( .vmp )
XIF HDllab/ATL ultrasound ( .xif )
VTK Visualization Toolkit ( .vtk )
Insight Meta-Image ( .mha, .mhd )
Micro CT ( .vff )
save('TheMATfile.mat', 'a');
Now you have a .mat file.
It works just like that?
I thought of trying that, but I thought that it had to be one of those files prior to anything.
So just to make sure I understood, I save my variable, which consists of all matrixs, into a single .mat file?
I don't think it is working.
I saved the data, like you said, into a .mat file.
I then opened it with viewer3d, but it gave me nothing.
The program seems to work, but the screen is just black. There is no image at all.
Maybe the problem is that there isn't a colormap defined? I mean, the values are changed from a original grayscale image, so how it would now know which is the new colormap?
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.
hi even i am trying to construct 3d volume from 2d dicom images..did you find how exactly it can be done??

Sign in to comment.

Answers (1)

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.

Categories

Asked:

on 16 Aug 2013

Answered:

on 11 May 2017

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!