[1178] | 1 | % get the file name and frame index from a set of multimage files (e.g. from PCO camera) |
---|
| 2 | %------------------------------------------------------------------------ |
---|
| 3 | % [RootFile,FileIndexString,FrameIndex]=index2filename(FileSeries,i1,j1,NbField_j) |
---|
| 4 | % |
---|
| 5 | % OUTPUT: |
---|
| 6 | % RootFile, FileIndexString: name of the multimage file = [RootFile FileIndexString FileExt] |
---|
| 7 | % FrameIndex: index in the multimage file |
---|
| 8 | % |
---|
| 9 | % INPUT: |
---|
| 10 | % FileSeries: structure read from the xml file, defining the the multifile organisation of images |
---|
| 11 | % i1: global frame index i, or single concatenated index vector (then no further input j1 and NbField_j |
---|
| 12 | % j1: j index |
---|
| 13 | % NbField_j: nbre of j indices in the index matrix |
---|
| 14 | |
---|
| 15 | %======================================================================= |
---|
| 16 | % Copyright 2008-2024, LEGI UMR 5519 / CNRS UGA G-INP, Grenoble, France |
---|
| 17 | % http://www.legi.grenoble-inp.fr |
---|
| 18 | % Joel.Sommeria - Joel.Sommeria (A) univ-grenoble-alpes.fr |
---|
| 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 | |
---|
[1180] | 33 | function [FileName,FrameIndex]=index2filename(FileSeries,i1,j1,NbField_j) |
---|
| 34 | FileName=''; |
---|
| 35 | % FileIndexString=''; |
---|
[1178] | 36 | FrameIndex=1; |
---|
[1180] | 37 | if isfield(FileSeries,'FileName') |
---|
| 38 | if exist('j1','var')&&~isnan(NbField_j) |
---|
| 39 | if isempty(j1) |
---|
| 40 | j1=1; |
---|
| 41 | end |
---|
| 42 | i_vector=(i1-1)*NbField_j+j1;%frames labeld with two indices i and j |
---|
| 43 | else |
---|
| 44 | i_vector=i1;% frames labelled with a single concatenated index vector |
---|
[1178] | 45 | end |
---|
[1180] | 46 | if ischar(FileSeries.FileName) |
---|
| 47 | FileSeries.FileName={FileSeries.FileName}; |
---|
| 48 | end |
---|
| 49 | [~,~,RootFile,i1,~,~,~,FileExt,NomType]=fileparts_uvmat(FileSeries.FileName{end}); |
---|
| 50 | FileIndex=floor((i_vector-1)/FileSeries.NbFramePerFile)+1; |
---|
| 51 | if FileIndex>numel(FileSeries.FileName) |
---|
| 52 | FileIndex=FileIndex-numel(FileSeries.FileName)+i1; |
---|
| 53 | FileName=fullfile_uvmat('','',RootFile,FileExt,NomType,FileIndex); |
---|
| 54 | else |
---|
| 55 | FileName=FileSeries.FileName{FileIndex}; |
---|
| 56 | end |
---|
[1178] | 57 | |
---|
[1180] | 58 | % switch FileSeries.Convention |
---|
| 59 | % case 'PCO' |
---|
| 60 | % RootFile=FileSeries.RootName; |
---|
| 61 | % FileIndex=floor(i_vector/FileSeries.NbFramePerFile); |
---|
| 62 | % if FileIndex>0 |
---|
| 63 | % RootFile=[RootFile '@']; |
---|
| 64 | % FileIndexString=num2str(FileIndex,'%04d'); |
---|
| 65 | % end |
---|
| 66 | FrameIndex=mod(i_vector-1,FileSeries.NbFramePerFile)+1; |
---|
[1178] | 67 | end |
---|
| 68 | |
---|
| 69 | |
---|
[1180] | 70 | |
---|