function inverse_points = get_inverse_warp(points, verbosity)
% GET_INVERSE_WARP: Gets the inverse CPS warp, given the original warp
%
%    GENERAL
%
%      points = get_inverse_warp(points)
%
%    INPUT/S
%
%      -points:
%           The points for CPS transformation
%           
%    OUTPUT/S
%
%      -points:
%           The points which represent the inverse
%
%    PENDING WORK
%
%      -
%
%    KNOWN BUG/S
%
%      -None.
%
%    COMMENT/S
%
%      -Thanks to Carole Twining for an interesting discussion from which the
%       more elegant solution arose.
%
%    RELATED FUNCTION/S
%
%      
%
%    ABOUT
%
%      -Created:     May 23rd, 2004
%      -Last update: May 23rd, 2004
%      -Revision:    0.0.2
%      -Author:      R. S. Schestowitz, University of Manchester
% ==============================================================


if (strcmp(verbosity, 'high')),
  figure;
  hold on;
  plot(points, 'r');
end

image_width = size(points, 2);

original_warp = [1:image_width];

original_warp = -1 + 2 * (original_warp - 1) / (image_width - 1);


for i = 1:image_width,
    inverse_points(i) = original_warp(i) - (points(i) - original_warp(i));
end

if (strcmp(verbosity, 'high')),
  plot(inverse_points, 'b');
  hold off;
end

% points = interp(-1:2 / image_width:1, points,