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

Boettcher, Dr. Peter Boettcher at kleintierklinik.uni-leipzig.de
Tue May 6 09:34:20 EDT 2008


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.

 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20080506/660b9a5e/attachment.htm>


More information about the Insight-users mailing list