Align two volumes with different spacing and origin

I found out that Nifti reader sets the segmentation origin to 000. As far as I understand I have to get the origin from the Qform matrix (the last column) and set it directly to vtkImageData via SetOrigin. Is this correct? Anyway my segmentation is still located incorrectly.