-
Notifications
You must be signed in to change notification settings - Fork 3
Description
Parameter channel_source in duplicate_transformations() is stated to be of type int in the docstring, but defaults to None (which is of type NoneType):
python-imcflibs/src/imcflibs/imagej/bdv.py
Lines 1373 to 1399 in 26f64c9
| def duplicate_transformations( | |
| project_path, | |
| transformation_type="channel", | |
| channel_source=None, | |
| tile_source=None, | |
| transformation_to_use="[Replace all transformations]", | |
| ): | |
| """Duplicate / propagate transformation parameters to other channels. | |
| Propagate the transformation parameters generated by a previously performed | |
| registration of a single channel to the other channels. | |
| Parameters | |
| ---------- | |
| project_path : str | |
| Path to the `.xml` project. | |
| transformation_type : str, optional | |
| Transformation mode, one of `channel` (to propagate from one channel to | |
| all others) and `tiles` (to propagate from one tile to all others). | |
| channel_source : int, optional | |
| Reference channel nummber (starting at 1), by default None. | |
| tile_source : int, optional | |
| Reference tile, by default None. | |
| transformation_to_use : str, optional | |
| One of `[Replace all transformations]` (default) and `[Add last | |
| transformation only]` to specify which transformations to propagate. | |
| """ |
Looking at line 1415 in the function body, this has the potential to fail as operator "-" is not supported for "None":
python-imcflibs/src/imcflibs/imagej/bdv.py
Line 1415 in 26f64c9
| source = str(channel_source - 1) |
The obvious option would be to use an int-type default, e.g. channel_source=0 or channel_source=-1 depending on what makes more sense, and then adjust the conditional here to e.g. if channel_source >=0:
python-imcflibs/src/imcflibs/imagej/bdv.py
Line 1425 in 26f64c9
| if channel_source: |