<font><font face="verdana,sans-serif">Hi guys,<br><br>I hope you can help me with this. I have the following </font></font><font><font face="verdana,sans-serif">implementation of</font></font> <font><font face="verdana,sans-serif">voxelization using ITK<br>

<span style="font-family:courier new,monospace">typedef itk::Image&lt;unsigned char, 3&gt; VisualizingImageType;<br>VisualizingImageType::Pointer Vertebra::getMask()</span><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">{</span><br style="font-family:courier new,monospace">

<span style="font-family:courier new,monospace">    MeshType::Pointer mesh=qe2itkMesh(qe);</span><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">    typedef itk::</span><span style="font-family:courier new,monospace">TriangleMeshToBinaryImageFilte</span><span style="font-family:courier new,monospace">r&lt;MeshType,</span><span style="font-family:courier new,monospace">VisualizingImageType&gt; MeshFilterType;</span><br style="font-family:courier new,monospace">

<span style="font-family:courier new,monospace">
    MeshFilterType::Pointer meshFilter = MeshFilterType::New();</span><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">    meshFilter-&gt;SetInfoImage(</span><span style="font-family:courier new,monospace">logic.visualizing);</span><br style="font-family:courier new,monospace">

<span style="font-family:courier new,monospace">    meshFilter-&gt;SetInput(mesh);</span><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">    meshFilter-&gt;Update();</span><br style="font-family:courier new,monospace">

<span style="font-family:courier new,monospace">    mask=meshFilter-&gt;GetOutput();</span><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">
    return mask;</span><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">}</span><br><br>Since there is a <a href="https://itk.icts.uiowa.edu/jira/browse/ITK-2882">bug</a> in </font></font><font><font face="verdana,sans-serif">TriangleMeshToBinaryImageFilter, I created the following implementation using VTK voxelization method:</font></font><font><font face="verdana,sans-serif"><br>

<span style="font-family:courier new,monospace">VisualizingImageType::Pointer Vertebra::getMask()</span><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">{</span><br style="font-family:courier new,monospace">

<span style="font-family:courier new,monospace">    typedef itk::ImageToVTKImageFilter&lt;</span><span style="font-family:courier new,monospace">VisualizingImageType&gt; itkVtkConverter;</span><br style="font-family:courier new,monospace">

<span style="font-family:courier new,monospace">    itkVtkConverter::Pointer conv=itkVtkConverter::New();</span><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">
    conv-&gt;SetInput(logic.</span><span style="font-family:courier new,monospace">visualizing);</span><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">    conv-&gt;Update();</span><br style="font-family:courier new,monospace">

<br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">    vtkImageStencil *stencil=vtkImageStencil::New(</span><span style="font-family:courier new,monospace">);</span><br style="font-family:courier new,monospace">

<span style="font-family:courier new,monospace">    vtkPolyDataToImageStencil *voxelizer=</span><span style="font-family:courier new,monospace">vtkPolyDataToImageStencil::</span><span style="font-family:courier new,monospace">New();</span><br style="font-family:courier new,monospace">

<span style="font-family:courier new,monospace">    voxelizer-&gt;SetInput(qe2vtk(qe)</span><span style="font-family:courier new,monospace">); </span><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">
    voxelizer-&gt;</span><span style="font-family:courier new,monospace">SetInformationInput(conv-&gt;</span><span style="font-family:courier new,monospace">GetOutput());</span><br style="font-family:courier new,monospace">

<span style="font-family:courier new,monospace">    stencil-&gt;SetStencil(voxelizer-</span><span style="font-family:courier new,monospace">&gt;GetOutput());</span><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">    stencil-&gt;Update();</span><br style="font-family:courier new,monospace">

<span style="font-family:courier new,monospace">    </span><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">    typedef itk::VTKImageToImageFilter&lt;</span><span style="font-family:courier new,monospace">VisualizingImageType&gt; vtk2itkConverter;</span><br style="font-family:courier new,monospace">

<span style="font-family:courier new,monospace">
    vtk2itkConverter::Pointer conv2=vtk2itkConverter::New();</span><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">    conv2-&gt;SetInput(stencil-&gt;</span><span style="font-family:courier new,monospace">GetOutput());</span><br style="font-family:courier new,monospace">

<span style="font-family:courier new,monospace">    conv2-&gt;Update();</span><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">    mask=conv2-&gt;GetOutput();</span><br style="font-family:courier new,monospace">

<span style="font-family:courier new,monospace">    return mask;</span><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">}</span><br style="font-family:courier new,monospace"><br>

However this alternative implementation causes 2 errors. The first one:<br><span style="font-family:courier new,monospace">ERROR: In vtkDemandDrivenPipeline.cxx, line 727</span><br style="font-family:courier new,monospace">

<span style="font-family:courier new,monospace">vtkStreamingDemandDrivenPipeline (00000000321AEB50): Input port 0 of algorithm vtkImageStencil(0000000003947240) has 0 connections but is not optional.</span><br><br>and the second one:<br>

<span style="font-family:courier new,monospace">d:\sdk\itk4\modules\bridge\vtk\include\itkVTKImageImport.hxx:251:</span><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">itk::ERROR: VTKImageToImageFilter(000000000394CF50): Input scalar type is double but should be unsigned char</span><br>

<br>What am I doing wrong?<br><br>Regards,<br>Dženan<br></font></font>