source: trunk/src/index2filename.m @ 1179

Last change on this file since 1179 was 1178, checked in by sommeria, 4 weeks ago

virtual frame indexing introduced

File size: 2.2 KB
RevLine 
[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
33function [RootFile,FileIndexString,FrameIndex]=index2filename(FileSeries,i1,j1,NbField_j)
34RootFile='';
35FileIndexString='';
36FrameIndex=1;
37if 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
42else
43    i_vector=i1;% frames labelled with a single concatenated index vector
44end
45
46switch 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;
55end
56
57
Note: See TracBrowser for help on using the repository browser.