You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: imPowerDiagram.m
    path of file: ./repos/matImage/matImage/imShapes
    
    the code of the file until where you have to start completion: function img = imPowerDiagram(varargin)
%IMPOWERDIAGRAM Power diagramm of a set of points
%
%   imPowerDiagram(DIM, POINTS, RADII) specify the points to use as germs.
%       POINTS is a N*2 array of double containing positions of germs, and
%       RADII a N*1 array containing radius of each circle.

    
function img = imPowerDiagram(varargin)
%IMPOWERDIAGRAM Power diagramm of a set of points
%
%   imPowerDiagram(DIM, POINTS, RADII) specify the points to use as germs.
%       POINTS is a N*2 array of double containing positions of germs, and
%       RADII a N*1 array containing radius of each circle.
%
%   imPowerDiagram(DIM, POINTS, RADII, EDGE) Alsoi specify edge condition.
%       EDGE can be one of 'free', 'periodic', 'remove'.
%
%   IMG = imPowerDiagram(LX, LY, ...);
%   Specifes the pixels coordinates with the two row vectors LX and LY.
%
%   This tesselation is also known as Laguerre model, or Radical Plane
%   model.
%
%   See also :
%     imShapes, imvoronoi2d, imvoronoi3d, imAWVoronoi
%
%
%   Bibliography :
%
%   Serguei Zuyev
%   Poisson Power Tesselation,
%   INRIA Research Report RR-2303
%   http://citeseer.nj.nec.com/zuyev94poisson.html/zuyev94poisson.html
%

%   ---------
%   author : David Legland 
%   INRA - TPV URPOI - BIA IMASTE
%   created the 19/05/2004.
%

%   HISTORY
%   2009/03/04 switch coordinate to comply with (x,y,z) of germs

% ---------------------------------------------
% extract input arguments

points      = [];       % points array
radius      = [];       % radii of circles
N           = 20;       % default number of germs
edgecond    = 'free';   % edge condition
conn        = 4;        % 4-connectivity by default in dimension 2

% compute coordinate of image voxels
[lx, ly, varargin] = parseGridArgs(varargin{:});

% extraction of points, or number of points
if ~isempty(varargin)
    var = varargin{1};

    if length(var)>1    % use an array of germs
        points = var;
    else                % get number of germs
        N = var;
    end