<div>Felix,</div>
<div> </div>
<div>I don't believe that png supports spacing in the header. tiff might, but maybe we aren't writing the spacing. Can you file a bug following the procedure in:</div>
<div> </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> </div>
<div>Thanks,</div>
<div> </div>
<div>Bill<br></div>
<div class="gmail_quote">On Jan 24, 2008 10:49 AM, Felix Bollenbeck <<a href="mailto:bollen@ipk-gatersleben.de">bollen@ipk-gatersleben.de</a>> 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'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> resample->SetOutputSpacing(fixedImage->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> resample->SetSize( fixedImage->GetLargestPossibleRegion().GetSize() );<br> resample->SetOutputOrigin(fixedImage->GetOrigin());<br> resample->SetOutputSpacing(fixedImage->GetSpacing());<br>
resample->SetDefaultPixelValue(0);<br> resample->Update();<br><br>//#############<br> const SpacingType outSpacing = resample->GetOutputSpacing();<br> std::cout <<"SIZE spacing-out " << outSpacing[0]<< " " <<<br>
outSpacing[1] << std::endl;<br>//#############<br><br><br> typedef unsigned char OutputPixelType;<br> typedef itk::Image< OutputPixelType, Dimension > OutputImageType;<br> typedef itk::CastImageFilter< FixedImageType,OutputImageType ><br>
CastFilterType;<br> typedef itk::ImageFileWriter< OutputImageType > WriterType;<br><br><br> WriterType::Pointer writer = WriterType::New();<br> CastFilterType::Pointer caster = CastFilterType::New();<br> writer->SetFileName(outImageName);<br>
caster->SetInput(resample->GetOutput());<br> writer->SetInput(caster->GetOutput());<br> writer->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>