Previous changeset 1:e9243cad1d67 (2020-09-28) Next changeset 3:711adedc5bb8 (2024-09-25) |
Commit message:
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/image_processing/imagej2 commit 57a0433defa3cbc37ab34fbb0ebcfaeb680db8d5 |
modified:
imagej2_adjust_threshold_binary_jython_script.py imagej2_analyze_particles_binary_jython_script.py imagej2_analyze_skeleton_jython_script.py imagej2_binary_to_edm_jython_script.py imagej2_bunwarpj_align.xml imagej2_create_image_jython_script.py imagej2_enhance_contrast_jython_script.py imagej2_find_maxima_jython_script.py imagej2_make_binary_jython_script.py imagej2_math_jython_script.py imagej2_noise_jython_script.py imagej2_skeletonize3d_jython_script.py imagej2_watershed_binary_jython_script.py |
b |
diff -r e9243cad1d67 -r 0a0d2dfd17e0 imagej2_adjust_threshold_binary_jython_script.py --- a/imagej2_adjust_threshold_binary_jython_script.py Mon Sep 28 16:40:20 2020 +0000 +++ b/imagej2_adjust_threshold_binary_jython_script.py Sun Nov 05 10:51:33 2023 +0000 |
b |
@@ -26,7 +26,11 @@ # Convert image to binary if necessary. if not image_processor_copy.isBinary(): # Convert the image to binary grayscale. - IJ.run(input_image_plus_copy, "Make Binary", "iterations=1 count=1 edm=Overwrite do=Nothing") + IJ.run( + input_image_plus_copy, + "Make Binary", + "iterations=1 count=1 edm=Overwrite do=Nothing", + ) # Set the options. if black_background: method_str = "%s dark" % method |
b |
diff -r e9243cad1d67 -r 0a0d2dfd17e0 imagej2_analyze_particles_binary_jython_script.py --- a/imagej2_analyze_particles_binary_jython_script.py Mon Sep 28 16:40:20 2020 +0000 +++ b/imagej2_analyze_particles_binary_jython_script.py Sun Nov 05 10:51:33 2023 +0000 |
[ |
@@ -3,8 +3,7 @@ from ij import IJ from ij.plugin.filter import Analyzer - -OPTIONS = ['edm=Overwrite', 'iterations=1', 'count=1'] +OPTIONS = ["edm=Overwrite", "iterations=1", "count=1"] # Fiji Jython interpreter implements Python 2.5 which does not # provide support for argparse. @@ -43,24 +42,24 @@ IJ.run(input_image_plus_copy, "Make Binary", "") # Set the options. -options = ['size=%s' % size] -circularity_str = '%.3f-%.3f' % (circularity_min, circularity_max) -options.append('circularity=%s' % circularity_str) -if show.find('_') >= 0: - show_str = '[%s]' % show.replace('_', ' ') +options = ["size=%s" % size] +circularity_str = "%.3f-%.3f" % (circularity_min, circularity_max) +options.append("circularity=%s" % circularity_str) +if show.find("_") >= 0: + show_str = "[%s]" % show.replace("_", " ") else: show_str = show -options.append('show=%s' % show_str) +options.append("show=%s" % show_str) if display_results: - options.append('display') + options.append("display") if not all_results: - options.append('summarize') + options.append("summarize") if exclude_edges: - options.append('exclude') + options.append("exclude") if include_holes: - options.append('include') + options.append("include") # Always run "in_situ". -options.append('in_situ') +options.append("in_situ") # Run the command. IJ.run(input_image_plus_copy, "Analyze Particles...", " ".join(options)) |
b |
diff -r e9243cad1d67 -r 0a0d2dfd17e0 imagej2_analyze_skeleton_jython_script.py --- a/imagej2_analyze_skeleton_jython_script.py Mon Sep 28 16:40:20 2020 +0000 +++ b/imagej2_analyze_skeleton_jython_script.py Sun Nov 05 10:51:33 2023 +0000 |
[ |
@@ -4,18 +4,37 @@ from ij import IJ from sc.fiji.analyzeSkeleton import AnalyzeSkeleton_ -BASIC_NAMES = ['Branches', 'Junctions', 'End-point Voxels', - 'Junction Voxels', 'Slab Voxels', 'Average branch length', - 'Triple Points', 'Quadruple Points', 'Maximum Branch Length'] -DETAIL_NAMES = ['Skeleton ID', 'Branch length', 'V1 x', 'V1 y', 'V1 z', 'V2 x', - 'V2 y', 'V2 z', 'Euclidean distance'] -OPTIONS = ['edm=Overwrite', 'iterations=1', 'count=1'] +BASIC_NAMES = [ + "Branches", + "Junctions", + "End-point Voxels", + "Junction Voxels", + "Slab Voxels", + "Average branch length", + "Triple Points", + "Quadruple Points", + "Maximum Branch Length", +] +DETAIL_NAMES = [ + "Skeleton ID", + "Branch length", + "V1 x", + "V1 y", + "V1 z", + "V2 x", + "V2 y", + "V2 z", + "Euclidean distance", +] +OPTIONS = ["edm=Overwrite", "iterations=1", "count=1"] def get_euclidean_distance(vertex1, vertex2): x1, y1, z1 = get_points(vertex1) x2, y2, z2 = get_points(vertex2) - return math.sqrt(math.pow((x2 - x1), 2) + math.pow((y2 - y1), 2) + math.pow((z2 - z1), 2)) + return math.sqrt( + math.pow((x2 - x1), 2) + math.pow((y2 - y1), 2) + math.pow((z2 - z1), 2) + ) def get_graph_length(graph): @@ -46,29 +65,29 @@ return graphs -def save(result, output, show_detailed_info, calculate_largest_shortest_path, sep='\t'): +def save(result, output, show_detailed_info, calculate_largest_shortest_path, sep="\t"): num_trees = int(result.getNumOfTrees()) - outf = open(output, 'wb') - outf.write('# %s\n' % sep.join(BASIC_NAMES)) + outf = open(output, "wb") + outf.write("# %s\n" % sep.join(BASIC_NAMES)) for index in range(num_trees): - outf.write('%d%s' % (result.getBranches()[index], sep)) - outf.write('%d%s' % (result.getJunctions()[index], sep)) - outf.write('%d%s' % (result.getEndPoints()[index], sep)) - outf.write('%d%s' % (result.getJunctionVoxels()[index], sep)) - outf.write('%d%s' % (result.getSlabs()[index], sep)) - outf.write('%.3f%s' % (result.getAverageBranchLength()[index], sep)) - outf.write('%d%s' % (result.getTriples()[index], sep)) - outf.write('%d%s' % (result.getQuadruples()[index], sep)) - outf.write('%.3f' % result.getMaximumBranchLength()[index]) + outf.write("%d%s" % (result.getBranches()[index], sep)) + outf.write("%d%s" % (result.getJunctions()[index], sep)) + outf.write("%d%s" % (result.getEndPoints()[index], sep)) + outf.write("%d%s" % (result.getJunctionVoxels()[index], sep)) + outf.write("%d%s" % (result.getSlabs()[index], sep)) + outf.write("%.3f%s" % (result.getAverageBranchLength()[index], sep)) + outf.write("%d%s" % (result.getTriples()[index], sep)) + outf.write("%d%s" % (result.getQuadruples()[index], sep)) + outf.write("%.3f" % result.getMaximumBranchLength()[index]) if calculate_largest_shortest_path: - outf.write('%s%.3f%s' % (sep, result.shortestPathList.get(index), sep)) - outf.write('%d%s' % (result.spStartPosition[index][0], sep)) - outf.write('%d%s' % (result.spStartPosition[index][1], sep)) - outf.write('%d\n' % result.spStartPosition[index][2]) + outf.write("%s%.3f%s" % (sep, result.shortestPathList.get(index), sep)) + outf.write("%d%s" % (result.spStartPosition[index][0], sep)) + outf.write("%d%s" % (result.spStartPosition[index][1], sep)) + outf.write("%d\n" % result.spStartPosition[index][2]) else: - outf.write('\n') + outf.write("\n") if show_detailed_info: - outf.write('# %s\n' % sep.join(DETAIL_NAMES)) + outf.write("# %s\n" % sep.join(DETAIL_NAMES)) # The following index is a placeholder for the skeleton ID. # The terms "graph" and "skeleton" refer to the same thing. # Also, the SkeletonResult.java code states that the @@ -80,23 +99,23 @@ x1, y1, z1 = get_points(vertex1) vertex2 = edge.getV2() x2, y2, z2 = get_points(vertex2) - outf.write('%d%s' % (index + 1, sep)) - outf.write('%.3f%s' % (edge.getLength(), sep)) - outf.write('%d%s' % (x1, sep)) - outf.write('%d%s' % (y1, sep)) - outf.write('%d%s' % (z1, sep)) - outf.write('%d%s' % (x2, sep)) - outf.write('%d%s' % (y2, sep)) - outf.write('%d%s' % (z2, sep)) - outf.write('%.3f' % get_euclidean_distance(vertex1, vertex2)) + outf.write("%d%s" % (index + 1, sep)) + outf.write("%.3f%s" % (edge.getLength(), sep)) + outf.write("%d%s" % (x1, sep)) + outf.write("%d%s" % (y1, sep)) + outf.write("%d%s" % (z1, sep)) + outf.write("%d%s" % (x2, sep)) + outf.write("%d%s" % (y2, sep)) + outf.write("%d%s" % (z2, sep)) + outf.write("%.3f" % get_euclidean_distance(vertex1, vertex2)) if calculate_largest_shortest_path: # Keep number of separated items the same for each line. - outf.write('%s %s' % (sep, sep)) - outf.write(' %s' % sep) - outf.write(' %s' % sep) - outf.write(' \n') + outf.write("%s %s" % (sep, sep)) + outf.write(" %s" % sep) + outf.write(" %s" % sep) + outf.write(" \n") else: - outf.write('\n') + outf.write("\n") outf.close() @@ -109,8 +128,8 @@ prune_ends = sys.argv[-4] == "yes" calculate_largest_shortest_path = sys.argv[-3] == "yes" if calculate_largest_shortest_path: - BASIC_NAMES.extend(['Longest Shortest Path', 'spx', 'spy', 'spz']) - DETAIL_NAMES.extend([' ', ' ', ' ', ' ']) + BASIC_NAMES.extend(["Longest Shortest Path", "spx", "spy", "spz"]) + DETAIL_NAMES.extend([" ", " ", " ", " "]) show_detailed_info = sys.argv[-2] == "yes" output = sys.argv[-1] @@ -135,14 +154,21 @@ # Run AnalyzeSkeleton analyze_skeleton = AnalyzeSkeleton_() analyze_skeleton.setup("", input_image_plus_copy) -if prune_cycle_method == 'none': +if prune_cycle_method == "none": prune_index = analyze_skeleton.NONE -elif prune_cycle_method == 'shortest_branch': +elif prune_cycle_method == "shortest_branch": prune_index = analyze_skeleton.SHORTEST_BRANCH -elif prune_cycle_method == 'lowest_intensity_voxel': +elif prune_cycle_method == "lowest_intensity_voxel": prune_index = analyze_skeleton.LOWEST_INTENSITY_VOXEL -elif prune_cycle_method == 'lowest_intensity_branch': +elif prune_cycle_method == "lowest_intensity_branch": prune_index = analyze_skeleton.LOWEST_INTENSITY_BRANCH -result = analyze_skeleton.run(prune_index, prune_ends, calculate_largest_shortest_path, input_image_plus_copy, True, True) +result = analyze_skeleton.run( + prune_index, + prune_ends, + calculate_largest_shortest_path, + input_image_plus_copy, + True, + True, +) # Save the results. save(result, output, show_detailed_info, calculate_largest_shortest_path) |
b |
diff -r e9243cad1d67 -r 0a0d2dfd17e0 imagej2_binary_to_edm_jython_script.py --- a/imagej2_binary_to_edm_jython_script.py Mon Sep 28 16:40:20 2020 +0000 +++ b/imagej2_binary_to_edm_jython_script.py Sun Nov 05 10:51:33 2023 +0000 |
[ |
@@ -21,7 +21,7 @@ image_processor_copy = input_image_plus_copy.getProcessor() # Set binary options. -options_list = ['edm=Overwrite', 'iterations=%d' % iterations, 'count=%d' % count] +options_list = ["edm=Overwrite", "iterations=%d" % iterations, "count=%d" % count] if black_background: options_list.append("black") if pad_edges_when_eroding: |
b |
diff -r e9243cad1d67 -r 0a0d2dfd17e0 imagej2_bunwarpj_align.xml --- a/imagej2_bunwarpj_align.xml Mon Sep 28 16:40:20 2020 +0000 +++ b/imagej2_bunwarpj_align.xml Sun Nov 05 10:51:33 2023 +0000 |
[ |
@@ -1,8 +1,15 @@ -<tool id="imagej2_bunwarpj_align" name="Align two images" version="@WRAPPER_VERSION@.0"> - <description>with bUnwarpJ</description> +<tool id="imagej2_bunwarpj_align" name="Align two images" version="@WRAPPER_VERSION@.1"> + <description>with ImageJ2</description> <macros> <import>imagej2_macros.xml</import> </macros> + <edam_operations> + <edam_operation>operation_3443</edam_operation> + </edam_operations> + <xrefs> + <xref type="bio.tools">imagej</xref> + <xref type="biii">imagej2</xref> + </xrefs> <expand macro="fiji_requirements"/> <command detect_errors="exit_code"><![CDATA[ #import os |
b |
diff -r e9243cad1d67 -r 0a0d2dfd17e0 imagej2_create_image_jython_script.py --- a/imagej2_create_image_jython_script.py Mon Sep 28 16:40:20 2020 +0000 +++ b/imagej2_create_image_jython_script.py Sun Nov 05 10:51:33 2023 +0000 |
[ |
@@ -8,7 +8,7 @@ width = int(sys.argv[-5]) height = int(sys.argv[-4]) depth = int(sys.argv[-3]) -type = sys.argv[-2].replace('_', ' ') +type = sys.argv[-2].replace("_", " ") tmp_image_path = sys.argv[-1] imp = IJ.newImage(title, type, width, height, depth) |
b |
diff -r e9243cad1d67 -r 0a0d2dfd17e0 imagej2_enhance_contrast_jython_script.py --- a/imagej2_enhance_contrast_jython_script.py Mon Sep 28 16:40:20 2020 +0000 +++ b/imagej2_enhance_contrast_jython_script.py Sun Nov 05 10:51:33 2023 +0000 |
[ |
@@ -24,16 +24,16 @@ options = [] # If equalize_histogram, saturated_pixels and normalize are ignored. if equalize_histogram: - options.append('equalize') + options.append("equalize") else: - if saturated_pixels not in [None, 'None']: + if saturated_pixels not in [None, "None"]: # Fiji allows only a single decimal place for this value. - options.append('saturated=%.3f' % float(saturated_pixels)) + options.append("saturated=%.3f" % float(saturated_pixels)) # Normalization of RGB images is not supported. if bit_depth != 24 and normalize: - options.append('normalize') + options.append("normalize") # Run the command. -options = "%s" % ' '.join(options) +options = "%s" % " ".join(options) IJ.run(input_image_plus_copy, "Enhance Contrast...", options) # Save the ImagePlus object as a new image. IJ.saveAs(input_image_plus_copy, output_datatype, tmp_output_path) |
b |
diff -r e9243cad1d67 -r 0a0d2dfd17e0 imagej2_find_maxima_jython_script.py --- a/imagej2_find_maxima_jython_script.py Mon Sep 28 16:40:20 2020 +0000 +++ b/imagej2_find_maxima_jython_script.py Sun Nov 05 10:51:33 2023 +0000 |
[ |
@@ -8,11 +8,11 @@ # provide support for argparse. error_log = sys.argv[-10] input_file = sys.argv[-9] -scale_when_converting = sys.argv[-8] == 'yes' -weighted_rgb_conversions = sys.argv[-7] == 'yes' +scale_when_converting = sys.argv[-8] == "yes" +weighted_rgb_conversions = sys.argv[-7] == "yes" noise_tolerance = int(sys.argv[-6]) output_type = sys.argv[-5] -exclude_edge_maxima = sys.argv[-4] == 'yes' +exclude_edge_maxima = sys.argv[-4] == "yes" light_background = sys.argv[-3] tmp_output_path = sys.argv[-2] output_datatype = sys.argv[-1] @@ -36,19 +36,19 @@ options.append("weighted") # Perform conversion - must happen even if no options are set. IJ.run(input_image_plus_copy, "Conversions...", "%s" % " ".join(options)) -if output_type in ['List', 'Count']: +if output_type in ["List", "Count"]: # W're generating a tabular file for the output. # Set the Find Maxima options. - options = ['noise=%d' % noise_tolerance] - if output_type.find('_') > 0: - output_type_str = 'output=[%s]' % output_type.replace('_', ' ') + options = ["noise=%d" % noise_tolerance] + if output_type.find("_") > 0: + output_type_str = "output=[%s]" % output_type.replace("_", " ") else: - output_type_str = 'output=%s' % output_type + output_type_str = "output=%s" % output_type options.append(output_type_str) if exclude_edge_maxima: - options.append('exclude') + options.append("exclude") if light_background: - options.append('light') + options.append("light") # Run the command. IJ.run(input_image_plus_copy, "Find Maxima...", "%s" % " ".join(options)) results_table = analyzer.getResultsTable() @@ -60,30 +60,32 @@ # may be improperly placed if local maxima are suppressed # by the tolerance. mf = MaximumFinder() - if output_type == 'Single_Points': + if output_type == "Single_Points": output_type_param = mf.SINGLE_POINTS - elif output_type == 'Maxima_Within_Tolerance': + elif output_type == "Maxima_Within_Tolerance": output_type_param = mf.IN_TOLERANCE - elif output_type == 'Segmented_Particles': + elif output_type == "Segmented_Particles": output_type_param = mf.SEGMENTED - elif output_type == 'List': + elif output_type == "List": output_type_param = mf.LIST - elif output_type == 'Count': + elif output_type == "Count": output_type_param = mf.COUNT # Get a new byteProcessor with a normal (uninverted) LUT where # the marked points are set to 255 (Background 0). Pixels outside # of the roi of the input image_processor_copy are not set. No # output image is created for output types POINT_SELECTION, LIST # and COUNT. In these cases findMaxima returns null. - byte_processor = mf.findMaxima(image_processor_copy, - noise_tolerance, - ImageProcessor.NO_THRESHOLD, - output_type_param, - exclude_edge_maxima, - False) + byte_processor = mf.findMaxima( + image_processor_copy, + noise_tolerance, + ImageProcessor.NO_THRESHOLD, + output_type_param, + exclude_edge_maxima, + False, + ) # Invert the image or ROI. byte_processor.invert() - if output_type == 'Segmented_Particles' and not light_background: + if output_type == "Segmented_Particles" and not light_background: # Invert the values in this image's LUT (indexed color model). byte_processor.invertLut() image_plus = ImagePlus("output", byte_processor) |
b |
diff -r e9243cad1d67 -r 0a0d2dfd17e0 imagej2_make_binary_jython_script.py --- a/imagej2_make_binary_jython_script.py Mon Sep 28 16:40:20 2020 +0000 +++ b/imagej2_make_binary_jython_script.py Sun Nov 05 10:51:33 2023 +0000 |
[ |
@@ -8,8 +8,8 @@ input = sys.argv[-7] iterations = int(sys.argv[-6]) count = int(sys.argv[-5]) -black_background = sys.argv[-4] == 'yes' -pad_edges_when_eroding = sys.argv[-3] == 'yes' +black_background = sys.argv[-4] == "yes" +pad_edges_when_eroding = sys.argv[-3] == "yes" tmp_output_path = sys.argv[-2] output_datatype = sys.argv[-1] @@ -21,12 +21,12 @@ image_processor_copy = input_image_plus_copy.getProcessor() # Set binary options. -options = ['edm=Overwrite', 'iterations=%d' % iterations, 'count=%d' % count] +options = ["edm=Overwrite", "iterations=%d" % iterations, "count=%d" % count] if pad_edges_when_eroding: - options.append('pad') + options.append("pad") if black_background: - options.append('black') -options = ' '.join(options) + options.append("black") +options = " ".join(options) IJ.run(input_image_plus_copy, "Options...", options) # Run the command. |
b |
diff -r e9243cad1d67 -r 0a0d2dfd17e0 imagej2_math_jython_script.py --- a/imagej2_math_jython_script.py Mon Sep 28 16:40:20 2020 +0000 +++ b/imagej2_math_jython_script.py Sun Nov 05 10:51:33 2023 +0000 |
[ |
@@ -8,11 +8,11 @@ input_file = sys.argv[-7] operation = sys.argv[-6] expression = sys.argv[-5] -if sys.argv[-4] in [None, 'None']: +if sys.argv[-4] in [None, "None"]: bin_constant = None else: bin_constant = int(sys.argv[-4]) -if sys.argv[-3] in [None, 'None']: +if sys.argv[-3] in [None, "None"]: float_constant = None else: float_constant = float(sys.argv[-3]) @@ -36,49 +36,49 @@ image_processor_copy = input_image_plus_copy.getProcessor() bit_depth = image_processor_copy.getBitDepth() -if operation.find('_') > 0: +if operation.find("_") > 0: # Square_Root. - new_operation = operation.replace('_', ' ') -elif operation in ['Square', 'Log', 'Exp', 'Abs', 'Reciprocal']: + new_operation = operation.replace("_", " ") +elif operation in ["Square", "Log", "Exp", "Abs", "Reciprocal"]: # Unfortunately some ImageJ commands require a "..." ending # while others do not. There seems to be no pattern. - new_operation = '%s' % operation + new_operation = "%s" % operation else: - new_operation = '%s...' % operation + new_operation = "%s..." % operation -if operation == 'Macro': +if operation == "Macro": # Apply the macro code to the image via a call to it's # ImageProcessor since this option does not work using # the IJ.run() method. new_expression = expression.lstrip('"').rstrip('"') - options = 'code=%s' % new_expression + options = "code=%s" % new_expression image_processor_copy.applyMacro(new_expression) -elif operation == 'Min': +elif operation == "Min": # Min does not work without using the ImageProcessor. image_processor_copy.min(float_constant) -elif operation == 'Max': +elif operation == "Max": # Max does not work without using the ImageProcessor. image_processor_copy.max(float_constant) -elif operation == 'Abs': +elif operation == "Abs": if bit_depth not in [16, 32]: # Convert the image to 32-bit. IJ.run(input_image_plus_copy, "32-bit", "") IJ.run(input_image_plus_copy, new_operation, "") -elif operation == 'Reciprocal': +elif operation == "Reciprocal": if bit_depth != 32: # Convert the image to 32 bit. IJ.run(input_image_plus_copy, "32-bit", "") IJ.run(input_image_plus_copy, new_operation, "") else: - if operation in ['AND', 'OR', 'XOR']: + if operation in ["AND", "OR", "XOR"]: # Value is a binary number. - options = 'value=%d' % bin_constant - elif operation in ['Log', 'Exp', 'Square', 'Square_Root']: + options = "value=%d" % bin_constant + elif operation in ["Log", "Exp", "Square", "Square_Root"]: # No constant value. - options = '' + options = "" else: # Value is a floating point number. - options = 'value=%.3f' % float_constant + options = "value=%.3f" % float_constant IJ.run(input_image_plus_copy, "%s" % new_operation, "%s" % options) # Save the ImagePlus object as a new image. IJ.saveAs(input_image_plus_copy, output_datatype, tmp_output_path) |
b |
diff -r e9243cad1d67 -r 0a0d2dfd17e0 imagej2_noise_jython_script.py --- a/imagej2_noise_jython_script.py Mon Sep 28 16:40:20 2020 +0000 +++ b/imagej2_noise_jython_script.py Sun Nov 05 10:51:33 2023 +0000 |
b |
@@ -35,33 +35,51 @@ image_processor_copy = image_plus_copy.getProcessor() # Perform the analysis on the ImagePlus object. -if noise == 'add_noise': +if noise == "add_noise": IJ.run(image_plus_copy, "Add Noise", "") -elif noise == 'add_specified_noise': +elif noise == "add_specified_noise": IJ.run(image_plus_copy, "Add Specified Noise", "standard=&standard_deviation") -elif noise == 'salt_and_pepper': +elif noise == "salt_and_pepper": IJ.run(image_plus_copy, "Salt and Pepper", "") -elif noise == 'despeckle': +elif noise == "despeckle": IJ.run(image_plus_copy, "Despeckle", "") -elif noise == 'remove_outliers': - IJ.run(image_plus_copy, "Remove Outliers", "radius=&radius threshold=&threshold which=&which_outliers") -elif noise == 'remove_nans': +elif noise == "remove_outliers": + IJ.run( + image_plus_copy, + "Remove Outliers", + "radius=&radius threshold=&threshold which=&which_outliers", + ) +elif noise == "remove_nans": IJ.run(image_plus_copy, "Remove NaNs", "") -elif noise == 'rof_denoise': +elif noise == "rof_denoise": IJ.run(image_plus_copy, "ROF Denoise", "") -elif noise == 'randomj': - if randomj == 'randomj_binomial': - IJ.run(image_plus_copy, "RandomJ Binomial", "trials=&trials probability=&probability insertion=&insertion") - elif randomj == 'randomj_exponential': - IJ.run(image_plus_copy, "RandomJ Exponential", "lambda=&lammbda insertion=&insertion") - elif randomj == 'randomj_gamma': +elif noise == "randomj": + if randomj == "randomj_binomial": + IJ.run( + image_plus_copy, + "RandomJ Binomial", + "trials=&trials probability=&probability insertion=&insertion", + ) + elif randomj == "randomj_exponential": + IJ.run( + image_plus_copy, + "RandomJ Exponential", + "lambda=&lammbda insertion=&insertion", + ) + elif randomj == "randomj_gamma": IJ.run(image_plus_copy, "RandomJ Gamma", "order=&order insertion=&insertion") - elif randomj == 'randomj_gaussian': - IJ.run(image_plus_copy, "RandomJ Gaussian", "mean=&mean sigma=&sigma insertion=&insertion") - elif randomj == 'randomj_poisson': + elif randomj == "randomj_gaussian": + IJ.run( + image_plus_copy, + "RandomJ Gaussian", + "mean=&mean sigma=&sigma insertion=&insertion", + ) + elif randomj == "randomj_poisson": IJ.run(image_plus_copy, "RandomJ Poisson", "mean=&mean insertion=&insertion") - elif randomj == 'randomj_uniform': - IJ.run(image_plus_copy, "RandomJ Uniform", "min=&min max=&max insertion=&insertion") + elif randomj == "randomj_uniform": + IJ.run( + image_plus_copy, "RandomJ Uniform", "min=&min max=&max insertion=&insertion" + ) # Save the ImagePlus object as a new image. IJ.saveAs(image_plus_copy, image_datatype, tmp_output_path) |
b |
diff -r e9243cad1d67 -r 0a0d2dfd17e0 imagej2_skeletonize3d_jython_script.py --- a/imagej2_skeletonize3d_jython_script.py Mon Sep 28 16:40:20 2020 +0000 +++ b/imagej2_skeletonize3d_jython_script.py Sun Nov 05 10:51:33 2023 +0000 |
[ |
@@ -6,7 +6,7 @@ # provide support for argparse. error_log = sys.argv[-5] input_file = sys.argv[-4] -black_background = sys.argv[-3] == 'yes' +black_background = sys.argv[-3] == "yes" tmp_output_path = sys.argv[-2] output_datatype = sys.argv[-1] @@ -18,9 +18,9 @@ image_processor_copy = input_image_plus_copy.getProcessor() # Set binary options. -options = ['edm=Overwrite', 'iterations=1', 'count=1'] -if (black_background): - options.append('black') +options = ["edm=Overwrite", "iterations=1", "count=1"] +if black_background: + options.append("black") options = " ".join(options) IJ.run(input_image_plus_copy, "Options...", options) |
b |
diff -r e9243cad1d67 -r 0a0d2dfd17e0 imagej2_watershed_binary_jython_script.py --- a/imagej2_watershed_binary_jython_script.py Mon Sep 28 16:40:20 2020 +0000 +++ b/imagej2_watershed_binary_jython_script.py Sun Nov 05 10:51:33 2023 +0000 |
[ |
@@ -6,7 +6,7 @@ # provide support for argparse. error_log = sys.argv[-5] input = sys.argv[-4] -black_background = sys.argv[-3] == 'yes' +black_background = sys.argv[-3] == "yes" tmp_output_path = sys.argv[-2] output_datatype = sys.argv[-1] @@ -18,9 +18,9 @@ image_processor_copy = input_image_plus_copy.getProcessor() # Set binary options. -options = ['edm=Overwrite', 'iterations=1', 'count=1'] -if (black_background): - options.append('black') +options = ["edm=Overwrite", "iterations=1", "count=1"] +if black_background: + options.append("black") options = " ".join(options) IJ.run(input_image_plus_copy, "Options...", options) |