| 1 | % translate logical indices i1, j1, into file name and frame index in a set of multimage files (e.g. from PCO camera) |
|---|
| 2 | %------------------------------------------------------------------------ |
|---|
| 3 | % [RootFile,FrameIndex]=index2filename(FileSeries,i1,j1,NbField_j) |
|---|
| 4 | % |
|---|
| 5 | % OUTPUT: |
|---|
| 6 | % FileName: name of the multimage file = [RootFile FileIndexString FileExt] |
|---|
| 7 | % FrameIndex: index in the multimage file FileName |
|---|
| 8 | % |
|---|
| 9 | % INPUT: |
|---|
| 10 | % FileSeries: structure read from the xml file, defining the multifile organisation of images |
|---|
| 11 | % i1: global frame index i, or single concatenated index vector (then no 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 [FileName,FrameIndex]=index2filename(FileSeries,i1,j1,NbField_j) |
|---|
| 34 | FileName=''; |
|---|
| 35 | % FileIndexString=''; |
|---|
| 36 | FrameIndex=1; |
|---|
| 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 |
|---|
| 45 | end |
|---|
| 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 |
|---|
| 57 | FrameIndex=mod(i_vector-1,FileSeries.NbFramePerFile)+1; |
|---|
| 58 | end |
|---|
| 59 | |
|---|
| 60 | |
|---|
| 61 | |
|---|