% Dimensionality Reduction: Appending multiple images
%   varargin: List of images to append. Default "append"-dimension is 4
%   in other words: 3 dimensional images will be cat to a 4 Dimensional
%   image; two 4 Dimensional images will also be cat to a 4 Dimensional
%   image.
%
% Behavior can be changed be changing dimToCat
classdef janis_fs_append < janis_fs

   properties
      % human readable name
      name = 'Append';
      % Dimension, which is the reference for the append
      dimToCat = 4
   end

   methods
       % constructs from multiple images a single one, were the immages
       % were appended according to the specified dimension
       function img = reduce(fs,varargin)
           if nargin > 1
               if ~isnumeric(varargin{1})
                   throw(MException('janis:WrongImageFormat','Wrong image format for this method'));
               else
                   img = varargin{1};
                   if nargin > 2
                        for count = 2:size(varargin,2)
                           img = cat(fs.dimToCat, img, varargin{count});
                        end
                   end
               end
           else
              img = [];
              warning('janis:emptyImg','Image was empty!');
           end
       end
   end

end