source: trunk/src/find_imadoc.m @ 1156

Last change on this file since 1156 was 1156, checked in by sommeria, 3 months ago

bugs repaired

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)
32XmlFileName=fullfile(RootPath,[SubDir '.xml']);
33if ~exist(XmlFileName,'file')
34    dotchar=regexp(SubDir,'\.');%detect the dots in the folder name
35    if ~isempty(dotchar)
36        for idot=1:numel(dotchar)
37            SubDir=SubDir(1:dotchar(end-idot+1)-1);
38            XmlFileName=fullfile(RootPath,[SubDir '.xml']);
39            if exist(XmlFileName,'file')
40                break
41            end
42        end
43    end
44    if ~exist(XmlFileName,'file')
45        XmlFileName='';
46    end
47end
48
49
50
51
Note: See TracBrowser for help on using the repository browser.