As a follow up of [this question][1] and that answer, I would like to generate a 3D matrix from a 3D figure, like the image below. [![enter image description here][2]][2] However, although the image depicts a 3D plot, there are only 2D (429x399) pixels. I'm trying to get a 3D matrix (128x128x128) of 1's and 0's where the 0's represent the branches' pixels and the transparent part are 1's inside of the box. The code used by me was img = Import["C:\\Users\\Usuario\\Desktop\\image.png", "Image3D"]; ImageDimensions[img]; n = 128; image = ImageResize[img, {n, n, n}]; data = ImageData[MorphologicalBinarize[image]]; But, `img` imported don't be in 3D. Can depth be calculated from a single 2d picture? (or unless there are cues such as color)? If it is can't get a 3D image from 2D (and hence a 3D matrix), how to generate a tubular shell branching process like that image? n=128; (*dimension of matrix*) f[i_,j_,k_]:= (*rule to generate the branches tube*) s = SparseArray[{{i_, j_,k_} -> f[i, j, k]}, {n, n, n}]; (*matrix*) t = Tube[{s}, {0.6, 0.4}]; (*tube*) Could anybody help me to obtain the matrix, please? [1]: https://mathematica.stackexchange.com/questions/259720/how-to-transform-a-picture-in-a-matrix [2]: https://i.sstatic.net/kW0XE.png