File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1724,46 +1724,3 @@ def fuse_dataset_bdvp(
17241724 "use_interpolation" ,
17251725 use_interpolation ,
17261726 ).get ()
1727-
1728-
1729- def join_files_with_channel_suffix (files , nchannels ):
1730- """Join filenames and append channel-suffixed copies.
1731-
1732- For each filename in ``files``, return a list where original filenames
1733- appear first followed by copies with suffixes ``_0`` .. ``_{n-2}``
1734- (inserted before the file extension). This is suitable for passing
1735- to Bioformats/Jython in ``show_list`` mode when each channel is stored
1736- as a separate file.
1737-
1738- Parameters
1739- ----------
1740- files : list or tuple
1741- List or tuple of filename strings.
1742- nchannels : int
1743- Number of channels (>=1). If ``nchannels`` is 1 no suffixed copies
1744- are added.
1745-
1746- Returns
1747- -------
1748- list of str
1749- Ordered list of filenames (originals then suffixed copies).
1750- """
1751- import os
1752-
1753- if not files :
1754- return ""
1755- try :
1756- x = range (int (nchannels ) - 1 )
1757- except Exception :
1758- x = [0 ]
1759- suff = "_" + str (x )
1760- out = []
1761- # keep original order, then add suffixed copies
1762- for f in files :
1763- out .append (f )
1764- for i in x :
1765- suff = "_" + str (i )
1766- for f in files :
1767- base , ext = os .path .splitext (f )
1768- out .append (base + suff + ext )
1769- return out
Original file line number Diff line number Diff line change @@ -385,3 +385,46 @@ def create_directory(new_path):
385385 exists = jython_fiji_exists
386386else :
387387 exists = os .path .exists
388+
389+
390+ def join_files_with_channel_suffix (files , nchannels ):
391+ """Join filenames and append channel-suffixed copies.
392+
393+ For each filename in `files`, return a list where original filenames
394+ appear first followed by copies with suffixes `_0` .. `_{n-2}`
395+ (inserted before the file extension). This is suitable for passing
396+ to Bioformats/Jython in ``show_list`` mode when each channel is stored
397+ as a separate file.
398+
399+ Parameters
400+ ----------
401+ files : list or tuple
402+ List or tuple of filename strings.
403+ nchannels : int
404+ Number of channels (>=1). If ``nchannels`` is 1 no suffixed copies
405+ are added.
406+
407+ Returns
408+ -------
409+ list of str
410+ Ordered list of filenames (originals then suffixed copies).
411+ """
412+ import os
413+
414+ if not files :
415+ return ""
416+ try :
417+ x = range (int (nchannels ) - 1 )
418+ except Exception :
419+ x = [0 ]
420+ suff = "_" + str (x )
421+ out = []
422+ # Keep original order, then add suffixed copies
423+ for f in files :
424+ out .append (f )
425+ for i in x :
426+ suff = "_" + str (i )
427+ for f in files :
428+ base , ext = os .path .splitext (f )
429+ out .append (base + suff + ext )
430+ return out
You can’t perform that action at this time.
0 commit comments