| [469] | 1 | % 'find_imadoc': find the ImaDoc xml file associated with a given input file |
|---|
| 2 | % take into account the old conventions |
|---|
| 3 | %----------------------------------------------------------------------- |
|---|
| [1191] | 4 | % function {[XmlFileName,Rank]=find_imadoc(RootPath,SubDir) |
|---|
| [469] | 5 | % |
|---|
| 6 | % OUTPUT: |
|---|
| [1191] | 7 | % XmlFileName: name of the xml file, if the SubDir has suffixes marked with |
|---|
| 8 | % '.', take the first one going backward, ='' isf no xml file is found |
|---|
| 9 | % Rank: = nbre of suffixes in SubDir |
|---|
| [469] | 10 | % |
|---|
| 11 | % INPUT: |
|---|
| [1152] | 12 | % RootPath: path to the folder containing the image series, |
|---|
| 13 | % SubDir: name of the folder containing the image series |
|---|
| [809] | 14 | |
|---|
| 15 | %======================================================================= |
|---|
| [1126] | 16 | % Copyright 2008-2024, LEGI UMR 5519 / CNRS UGA G-INP, Grenoble, France |
|---|
| [809] | 17 | % http://www.legi.grenoble-inp.fr |
|---|
| [1127] | 18 | % Joel.Sommeria - Joel.Sommeria (A) univ-grenoble-alpes.fr |
|---|
| [809] | 19 | % |
|---|
| 20 | % This file is part of the toolbox UVMAT. |
|---|
| 21 | % |
|---|
| 22 | % UVMAT is free software; you can redistribute it and/or modify |
|---|
| 23 | % it under the terms of the GNU General Public License as published |
|---|
| 24 | % by the Free Software Foundation; either version 2 of the license, |
|---|
| 25 | % or (at your option) any later version. |
|---|
| 26 | % |
|---|
| 27 | % UVMAT is distributed in the hope that it will be useful, |
|---|
| 28 | % but WITHOUT ANY WARRANTY; without even the implied warranty of |
|---|
| 29 | % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|---|
| 30 | % GNU General Public License (see LICENSE.txt) for more details. |
|---|
| 31 | %======================================================================= |
|---|
| 32 | |
|---|
| [1191] | 33 | function [XmlFileName,Rank]=find_imadoc(RootPath,SubDir) |
|---|
| [1156] | 34 | XmlFileName=fullfile(RootPath,[SubDir '.xml']); |
|---|
| [1191] | 35 | Rank=0; |
|---|
| [1156] | 36 | if ~exist(XmlFileName,'file') |
|---|
| 37 | dotchar=regexp(SubDir,'\.');%detect the dots in the folder name |
|---|
| 38 | if ~isempty(dotchar) |
|---|
| 39 | for idot=1:numel(dotchar) |
|---|
| 40 | SubDir=SubDir(1:dotchar(end-idot+1)-1); |
|---|
| 41 | XmlFileName=fullfile(RootPath,[SubDir '.xml']); |
|---|
| 42 | if exist(XmlFileName,'file') |
|---|
| [1191] | 43 | Rank=idot; |
|---|
| 44 | break % take the root name after removing all the dot suffixes |
|---|
| [1156] | 45 | end |
|---|
| [672] | 46 | end |
|---|
| [1152] | 47 | end |
|---|
| [1156] | 48 | if ~exist(XmlFileName,'file') |
|---|
| 49 | XmlFileName=''; |
|---|
| 50 | end |
|---|
| [672] | 51 | end |
|---|
| [1152] | 52 | |
|---|
| 53 | |
|---|
| 54 | |
|---|
| [1156] | 55 | |
|---|