1717 FuseBigStitcherDatasetIntoOMETiffCommand ,
1818)
1919from ij import IJ
20+ from java .io import File , FileInputStream , InputStreamReader
21+ from javax .xml .parsers import DocumentBuilderFactory
22+ from org .xml .sax import InputSource
2023
2124from .. import pathtools
2225from ..log import LOG as log
@@ -731,6 +734,22 @@ def get_processing_settings(dimension, selection, value, range_end):
731734 tuple of str
732735 processing_option, dimension_select
733736 """
737+ processing_option = dimension_select = ""
738+
739+ # Validate inputs according to the function docstring
740+ valid_dimensions = ("angle" , "channel" , "illumination" , "tile" , "timepoint" )
741+ if dimension not in valid_dimensions :
742+ raise ValueError (
743+ "Invalid dimension '%s', expected one of: %s"
744+ % (dimension , ", " .join (valid_dimensions ))
745+ )
746+
747+ valid_selections = ("single" , "multiple" , "range" )
748+ if selection not in valid_selections :
749+ raise ValueError (
750+ "Invalid selection '%s', expected one of: %s"
751+ % (selection , ", " .join (valid_selections ))
752+ )
734753
735754 if selection == "single" :
736755 processing_option = SINGLE % dimension
@@ -1085,7 +1104,7 @@ def phase_correlation_pairwise_shifts_calculation(
10851104 project_path : str
10861105 Full path to the `.xml` file.
10871106 processing_opts : imcflibs.imagej.bdv.ProcessingOptions, optional
1088- The `ProcessingOptinos ` object defining parameters for the run. Will
1107+ The `ProcessingOptions ` object defining parameters for the run. Will
10891108 fall back to the defaults defined in the corresponding class if the
10901109 parameter is `None` or skipped.
10911110 downsampling_xyz : list of int, optional
@@ -1204,7 +1223,7 @@ def optimize_and_apply_shifts(
12041223 project_path : str
12051224 Path to the `.xml` on which to optimize and apply the shifts.
12061225 processing_opts : imcflibs.imagej.bdv.ProcessingOptions, optional
1207- The `ProcessingOptinos ` object defining parameters for the run. Will
1226+ The `ProcessingOptions ` object defining parameters for the run. Will
12081227 fall back to the defaults defined in the corresponding class if the
12091228 parameter is `None` or skipped.
12101229 relative_error : float, optional
@@ -1355,11 +1374,13 @@ def interest_points_registration(
13551374 + "transformation=Affine "
13561375 + "regularize_model "
13571376 + "model_to_regularize_with=Affine "
1358- + "lamba =0.10 "
1377+ + "lambda =0.10 "
13591378 + "number_of_neighbors=3 "
13601379 + "redundancy=1 "
13611380 + "significance=3 "
1381+ + "search_radius=100 "
13621382 + "allowed_error_for_ransac=5 "
1383+ + "inlier_factor=3 "
13631384 + "ransac_iterations=Normal "
13641385 + "global_optimization_strategy=["
13651386 + "Two-Round: Handle unconnected tiles, "
@@ -1377,7 +1398,7 @@ def interest_points_registration(
13771398def duplicate_transformations (
13781399 project_path ,
13791400 transformation_type = "channel" ,
1380- channel_source = None ,
1401+ channel_source = 0 ,
13811402 tile_source = None ,
13821403 transformation_to_use = "[Replace all transformations]" ,
13831404):
@@ -1394,7 +1415,7 @@ def duplicate_transformations(
13941415 Transformation mode, one of `channel` (to propagate from one channel to
13951416 all others) and `tiles` (to propagate from one tile to all others).
13961417 channel_source : int, optional
1397- Reference channel nummber (starting at 1), by default None.
1418+ Reference channel number (starting at 1), by default None.
13981419 tile_source : int, optional
13991420 Reference tile, by default None.
14001421 transformation_to_use : str, optional
@@ -1410,13 +1431,16 @@ def duplicate_transformations(
14101431 tile_apply = ""
14111432 tile_process = ""
14121433
1413- chnl_apply = ""
1414- chnl_process = ""
1434+ ch_apply = ""
1435+ ch_process = ""
14151436
14161437 if transformation_type == "channel" :
14171438 apply = "[One channel to other channels]"
14181439 target = "[All Channels]"
1419- source = str (channel_source - 1 )
1440+ if channel_source > 0 :
1441+ source = str (channel_source - 1 )
1442+ else :
1443+ source = "0"
14201444 if tile_source :
14211445 tile_apply = "apply_to_tile=[Single tile (Select from List)] "
14221446 tile_process = "processing_tile=[tile " + str (tile_source ) + "] "
@@ -1426,15 +1450,13 @@ def duplicate_transformations(
14261450 apply = "[One tile to other tiles]"
14271451 target = "[All Tiles]"
14281452 source = str (tile_source )
1429- if channel_source :
1430- chnl_apply = "apply_to_channel=[Single channel (Select from List)] "
1431- chnl_process = (
1432- "processing_channel=[channel " + str (channel_source - 1 ) + "] "
1433- )
1453+ if channel_source > 0 :
1454+ ch_apply = "apply_to_channel=[Single channel (Select from List)] "
1455+ ch_process = "processing_channel=[channel " + str (channel_source - 1 ) + "] "
14341456 else :
1435- chnl_apply = "apply_to_channel=[All channels] "
1457+ ch_apply = "apply_to_channel=[All channels] "
14361458 else :
1437- sys . exit ( "Issue with transformation duplication" )
1459+ raise ValueError ( "Invalid transformation type: %s" % transformation_type )
14381460
14391461 options = (
14401462 "apply="
@@ -1447,8 +1469,8 @@ def duplicate_transformations(
14471469 + "apply_to_illumination=[All illuminations] "
14481470 + tile_apply
14491471 + tile_process
1450- + chnl_apply
1451- + chnl_process
1472+ + ch_apply
1473+ + ch_process
14521474 + "apply_to_timepoint=[All Timepoints] "
14531475 + "source="
14541476 + source
@@ -1493,7 +1515,7 @@ def fuse_dataset(
14931515 project_path : str
14941516 Path to the `.xml` on which to run the fusion.
14951517 processing_opts : imcflibs.imagej.bdv.ProcessingOptions, optional
1496- The `ProcessingOptinos ` object defining parameters for the run. Will
1518+ The `ProcessingOptions ` object defining parameters for the run. Will
14971519 fall back to the defaults defined in the corresponding class if the
14981520 parameter is `None` or skipped.
14991521 result_path : str, optional
0 commit comments