Changeset 1152 for trunk/src/find_imadoc.m
- Timestamp:
- Jul 4, 2024, 4:23:43 PM (3 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/find_imadoc.m
r1127 r1152 2 2 % take into account the old conventions 3 3 %----------------------------------------------------------------------- 4 % function XmlFileName=find_imadoc(RootPath,SubDir ,RootFile,FileExt)4 % function XmlFileName=find_imadoc(RootPath,SubDir) 5 5 % 6 6 % OUTPUT: … … 8 8 % 9 9 % INPUT: 10 % RootPath,SubDir,RootFile,FileExt, as given from the input file name by fileparts_uvmat 10 % RootPath: path to the folder containing the image series, 11 % SubDir: name of the folder containing the image series 11 12 12 13 %======================================================================= … … 28 29 %======================================================================= 29 30 30 function XmlFileName=find_imadoc(RootPath,SubDir,RootFile,FileExt) 31 SubDirBase=SubDir; 32 XmlFileName=fullfile(RootPath,[SubDir '.xml']); 33 if ~exist (XmlFileName,'file') 34 dotchar=regexp(SubDir,'\.'); 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 35 37 for idot=1:numel(dotchar) 36 XmlFileName=fullfile(RootPath,[SubDir(1:dotchar(end-idot+1)-1) '.xml']); 38 SubDir=SubDir(1:dotchar(end-idot+1)-1); 39 XmlFileName=fullfile(RootPath,[SubDir '.xml']); 37 40 if exist(XmlFileName,'file') 38 SubDirBase=fullfile(RootPath,SubDir(1:dotchar(end-idot+1)-1));39 41 break 40 end41 end42 end43 if ~exist(XmlFileName,'file')44 XmlFileName=[fullfile(RootPath,SubDirBase,RootFile) '.xml']; % old convention: xml inside the image folder, case of images or new civ files45 if ~exist(XmlFileName,'file')46 XmlFileName=[fullfile(RootPath,SubDirBase,RootFile) '.civ']; % very old convention: .civ file47 if ~exist(XmlFileName,'file') && strcmp(FileExt,'.nc')48 XmlFileName=[fullfile(RootPath,RootFile) '.xml'] ; % old convention: xml inside the image folder, old civ file opened49 if ~exist(XmlFileName,'file')50 XmlFileName=[fullfile(RootPath,RootFile) '.civ']; % very old convention: .civ file51 end52 42 end 53 43 end 54 44 end 55 if ~exist(XmlFileName,'file')% convention Pierre Augier for 3D images 56 check3D=find(~isempty(regexp(SubDirBase,'^level'))); 57 if check3D 58 [RootRootPath,RootDir]=fileparts(RootPath); 59 XmlFileName=fullfile(RootRootPath,[RootDir '.xml']); 60 dotchar=regexp(RootDir,'\.'); 61 for idot=1:numel(dotchar) 62 XmlFileName=fullfile(RootRootPath,[RootDir(1:dotchar(end-idot+1)-1) '.xml']); 63 if exist(XmlFileName,'file') 64 break 65 end 66 end 67 end 68 end 69 if exist(XmlFileName,'file')~=2 45 if ~exist(XmlFileName,'file') 70 46 XmlFileName=''; 71 47 end 48 49 50
Note: See TracChangeset
for help on using the changeset viewer.