Mercurial > repos > imgteam > imagej2_math
comparison imagej2_analyze_particles_binary_jython_script.py @ 2:d7fbe9662213 draft
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/image_processing/imagej2 commit 57a0433defa3cbc37ab34fbb0ebcfaeb680db8d5
| author | imgteam |
|---|---|
| date | Sun, 05 Nov 2023 10:58:39 +0000 |
| parents | d48c999b3b96 |
| children | d426c25946d4 |
comparison
equal
deleted
inserted
replaced
| 1:d48c999b3b96 | 2:d7fbe9662213 |
|---|---|
| 1 import sys | 1 import sys |
| 2 | 2 |
| 3 from ij import IJ | 3 from ij import IJ |
| 4 from ij.plugin.filter import Analyzer | 4 from ij.plugin.filter import Analyzer |
| 5 | 5 |
| 6 | 6 OPTIONS = ["edm=Overwrite", "iterations=1", "count=1"] |
| 7 OPTIONS = ['edm=Overwrite', 'iterations=1', 'count=1'] | |
| 8 | 7 |
| 9 # Fiji Jython interpreter implements Python 2.5 which does not | 8 # Fiji Jython interpreter implements Python 2.5 which does not |
| 10 # provide support for argparse. | 9 # provide support for argparse. |
| 11 error_log = sys.argv[-14] | 10 error_log = sys.argv[-14] |
| 12 input_file = sys.argv[-13] | 11 input_file = sys.argv[-13] |
| 41 if not image_processor_copy.isBinary(): | 40 if not image_processor_copy.isBinary(): |
| 42 # Convert the image to binary grayscale. | 41 # Convert the image to binary grayscale. |
| 43 IJ.run(input_image_plus_copy, "Make Binary", "") | 42 IJ.run(input_image_plus_copy, "Make Binary", "") |
| 44 | 43 |
| 45 # Set the options. | 44 # Set the options. |
| 46 options = ['size=%s' % size] | 45 options = ["size=%s" % size] |
| 47 circularity_str = '%.3f-%.3f' % (circularity_min, circularity_max) | 46 circularity_str = "%.3f-%.3f" % (circularity_min, circularity_max) |
| 48 options.append('circularity=%s' % circularity_str) | 47 options.append("circularity=%s" % circularity_str) |
| 49 if show.find('_') >= 0: | 48 if show.find("_") >= 0: |
| 50 show_str = '[%s]' % show.replace('_', ' ') | 49 show_str = "[%s]" % show.replace("_", " ") |
| 51 else: | 50 else: |
| 52 show_str = show | 51 show_str = show |
| 53 options.append('show=%s' % show_str) | 52 options.append("show=%s" % show_str) |
| 54 if display_results: | 53 if display_results: |
| 55 options.append('display') | 54 options.append("display") |
| 56 if not all_results: | 55 if not all_results: |
| 57 options.append('summarize') | 56 options.append("summarize") |
| 58 if exclude_edges: | 57 if exclude_edges: |
| 59 options.append('exclude') | 58 options.append("exclude") |
| 60 if include_holes: | 59 if include_holes: |
| 61 options.append('include') | 60 options.append("include") |
| 62 # Always run "in_situ". | 61 # Always run "in_situ". |
| 63 options.append('in_situ') | 62 options.append("in_situ") |
| 64 | 63 |
| 65 # Run the command. | 64 # Run the command. |
| 66 IJ.run(input_image_plus_copy, "Analyze Particles...", " ".join(options)) | 65 IJ.run(input_image_plus_copy, "Analyze Particles...", " ".join(options)) |
| 67 | 66 |
| 68 # Save outputs. | 67 # Save outputs. |
