Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
135 changes: 72 additions & 63 deletions src/imcflibs/imagej/bdv.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,8 @@

Select the angle(s) to use for the operation, by default empty (`""`).

NOTE: this value will be used to render `angles=[use Angle VALUE]` when calling
the `fmt_use_acitt()` method.
NOTE: this value will be used to render `angles=[use Angle VALUE]` when
calling the `fmt_use_acitt()` method.

Parameters
----------
Expand All @@ -127,11 +127,11 @@
def reference_channel(self, value):
"""Set the reference channel when using *Expert Grouping Options*.

Select the channel(s) to use for the operation, by default the averaging mode
will be used (`channels=[Average Channels]`).
Select the channel(s) to use for the operation, by default the averaging
mode will be used (`channels=[Average Channels]`).

NOTE: this value will be used to render `channels=[use Channel VALUE]` when
calling the `fmt_use_acitt()` method.
NOTE: this value will be used to render `channels=[use Channel VALUE]`
when calling the `fmt_use_acitt()` method.

Parameters
----------
Expand All @@ -147,11 +147,11 @@
def reference_illumination(self, value):
"""Set the reference illumination when using *Expert Grouping Options*.

Select the illumination(s) to use for the operation, by default the averaging
mode will be used (`illuminations=[Average Illuminations]`).
Select the illumination(s) to use for the operation, by default the
averaging mode will be used (`illuminations=[Average Illuminations]`).

NOTE: this value will be used to render `illuminations=[use Illumination VALUE]`
when calling the `fmt_use_acitt()` method.
NOTE: this value will be used to render `illuminations=[use Illumination
VALUE]` when calling the `fmt_use_acitt()` method.

Parameters
----------
Expand All @@ -169,11 +169,11 @@
def reference_tile(self, value):
"""Set the reference tile when using *Expert Grouping Options*.

Select the tile(s) to use for the operation, by default the averaging mode will
be used (`tiles=[Average Tiles]`).
Select the tile(s) to use for the operation, by default the averaging
mode will be used (`tiles=[Average Tiles]`).

NOTE: this value will be used to render `tiles=[use Tile VALUE]` when calling
the `fmt_use_acitt()` method.
NOTE: this value will be used to render `tiles=[use Tile VALUE]` when
calling the `fmt_use_acitt()` method.

Parameters
----------
Expand All @@ -186,11 +186,11 @@
def reference_timepoint(self, value):
"""Set the reference timepoint when using *Expert Grouping Options*.

Select the timepoint(s) to use for the operation, by default the averaging mode
will be used (`timepoints=[Average Timepoints]`).
Select the timepoint(s) to use for the operation, by default the
averaging mode will be used (`timepoints=[Average Timepoints]`).

NOTE: this value will be used to render `timepoints=[use Timepoint VALUE]` when
calling the `fmt_use_acitt()` method.
NOTE: this value will be used to render `timepoints=[use Timepoint
VALUE]` when calling the `fmt_use_acitt()` method.

Parameters
----------
Expand Down Expand Up @@ -239,7 +239,7 @@
Parameters
----------
value : str, int, list of int or list of str
The channel(s) to use for processing, either a single value or a list.
The channel(s) to use for processing, a single value or a list.
range_end : int, optional
Contains the end of the range, by default None.

Expand All @@ -259,13 +259,13 @@
def process_illumination(self, value, range_end=None):
"""Set the processing option for illuminations.

Update the illumination processing option and selection depending on input.
If the range_end is not None, it is considered as a range.
Update the illumination processing option and selection depending on
input. If the range_end is not None, it is considered as a range.

Parameters
----------
value : str, int, list of int or list of str
The illumination(s) to use for processing, either a single value or a list.
The illumination(s) to use for processing, a single value or a list.
range_end : int, optional
Contains the end of the range, by default None.

Expand All @@ -291,7 +291,7 @@
Parameters
----------
value : str, int, list of int or list of str
The tile(s) to use for processing, either a single value or a list.
The tile(s) to use for processing, a single value or a list.
range_end : int, optional
Contains the end of the range, by default None.

Expand All @@ -317,7 +317,7 @@
Parameters
----------
value : str, int, list of int or list of str
The timepoint(s) to use for processing, either a single value or a list.
The timepoint(s) to use for processing, a single value or a list.
range_end : int, optional
Contains the end of the range, by default None.

Expand Down Expand Up @@ -683,8 +683,9 @@
"""Format Angle / Channel / Illumination / Tile / Timepoint options.

Build a string providing the `multiple_angles`, `multiple_channels`,
`multiple_illuminations_directions`, `multiple_tiles` and `multiple_timepoints` options
that can be used in a BDV-related `IJ.run` call.
`multiple_illuminations_directions`, `multiple_tiles` and
`multiple_timepoints` options that can be used in a BDV-related `IJ.run`
call.

Returns
-------
Expand All @@ -708,14 +709,15 @@
def check_processing_input(value, range_end):
"""Sanitize and clarifies the acitt input selection.

Check if the input is valid by checking the type and returning the expected output.
Validate the input by checking the type and returning the expected output.

Parameters
----------
value : str, int, list of int or list of str
Contains the list of input dimensions, the first input dimension of a range or a single channel
Contains the list of input dimensions, the first input dimension of a
range or a single channel.
range_end : int or None
Contains the end of the range if need be
Contains the end of the range if need be.

Returns
-------
Expand All @@ -731,13 +733,9 @@
)
if type(range_end) is int:
if type(value[0]) is not int:
raise TypeError(
"Invalid input type. Expected an int for the range start"
)
raise TypeError("Range start needs to be an int.")

Check warning on line 736 in src/imcflibs/imagej/bdv.py

View check run for this annotation

Codecov / codecov/patch

src/imcflibs/imagej/bdv.py#L736

Added line #L736 was not covered by tests
elif len(value) != 1:
raise ValueError(
"Invalid input type. Expected a single number for the range start"
)
raise ValueError("Range start needs to be single number.")

Check warning on line 738 in src/imcflibs/imagej/bdv.py

View check run for this annotation

Codecov / codecov/patch

src/imcflibs/imagej/bdv.py#L738

Added line #L738 was not covered by tests
else:
return "range"
elif len(value) == 1:
Expand All @@ -747,26 +745,31 @@


def get_processing_settings(dimension, selection, value, range_end):
"""Get the variables corresponding to the dimension selection and processing mode.
"""Generate processing strings for selected dimension and processing mode.

Get the processing option and dimension selection string that corresponds
to the selected processing mode.
Generate the processing option and dimension selection strings that
correspond to the selected processing mode and the given dimension
selection.

Parameters
----------
dimension : str
"angle", "channel", "illumination", "tile" or "timepoint"
selection : str
"single", "multiple", or "range"
dimension : {`angle`, `channel`, `illumination`, `tile`, `timepoint`}
The dimension selection to use.
selection : {`single`, `multiple`, `range`}
The *selector* name ("processing mode"), used to derive how the
generated string needs to be assembled according to the given dimension
and value / range settings.
value : str, int, list of int or list of str
Contains the list of input dimensions, the first input dimension of a range or a single channel
The list of input dimensions, the first input dimension of a range or a
single dimension value in case `selection == "single"` (e.g. for
selecting a single channel).
range_end : int or None
Contains the end of the range if need be
Contains the end of the range if need be.

Returns
-------
list of str
processing options string, dimension selection string
tuple of str
processing_option, dimension_select
"""

if selection == "single":
Expand Down Expand Up @@ -804,9 +807,9 @@
def backup_xml_files(source_directory, subfolder_name):
"""Create a backup of BDV-XML files inside a subfolder of `xml-backup`.

Copies all `.xml` and `.xml~` files to a subfolder with the given name inside a
folder called `xml-backup` in the source directory. Uses the `shutil.copy2()`
command, which will overwrite existing files.
Copies all `.xml` and `.xml~` files to a subfolder with the given name
inside a folder called `xml-backup` in the source directory. Uses the
`shutil.copy2()` command, which will overwrite existing files.

Parameters
----------
Expand Down Expand Up @@ -852,8 +855,8 @@
with an extension.
dataset_save_path : str
Output path for the `.xml`.
bf_series_type : str
One of "Angles" or "Tiles", specifying how Bio-Formats interprets the series.
bf_series_type : {`Angles`,`Tiles`}
Defines how Bio-Formats interprets the series.
timepoints_per_partition : int, optional
Split the output dataset by timepoints. Use `0` for no split, resulting
in a single HDF5 file containing all timepoints. By default `1`,
Expand Down Expand Up @@ -912,7 +915,8 @@
+ "bioformats_series_are?="
+ bf_series_type
+ " "
+ "move_tiles_to_grid_(per_angle)?=[Do not move Tiles to Grid (use Metadata if available)] "
+ "move_tiles_to_grid_(per_angle)?=["
+ "Do not move Tiles to Grid (use Metadata if available)] "
+ "how_to_store_input_images=["
+ resave
+ "] "
Expand Down Expand Up @@ -957,8 +961,8 @@
source_directory : str
Path to the folder containing the file(s).
image_file_pattern : str
Regular expression corresponding to the names of your files and how to read the
different dimensions.
Regular expression corresponding to the names of your files and how to
read the different dimensions.
dataset_organisation : str
Organisation of the dataset and the dimensions to process.
Allows for defining the range of interest of the different dimensions.
Expand Down Expand Up @@ -1391,8 +1395,10 @@
+ processing_opts.fmt_acitt_options()
+ processing_opts.fmt_acitt_selectors()
+ "registration_algorithm=[Precise descriptor-based (translation invariant)] "
+ "registration_over_time=[Match against one reference timepoint (no global optimization)] "
+ "registration_in_between_views=[Only compare overlapping views (according to current transformations)] "
+ "registration_over_time=["
+ "Match against one reference timepoint (no global optimization)] "
+ "registration_in_between_views=["
+ "Only compare overlapping views (according to current transformations)] "
+ "interest_point_inclusion=[Compare all interest point of overlapping views] "
+ "interest_points=beads "
+ "group_tiles "
Expand All @@ -1409,8 +1415,11 @@
+ "significance=3 "
+ "allowed_error_for_ransac=5 "
+ "ransac_iterations=Normal "
+ "global_optimization_strategy=[Two-Round: Handle unconnected tiles, remove wrong links RELAXED (5.0x / 7.0px)] "
+ "interestpoint_grouping=[Group interest points (simply combine all in one virtual view)] "
+ "global_optimization_strategy=["
+ "Two-Round: Handle unconnected tiles, "
+ "remove wrong links RELAXED (5.0x / 7.0px)] "
+ "interestpoint_grouping=["
+ "Group interest points (simply combine all in one virtual view)] "
+ "interest=5"
)

Expand Down Expand Up @@ -1656,7 +1665,7 @@
):
"""Export a BigDataViewer project using the BIOP Kheops exporter.

This function uses the BIOP Kheops exporter to convert a BigDataViewer project into a
Use the BIOP Kheops exporter to convert a BigDataViewer project into
OME-TIFF files, with optional compression.

Parameters
Expand All @@ -1666,11 +1675,11 @@
command : CommandService
The Scijava CommandService instance to execute the export command.
processing_opts : ProcessingOptions, optional
Options defining which parts of the dataset to process. If None, default processing
options will be used (process all angles, channels, etc.).
Options defining which parts of the dataset to process. If None, default
processing options will be used (process all angles, channels, etc.).
result_path : str, optional
Path where to store the exported files. If None, files will be saved in the same
directory as the input project.
Path where to store the exported files. If None, files will be saved in
the same directory as the input project.
compression : str, optional
Compression method to use for the TIFF files. Default is "LZW".

Expand Down
Loading