VTK - create 3D model












0















I'm trying to create a 3D mask model from the 3D coordinate points that are stored in the txt file. I use the Marching cubes algorithm. It looks like it´s not able to link individual points, and therefore holes are created in the model.



Steps: (by https://lorensen.github.io/VTKExamples/site/Cxx/Modelling/MarchingCubes/)



First, load 3D points from file as vtkPolyData.



Then, use vtkVoxelModeller



Put voxelModeller output to MC algorithm and finally visualize



visualization



Any ideas?



Thanks










share|improve this question



























    0















    I'm trying to create a 3D mask model from the 3D coordinate points that are stored in the txt file. I use the Marching cubes algorithm. It looks like it´s not able to link individual points, and therefore holes are created in the model.



    Steps: (by https://lorensen.github.io/VTKExamples/site/Cxx/Modelling/MarchingCubes/)



    First, load 3D points from file as vtkPolyData.



    Then, use vtkVoxelModeller



    Put voxelModeller output to MC algorithm and finally visualize



    visualization



    Any ideas?



    Thanks










    share|improve this question

























      0












      0








      0








      I'm trying to create a 3D mask model from the 3D coordinate points that are stored in the txt file. I use the Marching cubes algorithm. It looks like it´s not able to link individual points, and therefore holes are created in the model.



      Steps: (by https://lorensen.github.io/VTKExamples/site/Cxx/Modelling/MarchingCubes/)



      First, load 3D points from file as vtkPolyData.



      Then, use vtkVoxelModeller



      Put voxelModeller output to MC algorithm and finally visualize



      visualization



      Any ideas?



      Thanks










      share|improve this question














      I'm trying to create a 3D mask model from the 3D coordinate points that are stored in the txt file. I use the Marching cubes algorithm. It looks like it´s not able to link individual points, and therefore holes are created in the model.



      Steps: (by https://lorensen.github.io/VTKExamples/site/Cxx/Modelling/MarchingCubes/)



      First, load 3D points from file as vtkPolyData.



      Then, use vtkVoxelModeller



      Put voxelModeller output to MC algorithm and finally visualize



      visualization



      Any ideas?



      Thanks







      vtk






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Nov 13 '18 at 14:46









      ElwyElwy

      1




      1
























          1 Answer
          1






          active

          oldest

          votes


















          0














          The example takes a spherical mesh (a.k.a. a set of triangles forming a sealed 3D shape), converts it to a voxel representation (a 3D image where the voxels outside the mesh are black and those inside are not) then converts it back to a mesh using Marching Cubes algorithm. In practice the input and output of the example are very similar meshes.



          In your case, you load the points and try to create a voxel representation of them. The problem is that your set of points is not sufficient to define a volume, they are not a sealed mesh, just a list of points.



          In order to replicate the example you should do the following:



          1) building a 3D mesh from your points (you gave no information of what the points are/represent so I can't help you much with this task). In other words you need to tell how these points are connected between then to form a 3D shape (vtkPolyData). VTK can't guess how your points are connected, you have to tell it.



          2) once you have a mesh, if you need a voxel representation (vtkImageData) of it you can use vtkVoxelModeller or vtkImplicitModeller. At this point you can use vtk filters that need a vtkImageData as input.



          3) finally in order to convert voxels back to a mesh (vtkPolyData) you can use vtkMarchingCubes (or better vtkFlyingEdges3D that is a very similar algorithm but much faster).



          Edit:
          It is not clear what the shape you want should be, but you can try to use vtkImageOpenClose3D so the steps are:



          First, load 3D points from file as vtkPolyData.



          Then, use vtkVoxelModeller



          Put voxelModeller output to vtkImageOpenClose3D algorithm, then vtkImageOpenClose3D algorithm output to MC (change to vtkFlyingEdges3D) algorithm and finally visualize



          Example for vtkImageOpenClose3D:
          https://www.vtk.org/Wiki/VTK/Examples/Cxx/Images/ImageOpenClose3D






          share|improve this answer


























          • 1) The mask consists of contours (like CT slices) and each contour contains list of 3D points.

            – Elwy
            Nov 14 '18 at 16:28











          • You probably want to try MeshLab, it has some surface reconstruction features that should do what you need (try surface reconstruction: pivoting ball and play with parameters). To do it with VTK - take no offense - you would need to read this: vtk.org/vtk-textbook

            – L.C.
            Nov 14 '18 at 20:53











          Your Answer






          StackExchange.ifUsing("editor", function () {
          StackExchange.using("externalEditor", function () {
          StackExchange.using("snippets", function () {
          StackExchange.snippets.init();
          });
          });
          }, "code-snippets");

          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "1"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53283555%2fvtk-create-3d-model%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          0














          The example takes a spherical mesh (a.k.a. a set of triangles forming a sealed 3D shape), converts it to a voxel representation (a 3D image where the voxels outside the mesh are black and those inside are not) then converts it back to a mesh using Marching Cubes algorithm. In practice the input and output of the example are very similar meshes.



          In your case, you load the points and try to create a voxel representation of them. The problem is that your set of points is not sufficient to define a volume, they are not a sealed mesh, just a list of points.



          In order to replicate the example you should do the following:



          1) building a 3D mesh from your points (you gave no information of what the points are/represent so I can't help you much with this task). In other words you need to tell how these points are connected between then to form a 3D shape (vtkPolyData). VTK can't guess how your points are connected, you have to tell it.



          2) once you have a mesh, if you need a voxel representation (vtkImageData) of it you can use vtkVoxelModeller or vtkImplicitModeller. At this point you can use vtk filters that need a vtkImageData as input.



          3) finally in order to convert voxels back to a mesh (vtkPolyData) you can use vtkMarchingCubes (or better vtkFlyingEdges3D that is a very similar algorithm but much faster).



          Edit:
          It is not clear what the shape you want should be, but you can try to use vtkImageOpenClose3D so the steps are:



          First, load 3D points from file as vtkPolyData.



          Then, use vtkVoxelModeller



          Put voxelModeller output to vtkImageOpenClose3D algorithm, then vtkImageOpenClose3D algorithm output to MC (change to vtkFlyingEdges3D) algorithm and finally visualize



          Example for vtkImageOpenClose3D:
          https://www.vtk.org/Wiki/VTK/Examples/Cxx/Images/ImageOpenClose3D






          share|improve this answer


























          • 1) The mask consists of contours (like CT slices) and each contour contains list of 3D points.

            – Elwy
            Nov 14 '18 at 16:28











          • You probably want to try MeshLab, it has some surface reconstruction features that should do what you need (try surface reconstruction: pivoting ball and play with parameters). To do it with VTK - take no offense - you would need to read this: vtk.org/vtk-textbook

            – L.C.
            Nov 14 '18 at 20:53
















          0














          The example takes a spherical mesh (a.k.a. a set of triangles forming a sealed 3D shape), converts it to a voxel representation (a 3D image where the voxels outside the mesh are black and those inside are not) then converts it back to a mesh using Marching Cubes algorithm. In practice the input and output of the example are very similar meshes.



          In your case, you load the points and try to create a voxel representation of them. The problem is that your set of points is not sufficient to define a volume, they are not a sealed mesh, just a list of points.



          In order to replicate the example you should do the following:



          1) building a 3D mesh from your points (you gave no information of what the points are/represent so I can't help you much with this task). In other words you need to tell how these points are connected between then to form a 3D shape (vtkPolyData). VTK can't guess how your points are connected, you have to tell it.



          2) once you have a mesh, if you need a voxel representation (vtkImageData) of it you can use vtkVoxelModeller or vtkImplicitModeller. At this point you can use vtk filters that need a vtkImageData as input.



          3) finally in order to convert voxels back to a mesh (vtkPolyData) you can use vtkMarchingCubes (or better vtkFlyingEdges3D that is a very similar algorithm but much faster).



          Edit:
          It is not clear what the shape you want should be, but you can try to use vtkImageOpenClose3D so the steps are:



          First, load 3D points from file as vtkPolyData.



          Then, use vtkVoxelModeller



          Put voxelModeller output to vtkImageOpenClose3D algorithm, then vtkImageOpenClose3D algorithm output to MC (change to vtkFlyingEdges3D) algorithm and finally visualize



          Example for vtkImageOpenClose3D:
          https://www.vtk.org/Wiki/VTK/Examples/Cxx/Images/ImageOpenClose3D






          share|improve this answer


























          • 1) The mask consists of contours (like CT slices) and each contour contains list of 3D points.

            – Elwy
            Nov 14 '18 at 16:28











          • You probably want to try MeshLab, it has some surface reconstruction features that should do what you need (try surface reconstruction: pivoting ball and play with parameters). To do it with VTK - take no offense - you would need to read this: vtk.org/vtk-textbook

            – L.C.
            Nov 14 '18 at 20:53














          0












          0








          0







          The example takes a spherical mesh (a.k.a. a set of triangles forming a sealed 3D shape), converts it to a voxel representation (a 3D image where the voxels outside the mesh are black and those inside are not) then converts it back to a mesh using Marching Cubes algorithm. In practice the input and output of the example are very similar meshes.



          In your case, you load the points and try to create a voxel representation of them. The problem is that your set of points is not sufficient to define a volume, they are not a sealed mesh, just a list of points.



          In order to replicate the example you should do the following:



          1) building a 3D mesh from your points (you gave no information of what the points are/represent so I can't help you much with this task). In other words you need to tell how these points are connected between then to form a 3D shape (vtkPolyData). VTK can't guess how your points are connected, you have to tell it.



          2) once you have a mesh, if you need a voxel representation (vtkImageData) of it you can use vtkVoxelModeller or vtkImplicitModeller. At this point you can use vtk filters that need a vtkImageData as input.



          3) finally in order to convert voxels back to a mesh (vtkPolyData) you can use vtkMarchingCubes (or better vtkFlyingEdges3D that is a very similar algorithm but much faster).



          Edit:
          It is not clear what the shape you want should be, but you can try to use vtkImageOpenClose3D so the steps are:



          First, load 3D points from file as vtkPolyData.



          Then, use vtkVoxelModeller



          Put voxelModeller output to vtkImageOpenClose3D algorithm, then vtkImageOpenClose3D algorithm output to MC (change to vtkFlyingEdges3D) algorithm and finally visualize



          Example for vtkImageOpenClose3D:
          https://www.vtk.org/Wiki/VTK/Examples/Cxx/Images/ImageOpenClose3D






          share|improve this answer















          The example takes a spherical mesh (a.k.a. a set of triangles forming a sealed 3D shape), converts it to a voxel representation (a 3D image where the voxels outside the mesh are black and those inside are not) then converts it back to a mesh using Marching Cubes algorithm. In practice the input and output of the example are very similar meshes.



          In your case, you load the points and try to create a voxel representation of them. The problem is that your set of points is not sufficient to define a volume, they are not a sealed mesh, just a list of points.



          In order to replicate the example you should do the following:



          1) building a 3D mesh from your points (you gave no information of what the points are/represent so I can't help you much with this task). In other words you need to tell how these points are connected between then to form a 3D shape (vtkPolyData). VTK can't guess how your points are connected, you have to tell it.



          2) once you have a mesh, if you need a voxel representation (vtkImageData) of it you can use vtkVoxelModeller or vtkImplicitModeller. At this point you can use vtk filters that need a vtkImageData as input.



          3) finally in order to convert voxels back to a mesh (vtkPolyData) you can use vtkMarchingCubes (or better vtkFlyingEdges3D that is a very similar algorithm but much faster).



          Edit:
          It is not clear what the shape you want should be, but you can try to use vtkImageOpenClose3D so the steps are:



          First, load 3D points from file as vtkPolyData.



          Then, use vtkVoxelModeller



          Put voxelModeller output to vtkImageOpenClose3D algorithm, then vtkImageOpenClose3D algorithm output to MC (change to vtkFlyingEdges3D) algorithm and finally visualize



          Example for vtkImageOpenClose3D:
          https://www.vtk.org/Wiki/VTK/Examples/Cxx/Images/ImageOpenClose3D







          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Nov 13 '18 at 19:50

























          answered Nov 13 '18 at 15:31









          L.C.L.C.

          310212




          310212













          • 1) The mask consists of contours (like CT slices) and each contour contains list of 3D points.

            – Elwy
            Nov 14 '18 at 16:28











          • You probably want to try MeshLab, it has some surface reconstruction features that should do what you need (try surface reconstruction: pivoting ball and play with parameters). To do it with VTK - take no offense - you would need to read this: vtk.org/vtk-textbook

            – L.C.
            Nov 14 '18 at 20:53



















          • 1) The mask consists of contours (like CT slices) and each contour contains list of 3D points.

            – Elwy
            Nov 14 '18 at 16:28











          • You probably want to try MeshLab, it has some surface reconstruction features that should do what you need (try surface reconstruction: pivoting ball and play with parameters). To do it with VTK - take no offense - you would need to read this: vtk.org/vtk-textbook

            – L.C.
            Nov 14 '18 at 20:53

















          1) The mask consists of contours (like CT slices) and each contour contains list of 3D points.

          – Elwy
          Nov 14 '18 at 16:28





          1) The mask consists of contours (like CT slices) and each contour contains list of 3D points.

          – Elwy
          Nov 14 '18 at 16:28













          You probably want to try MeshLab, it has some surface reconstruction features that should do what you need (try surface reconstruction: pivoting ball and play with parameters). To do it with VTK - take no offense - you would need to read this: vtk.org/vtk-textbook

          – L.C.
          Nov 14 '18 at 20:53





          You probably want to try MeshLab, it has some surface reconstruction features that should do what you need (try surface reconstruction: pivoting ball and play with parameters). To do it with VTK - take no offense - you would need to read this: vtk.org/vtk-textbook

          – L.C.
          Nov 14 '18 at 20:53


















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53283555%2fvtk-create-3d-model%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Florida Star v. B. J. F.

          Danny Elfman

          Lugert, Oklahoma