@@ -424,12 +424,28 @@ def __init__(self, data_dir, pattern_a, pattern_b=None):
424424 the path where image files are located
425425
426426 pattern_a : str
427- a shell glob patter to match the first
428- frames.
427+ a shell glob pattern to match the first (A) frames.
429428
430429 pattern_b : str
431- a shell glob patter to match the second
432- frames. if None, then the list is sequential, 001.tif, 002.tif
430+ a shell glob pattern to match the second (B) frames.
431+
432+ Options:
433+ pattern_a = 'image_*_a.bmp'
434+ pattern_b = 'image_*_b.bmp'
435+
436+ or
437+ pattern_a = '000*.tif'
438+ pattern_b = '(1+2),(2+3)'
439+ will create PIV of these pairs: 0001.tif+0002.tif, 0002.tif+0003.tif ...
440+ or
441+ pattern_a = '000*.tif'
442+ pattern_b = '(1+3),(2+4)'
443+ will create PIV of these pairs: 0001.tif+0003.tif, 0002.tif+0004.tif ...
444+ or
445+ pattern_a = '000*.tif'
446+ pattern_b = '(1+2),(3+4)'
447+ will create PIV of these pairs: 0001.tif+0002.tif, 0003.tif+0004.tif ...
448+
433449
434450 Examples
435451 --------
@@ -442,9 +458,15 @@ def __init__(self, data_dir, pattern_a, pattern_b=None):
442458 glob .glob (os .path .join (os .path .abspath (data_dir ), pattern_a ))
443459 )
444460
445- if pattern_b is None :
461+ if pattern_b == '(1+2),(2+3)' :
446462 self .files_b = self .files_a [1 :]
447463 self .files_a = self .files_a [:- 1 ]
464+ elif pattern_b == '(1+3),(2+4)' :
465+ self .files_b = self .files_a [2 :]
466+ self .files_a = self .files_a [:- 2 ]
467+ elif pattern_b == '(1+2),(3+4)' :
468+ self .files_b = self .files_a [1 ::2 ]
469+ self .files_a = self .files_a [0 ::2 ]
448470 else :
449471 self .files_b = sorted (
450472 glob .glob (os .path .join (os .path .abspath (data_dir ), pattern_b ))
@@ -455,6 +477,9 @@ def __init__(self, data_dir, pattern_a, pattern_b=None):
455477
456478 # check if everything was fine
457479 if not len (self .files_a ) == len (self .files_b ):
480+ print (self .files_a )
481+ print (self .files_b )
482+
458483 raise ValueError (
459484 'Something failed loading the image file. There should be an equal number of "a" and "b" files.'
460485 )
0 commit comments