[Insight-users] loss of spacing and origin when feeding an itkImage to itkWriter

Peter Cech pcech at vision.ee.ethz.ch
Tue May 6 09:41:43 EDT 2008


Hi,

what file type is your written image?

Try also activate debugging output (DebugOn() on the writer), try also
getting some info from whatever object is returned by GetImageIO()
method, it might give some clues what's going on.

Regards,
Peter

On Tue, May 06, 2008 at 15:34:20 +0200, Boettcher, Dr. Peter wrote:
> I have problems feeding an itkImage to itkWriter. During that process the parameters image spacing and image origin are lost!
> 
>  
> 
> During my image pipeline I define image = caster->GetOutput().
> 
>  
> 
> caster2D->Update();
> 
> imageCastFix = caster2D->GetOutput();
> 
>  
> 
> Then I do some changes to the image spacing and origin:
> 
>  
> 
>   imageCastFix->SetOrigin(origin2D);
>   imageCastFix->SetSpacing(spacing2D);
>   imageCastFix->Modified();
> 
>  
> 
> Checking whether the changes were made 
> 
>  
> 
> imageCastFix->Print( std::cout );
> 
>  
> 
> ...
> 
> Spacing 0.576 0.576 0.576
> 
> Origin: -124.5 -124.5 -124.5
> 
> ...
> 
>  
> 
> Up to this point every thing works as I expected. The image spacing and origin I changes manually was assigned to the image.
> 
>  
> 
> However when I feed the modified image to an ImageWriter
> 
>  
> 
> writerFluo->SetInput( imageCastFix);
> 
> writerFluo ->Update();
> 
>  
> 
> The image file written onto my disk has an image spacing of 1 1 1 and origin 0 0 0.
> 
>  
> 
> Any idea why the parameters of my image are not passed to the image writer?
> 
> This effect is independent of the image file type I define.
> 
>  
> 
> Regards, Peter.
> 
>  

> _______________________________________________
> Insight-users mailing list
> Insight-users at itk.org
> http://www.itk.org/mailman/listinfo/insight-users



More information about the Insight-users mailing list