<div>Felix,</div>
<div>&nbsp;</div>
<div>I don&#39;t believe that png supports spacing in the header. tiff might, but maybe we aren&#39;t writing the spacing. Can you file a bug following the procedure in:</div>
<div>&nbsp;</div>
<div><a href="http://www.itk.org/Wiki/ITK_Procedure_for_Contributing_Bug_Fixes">http://www.itk.org/Wiki/ITK_Procedure_for_Contributing_Bug_Fixes</a></div>
<div>&nbsp;</div>
<div>Thanks,</div>
<div>&nbsp;</div>
<div>Bill<br></div>
<div class="gmail_quote">On Jan 24, 2008 10:49 AM, Felix Bollenbeck &lt;<a href="mailto:bollen@ipk-gatersleben.de">bollen@ipk-gatersleben.de</a>&gt; wrote:<br>
<blockquote class="gmail_quote" style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid">Hi ITK Users!<br><br>I&#39;m having troubles writing the spacing to a transformed image.<br>Although the resampler gets the input-image spacing, the written image<br>
which is read in the next iteration has the default [1 1] spacing<br>causing troubles.<br><br>The images are written to tiff files and haven an initial spacing of<br>.37... after transformation and writing, i read files with [1 1]<br>
spacing, although<br><br>&nbsp;resample-&gt;SetOutputSpacing(fixedImage-&gt;GetSpacing());<br><br>and fixed image has [.37 .37]!<br><br>I have tried png files too, in case this is a TIF specific issue same-so<br>I conclude it is my mistake here, but where?<br>
<br>Thanks for your help,<br><br>Felix.<br><br><br><br><br><br><br>&nbsp;resample-&gt;SetSize( &nbsp; &nbsp;fixedImage-&gt;GetLargestPossibleRegion().GetSize() );<br>&nbsp;resample-&gt;SetOutputOrigin(fixedImage-&gt;GetOrigin());<br>&nbsp;resample-&gt;SetOutputSpacing(fixedImage-&gt;GetSpacing());<br>
&nbsp;resample-&gt;SetDefaultPixelValue(0);<br>&nbsp;resample-&gt;Update();<br><br>//#############<br>&nbsp;const SpacingType outSpacing = resample-&gt;GetOutputSpacing();<br>&nbsp;std::cout &lt;&lt;&quot;SIZE spacing-out &nbsp;&quot; &lt;&lt; outSpacing[0]&lt;&lt; &quot; &nbsp; &nbsp;&quot; &lt;&lt;<br>
outSpacing[1] &lt;&lt; std::endl;<br>//#############<br><br><br>&nbsp;typedef &nbsp;unsigned char &nbsp;OutputPixelType;<br>&nbsp;typedef itk::Image&lt; OutputPixelType, Dimension &gt; OutputImageType;<br>&nbsp;typedef itk::CastImageFilter&lt; FixedImageType,OutputImageType &gt;<br>
CastFilterType;<br>&nbsp;typedef itk::ImageFileWriter&lt; OutputImageType &gt; &nbsp;WriterType;<br><br><br>&nbsp;WriterType::Pointer &nbsp; &nbsp; &nbsp;writer = &nbsp;WriterType::New();<br>&nbsp;CastFilterType::Pointer &nbsp;caster = &nbsp;CastFilterType::New();<br>&nbsp;writer-&gt;SetFileName(outImageName);<br>
&nbsp;caster-&gt;SetInput(resample-&gt;GetOutput());<br>&nbsp;writer-&gt;SetInput(caster-&gt;GetOutput());<br>&nbsp;writer-&gt;Update();<br>_______________________________________________<br>Insight-users mailing list<br><a href="mailto:Insight-users@itk.org">Insight-users@itk.org</a><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>