Skip to content

Commit 263dd33

Browse files
committed
fix(bdv): correct channel_source default value and error handling
* Set default value of channel_source to 0 in duplicate_transformations function. * Update error handling to raise ValueError instead of exiting the program. * Adjust logic to handle channel_source correctly when generating source string.
1 parent 6261182 commit 263dd33

1 file changed

Lines changed: 7 additions & 5 deletions

File tree

src/imcflibs/imagej/bdv.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
from .. import pathtools
2222
from ..log import LOG as log
2323

24-
2524
# internal template strings used in string formatting (note: the `"""@private"""`
2625
# pseudo-decorator is there to instruct [pdoc] to omit those variables when generating
2726
# API documentation):
@@ -1373,7 +1372,7 @@ def interest_points_registration(
13731372
def duplicate_transformations(
13741373
project_path,
13751374
transformation_type="channel",
1376-
channel_source=None,
1375+
channel_source=0,
13771376
tile_source=None,
13781377
transformation_to_use="[Replace all transformations]",
13791378
):
@@ -1412,7 +1411,10 @@ def duplicate_transformations(
14121411
if transformation_type == "channel":
14131412
apply = "[One channel to other channels]"
14141413
target = "[All Channels]"
1415-
source = str(channel_source - 1)
1414+
if channel_source > 0:
1415+
source = str(channel_source - 1)
1416+
else:
1417+
source = "0"
14161418
if tile_source:
14171419
tile_apply = "apply_to_tile=[Single tile (Select from List)] "
14181420
tile_process = "processing_tile=[tile " + str(tile_source) + "] "
@@ -1422,15 +1424,15 @@ def duplicate_transformations(
14221424
apply = "[One tile to other tiles]"
14231425
target = "[All Tiles]"
14241426
source = str(tile_source)
1425-
if channel_source:
1427+
if channel_source > 0:
14261428
chnl_apply = "apply_to_channel=[Single channel (Select from List)] "
14271429
chnl_process = (
14281430
"processing_channel=[channel " + str(channel_source - 1) + "] "
14291431
)
14301432
else:
14311433
chnl_apply = "apply_to_channel=[All channels] "
14321434
else:
1433-
sys.exit("Issue with transformation duplication")
1435+
raise ValueError("Issue with transformation duplication")
14341436

14351437
options = (
14361438
"apply="

0 commit comments

Comments
 (0)