Transform a 3D objects to binary 3D matrix [closed]

Suppose that we have an unknown 3d object and we need to estimate it. We suppose that the object is inside a grid as below and we can do some test to eliminate the
cubes or”voxel” which are not a part of the object. Finally we will get two parts of cubes: cubes that belong to the object (A) and cubes that does not belong to a 3d object (B).
What I need is to construct a 3D binary matrix where for each coordinates of cubes A, matrix take 1 and for each coordinates of cubes B, matrix take 0.

Table[{x,y,z},{x,1,100,3},{y,1,100,3},{z,1,100,3}]

I think, SparseArray can be a solution.

=================

=================

1 Answer
1

=================

Your text doesn’t really match your example. You start with the grid coordinates, so just create your array.

Image3D[SparseArray[# -> 1 & /@ Position[DiskMatrix[{12, 10, 8}], 1]]]

or just Image3D[DiskMatrix[{12, 10, 8}]]

  

 

sorry, I have edited my question
– BetterEnglish
Nov 4 ’15 at 22:57