Dear All,<br><br>&nbsp;&nbsp;I got some problems when using the TriangleMeshToBinaryImageFilter class,<br><br>&nbsp;&nbsp;The following test code can run smoothly,<br><br><div style="margin-left: 40px;">&nbsp;<span style="color: rgb(0, 0, 153);">&nbsp;typedef itk::DefaultDynamicMeshTraits&lt;double, 3, 3,double,double&gt; TriangleMeshTraits;
</span><br style="color: rgb(0, 0, 153);"><span style="color: rgb(0, 0, 153);">&nbsp;&nbsp;typedef itk::Mesh&lt;double,3, TriangleMeshTraits&gt; TriangleMeshType; </span><br style="color: rgb(0, 0, 153);"><span style="color: rgb(0, 0, 153);">
&nbsp;&nbsp;typedef itk::RegularSphereMeshSource&lt;TriangleMeshType&gt;&nbsp;&nbsp;SphereMeshSourceType;</span><br style="color: rgb(0, 0, 153);"><span style="color: rgb(0, 0, 153);">&nbsp;&nbsp;typedef SphereMeshSourceType::PointType PointType;</span>
<br style="color: rgb(0, 0, 153);"><span style="color: rgb(0, 0, 153);">&nbsp;&nbsp;typedef itk::Image&lt;unsigned char, 3&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;MeshPixelType;</span><br style="color: rgb(0, 0, 153);"><span style="color: rgb(0, 0, 153);">&nbsp;&nbsp;typedef itk::TriangleMeshToBinaryImageFilter&lt;TriangleMeshType, MeshPixelType&gt; TriangleMeshToBinaryImageFilterType;
</span><br style="color: rgb(0, 0, 153);"><br style="color: rgb(0, 0, 153);"><span style="color: rgb(0, 0, 153);">&nbsp; TriangleMeshToBinaryImageFilterType::Pointer m_TriangleMeshToImage = TriangleMeshToBinaryImageFilterType::New();
</span><br style="color: rgb(0, 0, 153);"></div>        <br style="color: rgb(0, 0, 153);"><div style="margin-left: 40px;"><span style="color: rgb(0, 0, 153);">        PointType center; </span><br style="color: rgb(0, 0, 153);"><span style="color: rgb(0, 0, 153);">
        center[0]=200;</span><br style="color: rgb(0, 0, 153);"><span style="color: rgb(0, 0, 153);">        center[1]=200;</span><br style="color: rgb(0, 0, 153);"><span style="color: rgb(0, 0, 153);">        center[2]=200;</span><br style="color: rgb(0, 0, 153);">
<br style="color: rgb(0, 0, 153);"><span style="color: rgb(0, 0, 153);">        SphereMeshSourceType::Pointer mySphere = SphereMeshSourceType::New();</span><br style="color: rgb(0, 0, 153);"><span style="color: rgb(0, 0, 153);">
        mySphere-&gt;SetCenter(center);</span><br style="color: rgb(0, 0, 153);"><span style="color: rgb(0, 0, 153);">        mySphere-&gt;SetScale( 10 );</span><br style="color: rgb(0, 0, 153);"><span style="color: rgb(0, 0, 153);">        mySphere-&gt;SetResolution(5);
</span><br style="color: rgb(0, 0, 153);"><br style="color: rgb(0, 0, 153);"><span style="color: rgb(0, 0, 153);">m_TriangleMeshToImage-&gt;SetInput(mySphere-&gt;GetOutput());</span><br style="color: rgb(0, 0, 153);"><br style="color: rgb(0, 0, 153);">
<span style="color: rgb(0, 0, 153);">MeshPixelType::SizeType size;</span><br style="color: rgb(0, 0, 153);"><br style="color: rgb(0, 0, 153);"><span style="color: rgb(0, 0, 153);">        size[0] = 90;</span><br style="color: rgb(0, 0, 153);">
<span style="color: rgb(0, 0, 153);">        size[1] = 90;</span><br style="color: rgb(0, 0, 153);"><span style="color: rgb(0, 0, 153);">        size[2] = 90;</span><br style="color: rgb(0, 0, 153);"><span style="color: rgb(0, 0, 153);">
m_TriangleMeshToImage-&gt;SetSize(size);</span><br style="color: rgb(0, 0, 153);"><br style="color: rgb(0, 0, 153);"><span style="color: rgb(0, 0, 153);">        float orgn[3];</span><br style="color: rgb(0, 0, 153);"><span style="color: rgb(0, 0, 153);">
        orgn[0] = 120;</span><br style="color: rgb(0, 0, 153);"><span style="color: rgb(0, 0, 153);">        orgn[1] = 120;</span><br style="color: rgb(0, 0, 153);"><span style="color: rgb(0, 0, 153);">        orgn[2] = 120;</span><br style="color: rgb(0, 0, 153);">
<span style="color: rgb(0, 0, 153);">m_TriangleMeshToImage-&gt;SetOrigin(orgn);</span><br style="color: rgb(0, 0, 153);"><br style="color: rgb(0, 0, 153);"><span style="color: rgb(0, 0, 153);">        // spacing remains (1,1,1) until we make a change to deformable model class
</span><br style="color: rgb(0, 0, 153);"><span style="color: rgb(0, 0, 153);">        float spacing[3];</span><br style="color: rgb(0, 0, 153);"><span style="color: rgb(0, 0, 153);">        spacing[0] = 1;</span><br style="color: rgb(0, 0, 153);">
<span style="color: rgb(0, 0, 153);">        spacing[1] = 1;</span><br style="color: rgb(0, 0, 153);"><span style="color: rgb(0, 0, 153);">        spacing[2] = 1;</span><br style="color: rgb(0, 0, 153);"><br style="color: rgb(0, 0, 153);">
<span style="color: rgb(0, 0, 153);">m_TriangleMeshToImage-&gt;SetSpacing(spacing);</span><br style="color: rgb(0, 0, 153);"><br style="color: rgb(0, 0, 153);"><span style="color: rgb(0, 0, 153);">m_TriangleMeshToImage-&gt;Update();
<br><br></span></div><span style="color: rgb(0, 0, 0);">However, when I change the input mesh to itk::mesh as the following code, runtime exception occurred in the itkprocessobject.<br><br>&nbsp; </span><span style="color: rgb(0, 0, 153);">
typedef itk::DefaultDynamicMeshTraits&lt;double, 3, 3,double,double&gt; TriangleMeshTraits;</span><br style="color: rgb(0, 0, 153);">
<span style="color: rgb(0, 0, 153);">&nbsp;&nbsp;typedef itk::Mesh&lt;double,3, TriangleMeshTraits&gt; TriangleMeshType; </span><span style="color: rgb(0, 0, 153);"></span><br style="color: rgb(0, 0, 153);">
<span style="color: rgb(0, 0, 153);">&nbsp;&nbsp;typedef itk::Image&lt;unsigned char, 3&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;MeshPixelType;</span><br style="color: rgb(0, 0, 153);">
<span style="color: rgb(0, 0, 153);">&nbsp;&nbsp;typedef itk::TriangleMeshToBinaryImageFilter&lt;TriangleMeshType, MeshPixelType&gt; TriangleMeshToBinaryImageFilterType;</span><br style="color: rgb(0, 0, 153);">
<br style="color: rgb(0, 0, 153);">
<span style="color: rgb(0, 0, 153);">&nbsp; TriangleMeshToBinaryImageFilterType::Pointer m_TriangleMeshToImage = TriangleMeshToBinaryImageFilterType::New();<br>&nbsp; TriangleMeshType::Pointer m_TriangleMesh = </span><span style="color: rgb(0, 0, 153);">
TriangleMeshType::New()</span><span style="color: rgb(0, 0, 153);">; //Mesh in triangle<br>&nbsp; ..................................<br>&nbsp; .................................<br>&nbsp;(The code to add point and triangle cell into the mesh)
<br>&nbsp;.................................<br>&nbsp;................................... <br></span><span style="color: rgb(0, 0, 153);">m_TriangleMeshToImage-&gt;SetInput(m_TriangleMesh);<br><br></span><span style="color: rgb(0, 0, 153);">
&nbsp; </span><span style="color: rgb(0, 0, 153);">MeshPixelType::SizeType size;</span><br style="color: rgb(0, 0, 153);">
<br style="color: rgb(0, 0, 153);">
<span style="color: rgb(0, 0, 153);">        size[0] = 90;</span><br style="color: rgb(0, 0, 153);">
<span style="color: rgb(0, 0, 153);">        size[1] = 90;</span><br style="color: rgb(0, 0, 153);">
<span style="color: rgb(0, 0, 153);">        size[2] = 90;</span><br style="color: rgb(0, 0, 153);">
<span style="color: rgb(0, 0, 153);">m_TriangleMeshToImage-&gt;SetSize(size);</span><br style="color: rgb(0, 0, 153);">
<br style="color: rgb(0, 0, 153);">
<span style="color: rgb(0, 0, 153);">        float orgn[3];</span><br style="color: rgb(0, 0, 153);">
<span style="color: rgb(0, 0, 153);">        orgn[0] = 120;</span><br style="color: rgb(0, 0, 153);">
<span style="color: rgb(0, 0, 153);">        orgn[1] = 120;</span><br style="color: rgb(0, 0, 153);">
<span style="color: rgb(0, 0, 153);">        orgn[2] = 120;</span><br style="color: rgb(0, 0, 153);">
<span style="color: rgb(0, 0, 153);">m_TriangleMeshToImage-&gt;SetOrigin(orgn);</span><br style="color: rgb(0, 0, 153);">
<br style="color: rgb(0, 0, 153);">
<span style="color: rgb(0, 0, 153);">        // spacing remains (1,1,1) until we make a change to deformable model class</span><br style="color: rgb(0, 0, 153);">
<span style="color: rgb(0, 0, 153);">        float spacing[3];</span><br style="color: rgb(0, 0, 153);">
<span style="color: rgb(0, 0, 153);">        spacing[0] = 1;</span><br style="color: rgb(0, 0, 153);">
<span style="color: rgb(0, 0, 153);">        spacing[1] = 1;</span><br style="color: rgb(0, 0, 153);">
<span style="color: rgb(0, 0, 153);">        spacing[2] = 1;</span><br style="color: rgb(0, 0, 153);">
<br style="color: rgb(0, 0, 153);">
<span style="color: rgb(0, 0, 153);">m_TriangleMeshToImage-&gt;SetSpacing(spacing);</span><br style="color: rgb(0, 0, 153);">
<br style="color: rgb(0, 0, 153);">
<span style="color: rgb(0, 0, 153);">m_TriangleMeshToImage-&gt;Update();<br><br><span style="color: rgb(0, 0, 0);">In case there is error in creating the mesh, I have output the mesh in meta file, and checked. No problems found. 
<br>Any ideas? Thanks.<br><br>Tim,<br></span></span><span style="color: rgb(0, 0, 153);"></span>