| 1 | |
|---|
| 2 | %'get_file_index': determine the frame indexes from ref indices and pair option for civ |
|---|
| 3 | % [i1,i2,j1,j2] = get_file_index(ref_i,ref_j,PairString) |
|---|
| 4 | %------------------------------------------------------------------------ |
|---|
| 5 | % OUTPUT: |
|---|
| 6 | % i1,i2,j1,j2: frem indices i and j for image 1 and 2 |
|---|
| 7 | % |
|---|
| 8 | % INPUT: |
|---|
| 9 | % ref_i,ref_j: reference indices set in the GUI series |
|---|
| 10 | % PairString: string defining the choice of pairing: 'Di=..','Dj=..','-' |
|---|
| 11 | |
|---|
| 12 | %===================================================================== |
|---|
| 13 | % Copyright 2008-2024, LEGI UMR 5519 / CNRS UGA G-INP, Grenoble, France |
|---|
| 14 | % http://www.legi.grenoble-inp.fr |
|---|
| 15 | % Joel.Sommeria - Joel.Sommeria (A) univ-grenoble-alpes.fr |
|---|
| 16 | % |
|---|
| 17 | % This file is part of the toolbox UVMAT. |
|---|
| 18 | % |
|---|
| 19 | % UVMAT is free software; you can redistribute it and/or modify |
|---|
| 20 | % it under the terms of the GNU General Public License as published |
|---|
| 21 | % by the Free Software Foundation; either version 2 of the license, |
|---|
| 22 | % or (at your option) any later version. |
|---|
| 23 | % |
|---|
| 24 | % UVMAT is distributed in the hope that it will be useful, |
|---|
| 25 | % but WITHOUT ANY WARRANTY; without even the implied warranty of |
|---|
| 26 | % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|---|
| 27 | % GNU General Public License (see LICENSE.txt) for more details. |
|---|
| 28 | %======================================================================= |
|---|
| 29 | |
|---|
| 30 | function [i1,i2,j1,j2] = get_file_index(ref_i,ref_j,PairString) |
|---|
| 31 | %get the first file name set by the GUI series |
|---|
| 32 | |
|---|
| 33 | if iscell(PairString) |
|---|
| 34 | PairString=PairString{1}; |
|---|
| 35 | end |
|---|
| 36 | i1=ref_i; |
|---|
| 37 | j1=ref_j; |
|---|
| 38 | i2=ref_i; |
|---|
| 39 | j2=ref_j; |
|---|
| 40 | % case of pairs |
|---|
| 41 | if ~isempty(PairString) |
|---|
| 42 | r=regexp(PairString,'(?<mode>(Di=)|(Dj=)) -*(?<num1>\d+)\|(?<num2>\d+)','names'); |
|---|
| 43 | if isempty(r) |
|---|
| 44 | r=regexp(PairString,'(?<num1>\d+)(?<mode>-)(?<num2>\d+)','names'); |
|---|
| 45 | end |
|---|
| 46 | switch r.mode |
|---|
| 47 | case 'Di=' % case 'series(Di)') |
|---|
| 48 | i1=ref_i-str2double(r.num1); |
|---|
| 49 | i2=ref_i+str2double(r.num2); |
|---|
| 50 | case 'Dj=' % case 'series(Dj)' |
|---|
| 51 | j1=ref_j-str2double(r.num1); |
|---|
| 52 | j2=ref_j+str2double(r.num2); |
|---|
| 53 | case '-' % case 'bursts' |
|---|
| 54 | j1=str2double(r.num1)*ones(size(ref_i)); |
|---|
| 55 | j2=str2double(r.num2)*ones(size(ref_i)); |
|---|
| 56 | end |
|---|
| 57 | end |
|---|
| 58 | |
|---|
| 59 | |
|---|
| 60 | |
|---|
| 61 | |
|---|
| 62 | |
|---|