source: trunk/src/nomtype2pair.m @ 879

Last change on this file since 879 was 809, checked in by g7moreau, 10 years ago
  • Add license
File size: 1.8 KB
Line 
1%'nomtype2pair': creates nomenclature for index pairs knowing the image nomenclature, used by series fct
2%---------------------------------------------------------------------
3% NomTypeOut=nomtype2pair(NomTypeIn)
4%---------------------------------------------------------------------           
5% OUTPUT:
6% NomTypeOut: file index nomenclature for pairs
7%---------------------------------------------------------------------
8% INPUT:
9% NomTypeIn: file index nomenclature for images
10%
11% for definitions of file index nomenclature, see fct fullfile_uvmat
12
13%=======================================================================
14% Copyright 2008-2014, LEGI UMR 5519 / CNRS UJF G-INP, Grenoble, France
15%   http://www.legi.grenoble-inp.fr
16%   Joel.Sommeria - Joel.Sommeria (A) legi.cnrs.fr
17%
18%     This file is part of the toolbox UVMAT.
19%
20%     UVMAT is free software; you can redistribute it and/or modify
21%     it under the terms of the GNU General Public License as published
22%     by the Free Software Foundation; either version 2 of the license,
23%     or (at your option) any later version.
24%
25%     UVMAT is distributed in the hope that it will be useful,
26%     but WITHOUT ANY WARRANTY; without even the implied warranty of
27%     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
28%     GNU General Public License (see LICENSE.txt) for more details.
29%=======================================================================
30
31function NomTypeOut=nomtype2pair(NomTypeIn)
32
33if ~isempty(regexp(NomTypeIn,'a$'))
34    NomTypeOut=[NomTypeIn 'b'];
35elseif ~isempty(regexp(NomTypeIn,'A$'))
36    NomTypeOut=[NomTypeIn 'B'];
37else
38    r=regexp(NomTypeIn,'(?<num1>\d+)_(?<num2>\d+)$','names');
39    % case of a single input index (no j)
40    if isempty(r)
41        NomTypeOut='_1-2';
42    else  % case of two indices i,j, separated by '_'
43        NomTypeOut='_1-2_1-2';
44    end
45end
Note: See TracBrowser for help on using the repository browser.