Skip to content

Command line tool for slicing image into channel dimension #39

@YooSunYoung

Description

@YooSunYoung

Requirement

We would like to have a command line interface that can be used like this:

scitiff_values input_tiff_with_multi_channel.tiff /path/to/output_tiff_only_with_intensities_channel.tiff

Expected Input

Any tiff file including scitiff flie that has multiple channel (variances and mask).

Expected Output

A new Scitiff file that does not have extra channel other than values(intentisites) of the input file.

  • INFO if the image is already single channel and do nothing.
  • INFO about the result if succeeded.

About the Project

Scitiff stands for scientific tiff.

It aims to encode scientific metadata as a plain text along with the image data in tiff.

See our scitiff documentation for more details.

Development Environment

See Developer Guide to set up the local environment.

Setting up a remote repository

Go to the base branch, channel-slicer, and fork the repo.

TODO list of this issue

  • Complete the implementation of the values API.

    def values():
    """
    Slice channel dimension from image.
    """
    import argparse
    from ._img_processors import values # noqa: F401
    parser = argparse.ArgumentParser(
    description="Quickly show metadata of a tiff file."
    )
    parser.add_argument(type=str, dest="input_file_name", help="Input file name.")
    parser.add_argument(type=str, dest="output_file_name", help="Output file name.")

    It should probably use python `values` API:
    https://github.com/scipp/scitiff/blob/bea312571bbcfc9d6c3609d8f1ecbf3c408c42a3/src/scitiff/_img_processors.py#L9-L11
    
  • Expose the executables values api as a command line interface.

    scitiff/pyproject.toml

    Lines 48 to 52 in f765344

    [project.scripts]
    scitiff-dev-dump-schemas = "scitiff._schema:dump_schemas"
    scitiff-dump-metadata-example = "scitiff.executables:dump_metadata_example"
    scitiff-show-metadata = "scitiff.executables:print_metadata"

    See how other scripts are exposed and add scitiff_values command there!

  • Write documentation page. Under user-guide, Could be a separate sub-issue

  • Write unit tests. Could be a separate sub-issue

    # SPDX-License-Identifier: BSD-3-Clause
    # Copyright (c) 2025 Ess-dmsc-dram contributors (https://github.com/ess-dmsc-dram)
    # Placeholder for `values` api, that slices `Value` channels.

    Writing unit test for this command line interface might be challenging. We can skip it from this issue.
    
  • Test with ImageJ (Optional)

  • Open a PR (Pull Request)

    Set the base branch to channel-slicer.

Related Information for Implementation

Scipp User Guide for Slicing

https://scipp.github.io/user-guide/slicing.html

We are going to learn more about scipp on Wednesday, so no need to dig in too deep 😁

IO module documentation

IO Helper Tutorial
Good starting point to see what scitiff do and to see what helper functions there are for development.

Meaning of Channel in Scitiff

This section of IO tutorial explains what channels mean in scitiff.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

Status

Triage

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions