Convert image to ND2 format¶
Functions for converting images are not part of the base limnd2 namespace, but are instead accessible through the limnd2.tools namespace.
In order to use functions and classes described on this page, import them like this:
Summary¶
- convert_file_to_nd2: Convert an image to ND2.
- convert_file_to_nd2_cli: Convert an image to ND2 format with CLI arguments (for CLI usage).
- convert_file_to_nd2_args: Convert an image to ND2 format with CLI arguments (for usage in Python scripts).
Function documentation¶
convert_file_to_nd2 ¶
convert_file_to_nd2(input_path: str | Path | LimImageSource, output_path: str | Path, extra_dim_type: str = 'multipoint')
Converts an input file or LimImageSource to ND2 format and writes it to the specified output path.
You can specify the extra dimension type for parsing, such as "multipoint", "timeloop", or "zstack", this
is useful for multipage TIFF files.
| PARAMETER | DESCRIPTION |
|---|---|
input_path
|
Path to the input file or a LimImageSource object to be converted.
TYPE:
|
output_path
|
Path where the resulting ND2 file will be saved, if not provided, the input file name will be used with .nd2 extension.
TYPE:
|
extra_dim_type
|
Type of extra dimension to parse, for example with multipage TIFF file, must be one of
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
Path
|
Path to the written ND2 file. |
| RAISES | DESCRIPTION |
|---|---|
ValueError
|
If the input_path is not a valid file path or LimImageSource object. |
Examples:
convert_file_to_nd2_cli ¶
Converts a file to ND2 format using command line arguments for usage in CLI (returns exit code).
Command line arguments should be provided as a list of strings. The specific arguments and their usage are described in the CLI version of this tool: CLI Convert image tool
| PARAMETER | DESCRIPTION |
|---|---|
args
|
List of command line arguments. If None, uses sys.argv.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
None
|
Exits the program with exit code 0 if successful, or 1 if an error occurred. |
convert_file_to_nd2_args ¶
Converts a file to ND2 format using command line arguments for usage in Python (returns the output path).
Command line arguments should be provided as a list of strings. The specific arguments and their usage are described in the CLI version of this tool: CLI Convert image tool
| PARAMETER | DESCRIPTION |
|---|---|
args
|
List of command line arguments. If None, uses sys.argv.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
Path
|
Path to the converted ND2 file. |