Skip to content

Commit f9375c5

Browse files
authoredMar 19, 2025··
Rework docstring
1 parent 1b222d0 commit f9375c5

File tree

1 file changed

+19
-20
lines changed

1 file changed

+19
-20
lines changed
 

‎src/imcflibs/imagej/misc.py

+19-20
Original file line numberDiff line numberDiff line change
@@ -521,46 +521,45 @@ def save_image_with_extension(
521521
imp : ij.ImagePlus
522522
ImagePlus object to save.
523523
extension : {'ImageJ-TIF', 'ICS-1', 'ICS-2', 'OME-TIFF', 'CellH5', 'BMP'}
524-
Output format to use:
525-
- ImageJ-TIF: Saves as ImageJ TIFF format (.tif)
526-
- ICS-1: Saves as ICS version 1 format (.ids)
527-
- ICS-2: Saves as ICS version 2 format (.ics)
528-
- OME-TIFF: Saves as OME-TIFF format (.ome.tif)
529-
- CellH5: Saves as CellH5 format (.ch5)
530-
- BMP: Saves as BMP format (one file per slice)
524+
Output format to use, see Notes section below for details.
531525
out_dir : str
532526
Directory path where the image(s) will be saved.
533527
series : int
534528
Series number to append to the filename.
535529
pad_number : int
536530
Number of digits to use when zero-padding the series number.
537531
split_channels : bool
538-
If True, splits channels and saves them individually in separate folders
539-
named "C1", "C2", etc. inside out_dir. If False, saves all channels in a
532+
If True, split channels and save them individually in separate folders
533+
named "C1", "C2", etc. inside out_dir. If False, save all channels in a
540534
single file.
541535
542536
Notes
543537
-----
544-
- For "ImageJ-TIF" format, uses IJ.saveAs function
545-
- For "BMP" format, saves images using StackWriter.save with one BMP file
546-
per slice in a subfolder named after the original image
547-
- For all other formats, uses Bio-Formats exporter (bf.export)
548-
- The original ImagePlus is not modified, but any duplicate images created
549-
for channel splitting are closed after saving
550-
- Metadata is preserved when using Bio-Formats exporters
538+
Depending on the value of the `extension` parameter, one of the following
539+
output formats and saving strategies will be used:
540+
- Bio-Formats based formats will be produced by calling `bf.export()`, note
541+
that these formats will preserve metadata (which is **not** the case for
542+
the other formats using different saving strategies):
543+
- `ICS-1`: Save as ICS version 1 format (a pair of `.ics` and `.ids`).
544+
- `ICS-2`: Save as ICS version 2 format (single `.ics` file).
545+
- `OME-TIFF`: Save in OME-TIFF format (`.ome.tif`).
546+
- `CellH5`: Save as CellH5 format (`.ch5`).
547+
- `ImageJ-TIF`: Save in ImageJ TIFF format (`.tif`) using `IJ.saveAs()`.
548+
- `BMP`: Save in BMP format using `StackWriter.save()`, producing one `.bmp`
549+
per slice in a subfolder named after the original image.
551550
552551
Examples
553552
--------
554553
Save a multichannel image as OME-TIFF without splitting channels:
555554
556555
>>> save_image_with_extension(imp, "OME-TIFF", "/output/path", 1, 3, False)
557-
# Saves as: /output/path/image_title_series_001.ome.tif
556+
# resulting file: /output/path/image_title_series_001.ome.tif
558557
559-
Save with channels split:
558+
Save with channel splitting:
560559
561560
>>> save_image_with_extension(imp, "OME-TIFF", "/output/path", 1, 3, True)
562-
# Saves as: /output/path/C1/image_title_series_001.ome.tif
563-
# /output/path/C2/image_title_series_001.ome.tif
561+
# resulting files: /output/path/C1/image_title_series_001.ome.tif
562+
# /output/path/C2/image_title_series_001.ome.tif
564563
"""
565564

566565
out_ext = {}

0 commit comments

Comments
 (0)
Please sign in to comment.