Try changing <div><br></div><div><span class="Apple-style-span" style="background-color: rgb(255, 255, 255); ">&quot;</span><span class="Apple-style-span" style="font-family: arial, sans-serif; font-size: 13px; background-color: rgb(255, 255, 255); ">typedef itk::ImageFileWriter&lt; InputImageType::ConstPointer &gt; WriterType;&quot;</span></div>
<div><font class="Apple-style-span" face="arial, sans-serif"><br></font></div><div><font class="Apple-style-span" face="arial, sans-serif">to <br><br>&quot;<span class="Apple-style-span" style="font-size: 13px; background-color: rgb(255, 255, 255); ">typedef itk::ImageFileWriter&lt; InputImageType &gt; WriterType;&quot;</span><br>
</font><br><div class="gmail_quote">On Wed, Aug 10, 2011 at 12:53 PM, David Brayford <span dir="ltr">&lt;<a href="mailto:dbrayford@gmail.com">dbrayford@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
Hi,<br>
<br>
I am trying to write out a 3D volume in ITK that is loaded in from<br>
VTK. However, I am having trouble with conversion errors from const<br>
even after looking at some examples.<br>
<br>
        typedef itk::Image&lt; InputPixelType,  Dimension &gt;   InputImageType;<br>
        typedef itk::Image&lt; OutputPixelType, Dimension &gt;   OutputImageType;<br>
<br>
        InputImageType::ConstPointer imagePtr;<br>
<br>
        vtkImageData * vol = data-&gt;GetVolume()-&gt;getImageData();<br>
<br>
        typedef itk::VTKImageToImageFilter&lt;InputImageType&gt; VTKToITKConnector;<br>
    VTKToITKConnector::Pointer VTK_to_ITK_filter = VTKToITKConnector::New();<br>
<br>
    VTK_to_ITK_filter-&gt;SetInput(vol);<br>
    VTK_to_ITK_filter-&gt;Update();<br>
<br>
        imagePtr = VTK_to_ITK_filter-&gt;GetOutput();<br>
<br>
        typedef itk::ResampleImageFilter&lt;InputImageType, InputImageType &gt; FilterType;<br>
        FilterType::Pointer filter = FilterType::New();<br>
        filter-&gt;SetInput( imagePtr );<br>
        filter-&gt;SetDefaultPixelValue( 0 );<br>
<br>
        typedef itk::CastImageFilter&lt; InputImageType, InputImageType &gt; CastFilterType;<br>
        CastFilterType::Pointer caster = CastFilterType::New();<br>
        caster-&gt;SetInput( filter-&gt;GetOutput() );<br>
<br>
         // Write the output<br>
         typedef itk::ImageFileWriter&lt; InputImageType::ConstPointer &gt; WriterType;<br>
         WriterType::Pointer writer = WriterType::New();<br>
<br>
         // problem &quot;itk::image&lt;type, type&gt;&quot; is incompatible with type<br>
&quot;const itk::image&lt;type, type&gt;&quot;<br>
         writer-&gt;SetInput( caster-&gt;GetOutput() );<br>
<br>
<br>
         writer-&gt;SetFileName(&quot;output_volume.mhd&quot;);<br>
         writer-&gt;Update();<br>
_____________________________________<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at<br>
<a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Kitware offers ITK Training Courses, for more information visit:<br>
<a href="http://www.kitware.com/products/protraining.html" target="_blank">http://www.kitware.com/products/protraining.html</a><br>
<br>
Please keep messages on-topic and check the ITK FAQ at:<br>
<a href="http://www.itk.org/Wiki/ITK_FAQ" target="_blank">http://www.itk.org/Wiki/ITK_FAQ</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://www.itk.org/mailman/listinfo/insight-users" target="_blank">http://www.itk.org/mailman/listinfo/insight-users</a><br>
</blockquote></div><br></div>