Extracting displacement fields from rigid registration

Great, thanks. Paraphrasing from the docs:

This method can be used to specify an image from which to copy the [output information (SetOutputSpacing, Origin, and Direction)]. UseReferenceImageOn must be set

So I did:

displ_filt = itk.TransformToDisplacementFieldFilter[
    itk.Image[itk.Vector[itk.F, 3], 3], itk.D].New()
displ_filt.SetTransform(registr_transform)
displ_filt.SetReferenceImage(fixed_image)
displ_filt.UseReferenceImageOn()
displ_filt.Update()
displ_field_out = displ_filt.GetOutput()

and

itk.imwrite(displ_field_out, displ_field_vtk)

It runs well now :slight_smile: .

The (VTK) output shows up in ParaView as a block with the size of my fixed_image, completely full of little glyphs in the same direction. This makes me think that I will have to do this with a moving window (an area smaller than the full image) whose position I will move iteratively to get the displacements at each point, correct? This is possibly what @matt.mccormick was trying to say:

1 Like