% Translation only motion, GPU
%
% A = Loktyushin(sz,trans,deriv,complex)
%
%
% (c) Alexander Loktyushin,     MPI for Biological Cybernetics, 2012

function A = matGPUmultitrans(sz, trans, image, y, masks, deriv, complex, np)

  %% general info
  A.np = np; A.y = y;
  
  A.ndims = numel(sz);                            % Are we doing 2d or 3d stuff?
  if A.ndims<2 || A.ndims>3, error('We support only 2d and 3d.'), end
  A.imsz = sz; sz = prod(A.imsz)*[1,1];
  if nargin<4, complex = 1; end, if numel(complex)==0, complex = 1; end
  if numel(complex)==1, complex = complex*[1,1]; end
  
  A.masks = masks;
  A.dkind = deriv;                  % 0 - no derivatives, 1 - all derivates

  %% translation
  A.trans = trans(:);
  
  %% Initialize GPU variables
  if isreal(image) 
    image = complex(image);
  end;
  
  status = feval('multitrans_gpu','initialize',trans(:),image(:),y,masks,A.imsz,np);
  
  %% construct matrix class, inherit from mat
  A = class(A,mfilename,mat(sz,complex));