• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

angelolab / tmi / 4106902596

pending completion
4106902596

Pull #20

github

GitHub
Merge 5de60795e into 9fb6cee18
Pull Request #20: GitHub Actions

294 of 306 branches covered (96.08%)

Branch coverage included in aggregate %.

1 of 1 new or added line in 1 file covered. (100.0%)

431 of 443 relevant lines covered (97.29%)

0.97 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

100.0
/src/tmi/image_utils.py
1
import pathlib
1✔
2
from typing import Dict, Union
1✔
3

4
import numpy as np
1✔
5
import skimage.io as io
1✔
6

7

8
def save_image(
1✔
9
    fname: Union[str, pathlib.Path], data: np.ndarray, compression_level: int = 6
10
) -> None:
11
    """
12
    A thin wrapper around `skimage.io.imsave()`.
13

14
    Args:
15
        fname (str): The location to save the tiff file.
16
        data (np.ndarray): The Numpy array to save.
17
        compression_level (int, optional): The compression level for skimage.io.imsave. Increasing
18
            `compress` increases memory consumption, decreases compression speed and moderately
19
            increases compression ratio. The range of compress is `[1,9]`. Defaults to 6.
20
    """
21
    # Compression Config:
22
    plugin_args: Dict[str, Union[str, int, Dict]] = {
1✔
23
        "compression": "zlib",
24
        "compressionargs": {"level": compression_level},
25
    }
26

27
    io.imsave(fname=fname, arr=data, plugin="tifffile", check_contrast=False, **plugin_args)
1✔
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc