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 | |
---|
33 | function [RootFile,FileIndexString,FrameIndex]=index2filename(FileSeries,i1,j1,NbField_j) |
---|
34 | RootFile=''; |
---|
35 | FileIndexString=''; |
---|
36 | FrameIndex=1; |
---|
37 | if exist('j1','var') |
---|
38 | if isempty(j1) |
---|
39 | j1=1; |
---|
40 | end |
---|
41 | i_vector=(i1-1)*NbField_j+j1-1;%frames labeld with two indices i and j |
---|
42 | else |
---|
43 | i_vector=i1;% frames labelled with a single concatenated index vector |
---|
44 | end |
---|
45 | |
---|
46 | switch FileSeries.Convention |
---|
47 | case 'PCO' |
---|
48 | RootFile=FileSeries.RootName; |
---|
49 | FileIndex=floor(i_vector/FileSeries.NbFramePerFile); |
---|
50 | if FileIndex>0 |
---|
51 | RootFile=[RootFile '@']; |
---|
52 | FileIndexString=num2str(FileIndex,'%04d'); |
---|
53 | end |
---|
54 | FrameIndex=mod(i_vector,FileSeries.NbFramePerFile)+1; |
---|
55 | end |
---|
56 | |
---|
57 | |
---|