# Convert .nii.gz warp to .h5 (with proper header)

**URL:** https://discourse.itk.org/t/convert-nii-gz-warp-to-h5-with-proper-header/6673
**Category:** Beginner Questions
**Tags:** itk, registration
**Created:** [June 5, 2024, 3:37pm UTC](https://discourse.itk.org/t/convert-nii-gz-warp-to-h5-with-proper-header/6673 "2024-06-05T15:37:44Z")
**Posts on this page:** 1
**Showing post:** 4

<div class="post-metadata">

### Author: ![smeisler](https://discourse.itk.org/user_avatar/discourse.itk.org/smeisler/32/4106_2.png) [@smeisler](https://discourse.itk.org/u/smeisler)
#### Post date: [June 5, 2024, 5:26pm UTC](https://discourse.itk.org/t/convert-nii-gz-warp-to-h5-with-proper-header/6673/4 "2024-06-05T17:26:45Z")

</div>

Hi @dzenanz, thanks for responding!

Just to make sure, do you mean something like:

```auto
import SimpleITK as sitk
import nibabel as nib

# Load nifti warp
img = nib.load(nifti_file)
data = img.get_fdata()

# Define and save ITK warp
displacement_image = sitk.GetImageFromArray(data, isVector=True)
tx = sitk.DisplacementFieldTransform(displacement_image)
sitk.WriteTransform(tx, "out_warp.h5");

```

Best,  
Steven

---

_[View the full topic](https://discourse.itk.org/t/convert-nii-gz-warp-to-h5-with-proper-header/6673)._
