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 | |
---|
31 | function XmlFileName=find_imadoc(RootPath,SubDir) |
---|
32 | |
---|
33 | dotchar=regexp(SubDir,'\.');%detect the dots in the folder name |
---|
34 | if isempty(dotchar) |
---|
35 | XmlFileName=fullfile(RootPath,[SubDir '.xml']); |
---|
36 | else %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 |
---|
44 | end |
---|
45 | if ~exist(XmlFileName,'file') |
---|
46 | XmlFileName=''; |
---|
47 | end |
---|
48 | |
---|
49 | |
---|
50 | |
---|