diff --git a/compute_unwarped_images.py b/compute_unwarped_images.py
index cd73bdfed22fc12d0593de0473617b959d2d8e41..592cc852b9d5852bc31dd827a5fe159e9810a166 100644
--- a/compute_unwarped_images.py
+++ b/compute_unwarped_images.py
@@ -2,10 +2,10 @@
 
 ################################################################################
 ###                                                                          ###
-### Created by Martin Genet, 2012-2016                               ###
+### Created by Martin Genet, 2012-2016                                       ###
 ###                                                                          ###
-### University of California at San Francisco (UCSF), USA            ###
-### Swiss Federal Institute of Technology (ETH), Zurich, Switzerland ###
+### University of California at San Francisco (UCSF), USA                    ###
+### Swiss Federal Institute of Technology (ETH), Zurich, Switzerland         ###
 ### École Polytechnique, Palaiseau, France                                   ###
 ###                                                                          ###
 ################################################################################
diff --git a/compute_warped_images.py b/compute_warped_images.py
index db65cd05f475aae8e3608828cb7ee34315befa6b..085354bebd203d9592af86afaa96d44dbc5af4f2 100644
--- a/compute_warped_images.py
+++ b/compute_warped_images.py
@@ -2,10 +2,10 @@
 
 ################################################################################
 ###                                                                          ###
-### Created by Martin Genet, 2012-2016                               ###
+### Created by Martin Genet, 2012-2016                                       ###
 ###                                                                          ###
-### University of California at San Francisco (UCSF), USA            ###
-### Swiss Federal Institute of Technology (ETH), Zurich, Switzerland ###
+### University of California at San Francisco (UCSF), USA                    ###
+### Swiss Federal Institute of Technology (ETH), Zurich, Switzerland         ###
 ### École Polytechnique, Palaiseau, France                                   ###
 ###                                                                          ###
 ################################################################################
@@ -27,6 +27,7 @@ def compute_warped_images(
         working_folder,
         working_basename,
         ref_frame=0,
+        ref_image_model=None,
         working_ext="vtu",
         verbose=0):
 
@@ -35,10 +36,11 @@ def compute_warped_images(
     ref_image = myvtk.readImage(
         filename=ref_image_filename)
 
-    interpolator = myvtk.getImageInterpolator(
-        image=ref_image)
-    #I = numpy.empty(1)
-    #interpolator.Interpolate([0.35, 0.25, 0.], I)
+    if (ref_image_model is None):
+        ref_image_interpolator = myvtk.getImageInterpolator(
+            image=ref_image)
+        #I = numpy.empty(1)
+        #ref_image_interpolator.Interpolate([0.35, 0.25, 0.], I)
 
     image = vtk.vtkImageData()
     image.SetOrigin(ref_image.GetOrigin())
@@ -102,7 +104,10 @@ def compute_warped_images(
                 image.GetPoint(k_point, x)
                 scalars_U.GetTuple(k_point, U)
                 X = x - U
-                interpolator.Interpolate(X, I)
+                if (ref_image_model is None):
+                    ref_image_interpolator.Interpolate(X, I)
+                else:
+                    I[0] = ref_image_model(X)
             scalars.SetTuple(k_point, I)
 
         myvtk.writeImage(