source: trunk/src/find_imadoc.m @ 1152

Last change on this file since 1152 was 1152, checked in by sommeria, 5 months ago

update_xml simlified, bug on civ_series corrected

File size: 1.8 KB
Line 
1% 'find_imadoc': find the ImaDoc xml file associated with a given input file
2% take into account the old conventions
3%-----------------------------------------------------------------------
4% function XmlFileName=find_imadoc(RootPath,SubDir)
5%
6% OUTPUT:
7% XmlFileName: name of the xml file, ='' if none is found
8%
9% INPUT:
10% RootPath: path to the folder containing the image series,
11% SubDir: name of the folder containing the image series
12
13%=======================================================================
14% Copyright 2008-2024, LEGI UMR 5519 / CNRS UGA G-INP, Grenoble, France
15%   http://www.legi.grenoble-inp.fr
16%   Joel.Sommeria - Joel.Sommeria (A) univ-grenoble-alpes.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 XmlFileName=find_imadoc(RootPath,SubDir)
32
33dotchar=regexp(SubDir,'\.');%detect the dots in the folder name
34if isempty(dotchar)
35    XmlFileName=fullfile(RootPath,[SubDir '.xml']);
36else %go upward to the root name, stop if an xml file already exists
37    for idot=1:numel(dotchar)
38        SubDir=SubDir(1:dotchar(end-idot+1)-1);
39        XmlFileName=fullfile(RootPath,[SubDir '.xml']);
40        if exist(XmlFileName,'file')
41            break
42        end
43    end
44end
45if ~exist(XmlFileName,'file')
46    XmlFileName='';
47end
48
49
50
Note: See TracBrowser for help on using the repository browser.