<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<unsigned char, 3> 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<MeshType,</span><span style="font-family:courier new,monospace">VisualizingImageType> 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->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->SetInput(mesh);</span><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace"> meshFilter->Update();</span><br style="font-family:courier new,monospace">
<span style="font-family:courier new,monospace"> mask=meshFilter->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<</span><span style="font-family:courier new,monospace">VisualizingImageType> 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->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->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->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-></span><span style="font-family:courier new,monospace">SetInformationInput(conv-></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->SetStencil(voxelizer-</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->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<</span><span style="font-family:courier new,monospace">VisualizingImageType> 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->SetInput(stencil-></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->Update();</span><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace"> mask=conv2->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>