source: trunk/src/find_imadoc.m @ 1152

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

update_xml simlified, bug on civ_series corrected

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