class_docstr: A medpy header object.
  
  Stores spacing, offset/origin, direction, and possibly further meta information.
  Provide at least one of the parameters. Missing information is extracted from
  the ``sitkimage`` or, if not supplied, set to a default value. 
  
  Parameters
  ----------
  spacing : tuple of floats
      the image's voxel spacing
      defaults to a tuple of `1.0`s
  offset : tuple of floats
      the image's offset/origin
      defaults to a tuple of `0.0`s
  direction : ndarray
      the image's affine transformation matrix
      must be of square shape
      default to the identity matrix
  sitkimage : sitk.Image
      the simple itk image as loaded
class_docstr_tok: ["A","medpy","header","object",".","Stores","spacing",",","offset\/origin",",","direction",",","and","possibly","further","meta","information",".","Provide","at","least","one","of","the","parameters",".","Missing","information","is","extracted","from","the","``","sitkimage","``","or",",","if","not","supplied",",","set","to","a","default","value",".","Parameters","--","--","--","--","--","spacing",":","tuple","of","floats","the","image","'s","voxel","spacing","defaults","to","a","tuple","of","`","1.0","`","s","offset",":","tuple","of","floats","the","image","'s","offset\/origin","defaults","to","a","tuple","of","`","0.0","`","s","direction",":","ndarray","the","image","'s","affine","transformation","matrix","must","be","of","square","shape","default","to","the","identity","matrix","sitkimage",":","sitk.Image","the","simple","itk","image","as","loaded"]
docstr: Copy all stored meta information info to an sitk Image.
  
  Note that only the spacing and the offset/origin information
  are guaranteed to be preserved, although the method also
  tries to copy other meta information such as DICOM tags.
  
  Parameters
  ----------
  sitkimage : sitk.Image
      the sitk Image object to which to copy the information
  
  Returns
  -------
  sitkimage : sitk.Image
      the passed sitk Image object
docstr_tok: ["Copy","all","stored","meta","information","info","to","an","sitk","Image",".","Note","that","only","the","spacing","and","the","offset\/origin","information","are","guaranteed","to","be","preserved",",","although","the","method","also","tries","to","copy","other","meta","information","such","as","DICOM","tags",".","Parameters","--","--","--","--","--","sitkimage",":","sitk.Image","the","sitk","Image","object","to","which","to","copy","the","information","Returns","--","--","--","-","sitkimage",":","sitk.Image","the","passed","sitk","Image","object"]
code: def copy_to(self, sitkimage):
      """
      Copy all stored meta information info to an sitk Image.
  
      Note that only the spacing and the offset/origin information
      are guaranteed to be preserved, although the method also
      tries to copy other meta information such as DICOM tags.
  
      Parameters
      ----------
      sitkimage : sitk.Image
          the sitk Image object to which to copy the information
  
      Returns
      -------
      sitkimage : sitk.Image
          the passed sitk Image object
      """
      if self.sitkimage is not None:
          for k in self.sitkimage.GetMetaDataKeys():
              sitkimage.SetMetaData(k, self.sitkimage.GetMetaData(k))
  
      ndim = len(sitkimage.GetSize())
      spacing, offset, direction = self.get_info_consistent(ndim)
  
      sitkimage.SetSpacing(spacing)
      sitkimage.SetOrigin(offset)
      sitkimage.SetDirection(tuple(direction.flatten()))
  
      return sitkimage
  
imports: import warnings
  import numpy
  from ..core import Logger
label_desc: Use image node_id 2 for calling the Header obj's underlying member method code with example usage: obj.copy_to(sitkimage) and returns: sitkimage