% KV-Lib Toolbox for MATLAB 7.x 
% Version 2.8, Apr 2008
%==========================================================================
%
% This toolbox is based on generic Image Manipulation and Pattern
% Recognition functions.    
% 
% For more details, please contact:
%  Dr K. Veropoulos, k_veropoulos@freemail.gr
%
%==========================================================================
%
% Table of Contents
% -----------------
% Generic Library (genlib)
% Input/Output Library (IOlib)
% Digital Signal Processing Library (DSPlib)
% Graphical User Interface Library (GUIlib)
% Image Manipulation Library (imglib)
% Pattern Recognition Library (PRlib) for Classification
% Pattern Recognition Library (PRlib) for Verification/Identification
% Mass Spectral Library (MSlib) for management of NIST MS library files
%	(R14SP2 and above only)
% The Facial Recognition Technology (FERET) Database Library (FERETlib)
%
%==========================================================================
%
% Generic Library (genlib):
%   cellfind             - find a string within a cell array of strings.
%   cellremdupl          - find and remove duplicate elements in a cell array of strings.
%   datanorm, datanorm2  - data normalization functions.
%   dirr                 - list all files in the current directory and subdirectories recursively.
%   f2cell               - file to cell array conversion.   
%   fica                 - find in character array.
%   getIDpos             - get the substring in a filename that represents the subject's ID.
%   hmsetime             - elapsed time in days, hours, minutes, seconds 
%   loadascii            - load an ascii file and save the contents in a matrix (for stand-alone programming).
%   mat2vec              - convert a matrix to a vector.
%   repstr               - replicates and tiles a character or string (works in a similar way to 'repmat'). 
%   sa_exist_ff          - 'exist' function for stand-alone programming.
%   saveascii            - save the contents of a matrix in an ascii file (for stand-alone programming).
%   showinfowindow       - creates a small dialog window which displays a user-defined message. Like MATLAB's msgbox but without an OK button.
%   shuffle2             - randomize a 2d matrix.
%   str2mat2             - convert one row string array into multi-row string array.
%   str2num2             - convert a string matrix to numeric array.
%   TFDBMS               - Text File Database Management System GUI-based application.
%   timebar              - a Matlab waitbar compatible replacement that is faster and more functional.
%   vec2mat              - convert a vector to matrix.
%   workbar              - graphically monitor progress of calculations.
%
% Input/Output Library (IOlib):
%   parsecsvline  - parses a line from a CSV (comma separated value) file and returns a cell array containing all the values in the line separated by a user-defined delimeter.
%
% Digital Signal Processing Library (DSPlib):
%   detpeaks       - detect peaks from a given input signal.
%   findPeakEdges  - find peak endpoints.
%   integral       - input signal integration. 
%   PeakArea       - peak integration.
%   fwhm           - compute full width at half maxima of a peak.
%   RAFFT          - spectrum alignment of spectral data to a reference.
%   rec_smooth1Da  - recursive 1-D smoothing.
%   remNoise       - noise removal.
%   smooth1Da      - 1-D smoothing.
%
% Graphical User Interface Library (GUIlib):
%   about            - 'about' dialog box with graphical logo and author information.
%   allowaxestogrow  - grow and reset a subplot that is selected by the mouse.
%   alttoolbar       - replaces default toolbar in a figure with an alternative version.
%   Busy             - sets the watch cursor for a figure.
%   Idle             - sets the arrow cursor for a figure.
%   formattable      - formats header and column data and displays it in a listbox.
%   ginput2          - graphical input from mouse with extras.
%   logindlg         - dialog for visually secure login.
%   maximize         - maximize a window.
%   plot_lines       - plot vertical lines at points defined on the x-axis.
%  strwrap           - creates a multiline string based on a specified width.
%   titlewrap        - places a multiline title above current axis.
%   uitoolfact       - create built-in toolbar components.
%   interactivemouse - Interactive exploration of figures using a mouse.
%   zumax            - creates new window with a copy of a specified axis.
%   setWinOnTop      - sets a figure's Always On Top state on or off.
%
% Image Manipulation Library (imglib):
%   inorm      - normalize an image (in terms of rotation/translation/scale) based on a template of given points (at least 3 points needed).
%   iread      - read image from graphics file (simplified code based on Matlab's 'imread' function).
%   iresize    - resize an image of any type using the specified interpolation method (simplified code based on Matlab's 'imresize' function).
%   vec2img    - convert a vector to an image of the given image class and dimensions.
%   IDBMS      - Image DataBase Management System GUI-based application.
%   Itrain     - Image-based pattern recognition training GUI demo tool (makes use of IDBMS data structures).
%   Iclassify  - Image-based pattern classification GUI demo tool (makes use of IDBMS data structures).
%
% Pattern Recognition Library (PRlib) for Classification:
%   cca          - perform canonical correlation analysis.
%   KCCA         - compute Kernel CCA transformation vectors.
%   kcca2        - apply Kernel CCA transformation.
%   kernel_mat   - compute the kernel matrix of two given sets. 
%   knn          - perform k-Nearest Neighbor Classifier.
%   SV_knn       - perform kNN on support vectors only. 
%   lda          - Linear Discriminant Analysis.
%   mindist      - Minimum Distance Classifier.
%   Normalize    - normalize samples to energy 1.
%   Scale        - scale samples to a range, such as [-1 1].
%   Scale2       - scale all the samples to a range, such as [-1 1] based on the minimum and maximum values of another data set scaled using 'Scale'.
%   kNormalize   - normalize and center a kernel matrix.
%   pcas         - perform principal components analysis. 
%   kpca1        - compute Kernel PCA transformation vectors. 
%   kpca2        - apply Kernel PCA transformation.
%   PCAtk        - PCA Toolkit GUI demo tool.
%   svmtrain     - libSVM's (v2.81) Support Vector Machine training function.
%   svmpredict   - libSVM's (v2.81) Support Vector Machine prediction function. 
%   csvm_opt     - perform optimized C-SVM training (hyperparameter grid-search).
%   csvm_fs      - perform optimized C-SVM training (hyperparameter grid-search) with feature selection.
%   percentres   - converts a confusion matrix between actual and expected target to percentage rates.
%   res2str      - puts classification results into a character array (string).
%   results      - computes the confusion matrix between actual and expected targets.
%
% Pattern Recognition Library (PRlib) for Verification/Identification:
%   calcCMCs     - Cumulative Match Curves (CMCs) for given gallery and query sets.
%   calcROCs     - Receiver Operating Characteristic Curves (ROCs) for given gallery and query sets.
%   find_avgerr  - compute error statistics from results of calcROCs function.
%   PerfTable    - matching process that returns the ROC curve, confusion matrix anf FID table. 
%   RankTable    - CMC curve as computed after a matching process has been completed.
%
% Mass Spectral Library (MSlib) for management of NIST MS library files
%	ReadMSLib       - Read a MSP, SDF, CSV or MAT-file formatted MS library into a Matlab variable.
%   WriteMSLib      - Write a Matlab structured variable containing MS info into a MSP, SDF, CSV or MAT-file formatted file.
%   ShowLibContent  - Simple interface to display the contents of a MS or Target Compound reference library.
%	MSLibMan        - (MS Library Manager). Import/export MS info from and to MSP, SDF, CSV, MAT-file or Matlab variables.
%   MSscore         - (MS similarity score). Compute Mass Spectra similarities between two spectra.
%   getTCData       - (get Target Compound Data). Identifies and extracts a single target compound in a given sample.
%   TCid_quant      - (Target Compound identify and quantify). Identifies and quantifies a set of target compounds in a given sample.
%   MSLibMatch      - (MS Library Matching). Compute Mass Spectral similarities between a single spectrum and spectra stored in a library file.
%
% The Facial Recognition Technology (FERET) Database Library (FERETlib):
%   calcfaces         - compute the number of images per face.
%   shuffle_persons   - shuffle images by person (for partitioning a set with multiple images per person).
%   shuffle2_persons  - same as 'shuffle_persons' (different format of input data).
%   partsize          - compute partition size when partitioning a set by person.
%
%
%==========================================================================
% Author: 
% K. Veropoulos (verop@unr.edu, k_veropoulos@freemail.gr)
% for the 
% - Computer Science & Engineering Dept., University of Nevada Reno (UNR).
% - Division of Atmospheric Sciences, Desert Research Institute Reno, NV.
%
