source: trunk/src/find_imadoc.m

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

bugs repaired

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)
[1156]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
[672]42        end
[1152]43    end
[1156]44    if ~exist(XmlFileName,'file')
45        XmlFileName='';
46    end
[672]47end
[1152]48
49
50
[1156]51
Note: See TracBrowser for help on using the repository browser.