1
$\begingroup$

I have a stack of images that I compile with the Image3D function. The resulting figure is 360x360x93 pixels and named "X". My goal is to mesh the figure.

I have defined points that correspond the the corners of the figure and tried to "stick" them on my figure:

coord = Join[{{1., 1., 1.}, {360., 1., 1.}, {360., 360., 1.}, {1., 
360., 1.}, {1., 1., 93.}, {360., 1., 93.}, {360., 360., 93.}, {1.,
 360., 93.}}, PixelValuePositions[X, 1]] 

This returns a massive list of points and doesn't "stick" the points like I'd hoped. I'd like to be able to go on and run the following code to make the mesh:

boundaryElements = {TetrahedronElement[{{1, 2, 3, 4}, {5, 6, 7, 
  8}, {1, 2, 7, 6}, {4, 5, 9, 3}, {1, 4, 5, 6}, {2, 7, 8, 3}}]};
 bmesh = ToBoundaryMesh["Coordinates" -> coord, 
"BoundaryElements" -> boundaryElements];
 bmesh["Wireframe"]

I've tried many different things to make the points "stick" to my figure but I have been unsuccessful each time. I've also defined a separate variable as the coordinates and used the Join function in the following way:

coord2 = Join [coordinates, PixelValuePositions[X,1]]

I have been able to create an empty rectangular box of dimensions 360x360x93 and create a mesh of it, but I cannot replicate this on an actual figure.

$\endgroup$
  • 1
    $\begingroup$ Have you seen ImageMesh? $\endgroup$ – Chip Hurst Dec 14 '16 at 18:52
  • $\begingroup$ Also, if you could provide X, it would make it easier to help answer your question. $\endgroup$ – Chip Hurst Dec 14 '16 at 18:53
  • $\begingroup$ How could I upload a 3D figure here? I'd be happy to do so! $\endgroup$ – Christa Dec 14 '16 at 18:57
  • $\begingroup$ ImageMesh is the closest I've gotten - thank you!! $\endgroup$ – Christa Dec 14 '16 at 18:58
  • 1
    $\begingroup$ It sounds like ImageMesh is what you want then, right? You may need to do ImageMesh[ColorNegate[X]] if you're getting the complement of what you want. $\endgroup$ – Chip Hurst Dec 14 '16 at 21:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.