Try changing <div><br></div><div><span class="Apple-style-span" style="background-color: rgb(255, 255, 255); ">"</span><span class="Apple-style-span" style="font-family: arial, sans-serif; font-size: 13px; background-color: rgb(255, 255, 255); ">typedef itk::ImageFileWriter< InputImageType::ConstPointer > WriterType;"</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>"<span class="Apple-style-span" style="font-size: 13px; background-color: rgb(255, 255, 255); ">typedef itk::ImageFileWriter< InputImageType > WriterType;"</span><br>
</font><br><div class="gmail_quote">On Wed, Aug 10, 2011 at 12:53 PM, David Brayford <span dir="ltr"><<a href="mailto:dbrayford@gmail.com">dbrayford@gmail.com</a>></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< InputPixelType, Dimension > InputImageType;<br>
typedef itk::Image< OutputPixelType, Dimension > OutputImageType;<br>
<br>
InputImageType::ConstPointer imagePtr;<br>
<br>
vtkImageData * vol = data->GetVolume()->getImageData();<br>
<br>
typedef itk::VTKImageToImageFilter<InputImageType> VTKToITKConnector;<br>
VTKToITKConnector::Pointer VTK_to_ITK_filter = VTKToITKConnector::New();<br>
<br>
VTK_to_ITK_filter->SetInput(vol);<br>
VTK_to_ITK_filter->Update();<br>
<br>
imagePtr = VTK_to_ITK_filter->GetOutput();<br>
<br>
typedef itk::ResampleImageFilter<InputImageType, InputImageType > FilterType;<br>
FilterType::Pointer filter = FilterType::New();<br>
filter->SetInput( imagePtr );<br>
filter->SetDefaultPixelValue( 0 );<br>
<br>
typedef itk::CastImageFilter< InputImageType, InputImageType > CastFilterType;<br>
CastFilterType::Pointer caster = CastFilterType::New();<br>
caster->SetInput( filter->GetOutput() );<br>
<br>
// Write the output<br>
typedef itk::ImageFileWriter< InputImageType::ConstPointer > WriterType;<br>
WriterType::Pointer writer = WriterType::New();<br>
<br>
// problem "itk::image<type, type>" is incompatible with type<br>
"const itk::image<type, type>"<br>
writer->SetInput( caster->GetOutput() );<br>
<br>
<br>
writer->SetFileName("output_volume.mhd");<br>
writer->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>