# Extracting displacement fields from rigid registration

**URL:** <https://discourse.itk.org/t/extracting-displacement-fields-from-rigid-registration/4834>\
**Category:** Beginner Questions\
**Tags:** itkv5, registration, python\
**Created:** [February 25, 2022, 11:03pm UTC](https://discourse.itk.org/t/extracting-displacement-fields-from-rigid-registration/4834 "2022-02-25T23:03:39Z")\
**Posts on this page:** 1\
**Showing post:** 9

<div class="post-metadata">

**Author:** ![edgar](https://discourse.itk.org/letter_avatar_proxy/v4/letter/e/b487fb/32.png) [@edgar](https://discourse.itk.org/u/edgar)\
**Post date:** [April 13, 2022, 10:47am UTC](https://discourse.itk.org/t/extracting-displacement-fields-from-rigid-registration/4834/9 "2022-04-13T10:47:36Z")

</div>

Thank you, Dženan. I initially got this error:

```
RuntimeError: /pkg/insight-toolkit/src/insight-toolkit/Modules/Core/Common/src/itkProcessObject.cxx:1339:
ITK ERROR: TransformToDisplacementFieldFilter(0x55578b3cac50): Input Transform is required but not set.

```

Then, I used this instead:

```
displ_filt.SetTransform(registr_transform)
displ_filt.Update()
displ_field_out = displ_filt.GetOutput()

```

To save to a file, I naïvely used [this](https://discourse.itk.org/t/problem-in-getting-displacement-field/3127):

```
displ_writer = itk.ImageFileWriter.New(
    Input=displ_field_out, FileName=displ_field_vtk)
displ_writer.Update()

```

that produces:

```
RuntimeError: /pkg/insight-toolkit/src/insight-toolkit/Modules/IO/ImageBase/include/itkImageFileWriter.hxx:245:
ITK ERROR: ImageFileWriter(0x555788553d50): Largest possible region does not fully contain requested paste IO regionPaste IO region: ImageIORegion (0x7ffd35280600)
  Dimension: 3
  Index: 0 0 0
  Size: 0 0 0
Largest possible region: ImageRegion (0x7ffd35280760)
  Dimension: 3
  Index: [0, 0, 0]
  Size: [0, 0, 0]

```

I tried other approaches, but I’m sure that expanding on my mistakes is of no use 😛 . How do I save the results? (is what I did to get them the right way?). Thank you again 🙂 .

---

_[View the full topic](https://discourse.itk.org/t/extracting-displacement-fields-from-rigid-registration/4834)._
