Mercurial > repos > imgteam > imagej2_find_edges
annotate imagej2_find_maxima_jython_script.py @ 0:8e608a6e44ac draft
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/image_processing/imagej2 commit b08f0e6d1546caaf627b21f8c94044285d5d5b9c-dirty"
| author | imgteam | 
|---|---|
| date | Tue, 17 Sep 2019 16:59:03 -0400 | 
| parents | |
| children | c8dfbf4b899c | 
| rev | line source | 
|---|---|
| 
0
 
8e608a6e44ac
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/image_processing/imagej2 commit b08f0e6d1546caaf627b21f8c94044285d5d5b9c-dirty"
 
imgteam 
parents:  
diff
changeset
 | 
1 import sys | 
| 
 
8e608a6e44ac
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/image_processing/imagej2 commit b08f0e6d1546caaf627b21f8c94044285d5d5b9c-dirty"
 
imgteam 
parents:  
diff
changeset
 | 
2 import jython_utils | 
| 
 
8e608a6e44ac
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/image_processing/imagej2 commit b08f0e6d1546caaf627b21f8c94044285d5d5b9c-dirty"
 
imgteam 
parents:  
diff
changeset
 | 
3 from ij import ImagePlus, IJ | 
| 
 
8e608a6e44ac
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/image_processing/imagej2 commit b08f0e6d1546caaf627b21f8c94044285d5d5b9c-dirty"
 
imgteam 
parents:  
diff
changeset
 | 
4 from ij.plugin.filter import Analyzer, MaximumFinder | 
| 
 
8e608a6e44ac
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/image_processing/imagej2 commit b08f0e6d1546caaf627b21f8c94044285d5d5b9c-dirty"
 
imgteam 
parents:  
diff
changeset
 | 
5 from ij.process import ImageProcessor | 
| 
 
8e608a6e44ac
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/image_processing/imagej2 commit b08f0e6d1546caaf627b21f8c94044285d5d5b9c-dirty"
 
imgteam 
parents:  
diff
changeset
 | 
6 from jarray import array | 
| 
 
8e608a6e44ac
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/image_processing/imagej2 commit b08f0e6d1546caaf627b21f8c94044285d5d5b9c-dirty"
 
imgteam 
parents:  
diff
changeset
 | 
7 | 
| 
 
8e608a6e44ac
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/image_processing/imagej2 commit b08f0e6d1546caaf627b21f8c94044285d5d5b9c-dirty"
 
imgteam 
parents:  
diff
changeset
 | 
8 # Fiji Jython interpreter implements Python 2.5 which does not | 
| 
 
8e608a6e44ac
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/image_processing/imagej2 commit b08f0e6d1546caaf627b21f8c94044285d5d5b9c-dirty"
 
imgteam 
parents:  
diff
changeset
 | 
9 # provide support for argparse. | 
| 
 
8e608a6e44ac
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/image_processing/imagej2 commit b08f0e6d1546caaf627b21f8c94044285d5d5b9c-dirty"
 
imgteam 
parents:  
diff
changeset
 | 
10 error_log = sys.argv[ -10 ] | 
| 
 
8e608a6e44ac
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/image_processing/imagej2 commit b08f0e6d1546caaf627b21f8c94044285d5d5b9c-dirty"
 
imgteam 
parents:  
diff
changeset
 | 
11 input = sys.argv[ -9 ] | 
| 
 
8e608a6e44ac
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/image_processing/imagej2 commit b08f0e6d1546caaf627b21f8c94044285d5d5b9c-dirty"
 
imgteam 
parents:  
diff
changeset
 | 
12 scale_when_converting = jython_utils.asbool( sys.argv[ -8 ] ) | 
| 
 
8e608a6e44ac
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/image_processing/imagej2 commit b08f0e6d1546caaf627b21f8c94044285d5d5b9c-dirty"
 
imgteam 
parents:  
diff
changeset
 | 
13 weighted_rgb_conversions = jython_utils.asbool( sys.argv[ -7 ] ) | 
| 
 
8e608a6e44ac
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/image_processing/imagej2 commit b08f0e6d1546caaf627b21f8c94044285d5d5b9c-dirty"
 
imgteam 
parents:  
diff
changeset
 | 
14 noise_tolerance = int( sys.argv[ -6 ] ) | 
| 
 
8e608a6e44ac
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/image_processing/imagej2 commit b08f0e6d1546caaf627b21f8c94044285d5d5b9c-dirty"
 
imgteam 
parents:  
diff
changeset
 | 
15 output_type = sys.argv[ -5 ] | 
| 
 
8e608a6e44ac
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/image_processing/imagej2 commit b08f0e6d1546caaf627b21f8c94044285d5d5b9c-dirty"
 
imgteam 
parents:  
diff
changeset
 | 
16 exclude_edge_maxima = jython_utils.asbool( sys.argv[ -4 ] ) | 
| 
 
8e608a6e44ac
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/image_processing/imagej2 commit b08f0e6d1546caaf627b21f8c94044285d5d5b9c-dirty"
 
imgteam 
parents:  
diff
changeset
 | 
17 light_background = jython_utils.asbool( sys.argv[ -3 ] ) | 
| 
 
8e608a6e44ac
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/image_processing/imagej2 commit b08f0e6d1546caaf627b21f8c94044285d5d5b9c-dirty"
 
imgteam 
parents:  
diff
changeset
 | 
18 tmp_output_path = sys.argv[ -2 ] | 
| 
 
8e608a6e44ac
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/image_processing/imagej2 commit b08f0e6d1546caaf627b21f8c94044285d5d5b9c-dirty"
 
imgteam 
parents:  
diff
changeset
 | 
19 output_datatype = sys.argv[ -1 ] | 
| 
 
8e608a6e44ac
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/image_processing/imagej2 commit b08f0e6d1546caaf627b21f8c94044285d5d5b9c-dirty"
 
imgteam 
parents:  
diff
changeset
 | 
20 | 
| 
 
8e608a6e44ac
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/image_processing/imagej2 commit b08f0e6d1546caaf627b21f8c94044285d5d5b9c-dirty"
 
imgteam 
parents:  
diff
changeset
 | 
21 # Open the input image file. | 
| 
 
8e608a6e44ac
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/image_processing/imagej2 commit b08f0e6d1546caaf627b21f8c94044285d5d5b9c-dirty"
 
imgteam 
parents:  
diff
changeset
 | 
22 input_image_plus = IJ.openImage( input ) | 
| 
 
8e608a6e44ac
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/image_processing/imagej2 commit b08f0e6d1546caaf627b21f8c94044285d5d5b9c-dirty"
 
imgteam 
parents:  
diff
changeset
 | 
23 | 
| 
 
8e608a6e44ac
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/image_processing/imagej2 commit b08f0e6d1546caaf627b21f8c94044285d5d5b9c-dirty"
 
imgteam 
parents:  
diff
changeset
 | 
24 # Create a copy of the image. | 
| 
 
8e608a6e44ac
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/image_processing/imagej2 commit b08f0e6d1546caaf627b21f8c94044285d5d5b9c-dirty"
 
imgteam 
parents:  
diff
changeset
 | 
25 input_image_plus_copy = input_image_plus.duplicate() | 
| 
 
8e608a6e44ac
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/image_processing/imagej2 commit b08f0e6d1546caaf627b21f8c94044285d5d5b9c-dirty"
 
imgteam 
parents:  
diff
changeset
 | 
26 image_processor_copy = input_image_plus_copy.getProcessor() | 
| 
 
8e608a6e44ac
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/image_processing/imagej2 commit b08f0e6d1546caaf627b21f8c94044285d5d5b9c-dirty"
 
imgteam 
parents:  
diff
changeset
 | 
27 bit_depth = image_processor_copy.getBitDepth() | 
| 
 
8e608a6e44ac
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/image_processing/imagej2 commit b08f0e6d1546caaf627b21f8c94044285d5d5b9c-dirty"
 
imgteam 
parents:  
diff
changeset
 | 
28 analyzer = Analyzer( input_image_plus_copy ) | 
| 
 
8e608a6e44ac
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/image_processing/imagej2 commit b08f0e6d1546caaf627b21f8c94044285d5d5b9c-dirty"
 
imgteam 
parents:  
diff
changeset
 | 
29 | 
| 
 
8e608a6e44ac
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/image_processing/imagej2 commit b08f0e6d1546caaf627b21f8c94044285d5d5b9c-dirty"
 
imgteam 
parents:  
diff
changeset
 | 
30 try: | 
| 
 
8e608a6e44ac
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/image_processing/imagej2 commit b08f0e6d1546caaf627b21f8c94044285d5d5b9c-dirty"
 
imgteam 
parents:  
diff
changeset
 | 
31 # Set the conversion options. | 
| 
 
8e608a6e44ac
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/image_processing/imagej2 commit b08f0e6d1546caaf627b21f8c94044285d5d5b9c-dirty"
 
imgteam 
parents:  
diff
changeset
 | 
32 options = [] | 
| 
 
8e608a6e44ac
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/image_processing/imagej2 commit b08f0e6d1546caaf627b21f8c94044285d5d5b9c-dirty"
 
imgteam 
parents:  
diff
changeset
 | 
33 # The following 2 options are applicable only to RGB images. | 
| 
 
8e608a6e44ac
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/image_processing/imagej2 commit b08f0e6d1546caaf627b21f8c94044285d5d5b9c-dirty"
 
imgteam 
parents:  
diff
changeset
 | 
34 if bit_depth == 24: | 
| 
 
8e608a6e44ac
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/image_processing/imagej2 commit b08f0e6d1546caaf627b21f8c94044285d5d5b9c-dirty"
 
imgteam 
parents:  
diff
changeset
 | 
35 if scale_when_converting: | 
| 
 
8e608a6e44ac
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/image_processing/imagej2 commit b08f0e6d1546caaf627b21f8c94044285d5d5b9c-dirty"
 
imgteam 
parents:  
diff
changeset
 | 
36 option.append( "scale" ) | 
| 
 
8e608a6e44ac
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/image_processing/imagej2 commit b08f0e6d1546caaf627b21f8c94044285d5d5b9c-dirty"
 
imgteam 
parents:  
diff
changeset
 | 
37 if weighted_rgb_conversions: | 
| 
 
8e608a6e44ac
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/image_processing/imagej2 commit b08f0e6d1546caaf627b21f8c94044285d5d5b9c-dirty"
 
imgteam 
parents:  
diff
changeset
 | 
38 options.append( "weighted" ) | 
| 
 
8e608a6e44ac
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/image_processing/imagej2 commit b08f0e6d1546caaf627b21f8c94044285d5d5b9c-dirty"
 
imgteam 
parents:  
diff
changeset
 | 
39 # Perform conversion - must happen even if no options are set. | 
| 
 
8e608a6e44ac
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/image_processing/imagej2 commit b08f0e6d1546caaf627b21f8c94044285d5d5b9c-dirty"
 
imgteam 
parents:  
diff
changeset
 | 
40 IJ.run( input_image_plus_copy, "Conversions...", "%s" % " ".join( options ) ) | 
| 
 
8e608a6e44ac
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/image_processing/imagej2 commit b08f0e6d1546caaf627b21f8c94044285d5d5b9c-dirty"
 
imgteam 
parents:  
diff
changeset
 | 
41 if output_type in [ 'List', 'Count' ]: | 
| 
 
8e608a6e44ac
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/image_processing/imagej2 commit b08f0e6d1546caaf627b21f8c94044285d5d5b9c-dirty"
 
imgteam 
parents:  
diff
changeset
 | 
42 # W're generating a tabular file for the output. | 
| 
 
8e608a6e44ac
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/image_processing/imagej2 commit b08f0e6d1546caaf627b21f8c94044285d5d5b9c-dirty"
 
imgteam 
parents:  
diff
changeset
 | 
43 # Set the Find Maxima options. | 
| 
 
8e608a6e44ac
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/image_processing/imagej2 commit b08f0e6d1546caaf627b21f8c94044285d5d5b9c-dirty"
 
imgteam 
parents:  
diff
changeset
 | 
44 options = [ 'noise=%d' % noise_tolerance ] | 
| 
 
8e608a6e44ac
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/image_processing/imagej2 commit b08f0e6d1546caaf627b21f8c94044285d5d5b9c-dirty"
 
imgteam 
parents:  
diff
changeset
 | 
45 if output_type.find( '_' ) > 0: | 
| 
 
8e608a6e44ac
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/image_processing/imagej2 commit b08f0e6d1546caaf627b21f8c94044285d5d5b9c-dirty"
 
imgteam 
parents:  
diff
changeset
 | 
46 output_type_str = 'output=[%s]' % output_type.replace( '_', ' ' ) | 
| 
 
8e608a6e44ac
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/image_processing/imagej2 commit b08f0e6d1546caaf627b21f8c94044285d5d5b9c-dirty"
 
imgteam 
parents:  
diff
changeset
 | 
47 else: | 
| 
 
8e608a6e44ac
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/image_processing/imagej2 commit b08f0e6d1546caaf627b21f8c94044285d5d5b9c-dirty"
 
imgteam 
parents:  
diff
changeset
 | 
48 output_type_str = 'output=%s' % output_type | 
| 
 
8e608a6e44ac
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/image_processing/imagej2 commit b08f0e6d1546caaf627b21f8c94044285d5d5b9c-dirty"
 
imgteam 
parents:  
diff
changeset
 | 
49 options.append( output_type_str ) | 
| 
 
8e608a6e44ac
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/image_processing/imagej2 commit b08f0e6d1546caaf627b21f8c94044285d5d5b9c-dirty"
 
imgteam 
parents:  
diff
changeset
 | 
50 if exclude_edge_maxima: | 
| 
 
8e608a6e44ac
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/image_processing/imagej2 commit b08f0e6d1546caaf627b21f8c94044285d5d5b9c-dirty"
 
imgteam 
parents:  
diff
changeset
 | 
51 options.append( 'exclude' ) | 
| 
 
8e608a6e44ac
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/image_processing/imagej2 commit b08f0e6d1546caaf627b21f8c94044285d5d5b9c-dirty"
 
imgteam 
parents:  
diff
changeset
 | 
52 if light_background: | 
| 
 
8e608a6e44ac
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/image_processing/imagej2 commit b08f0e6d1546caaf627b21f8c94044285d5d5b9c-dirty"
 
imgteam 
parents:  
diff
changeset
 | 
53 options.append( 'light' ) | 
| 
 
8e608a6e44ac
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/image_processing/imagej2 commit b08f0e6d1546caaf627b21f8c94044285d5d5b9c-dirty"
 
imgteam 
parents:  
diff
changeset
 | 
54 # Run the command. | 
| 
 
8e608a6e44ac
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/image_processing/imagej2 commit b08f0e6d1546caaf627b21f8c94044285d5d5b9c-dirty"
 
imgteam 
parents:  
diff
changeset
 | 
55 IJ.run( input_image_plus_copy, "Find Maxima...", "%s" % " ".join( options ) ) | 
| 
 
8e608a6e44ac
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/image_processing/imagej2 commit b08f0e6d1546caaf627b21f8c94044285d5d5b9c-dirty"
 
imgteam 
parents:  
diff
changeset
 | 
56 results_table = analyzer.getResultsTable() | 
| 
 
8e608a6e44ac
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/image_processing/imagej2 commit b08f0e6d1546caaf627b21f8c94044285d5d5b9c-dirty"
 
imgteam 
parents:  
diff
changeset
 | 
57 results_table.saveAs( tmp_output_path ) | 
| 
 
8e608a6e44ac
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/image_processing/imagej2 commit b08f0e6d1546caaf627b21f8c94044285d5d5b9c-dirty"
 
imgteam 
parents:  
diff
changeset
 | 
58 else: | 
| 
 
8e608a6e44ac
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/image_processing/imagej2 commit b08f0e6d1546caaf627b21f8c94044285d5d5b9c-dirty"
 
imgteam 
parents:  
diff
changeset
 | 
59 # Find the maxima of an image (does not find minima). | 
| 
 
8e608a6e44ac
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/image_processing/imagej2 commit b08f0e6d1546caaf627b21f8c94044285d5d5b9c-dirty"
 
imgteam 
parents:  
diff
changeset
 | 
60 # LIMITATIONS: With output_type=Segmented_Particles | 
| 
 
8e608a6e44ac
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/image_processing/imagej2 commit b08f0e6d1546caaf627b21f8c94044285d5d5b9c-dirty"
 
imgteam 
parents:  
diff
changeset
 | 
61 # (watershed segmentation), some segmentation lines | 
| 
 
8e608a6e44ac
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/image_processing/imagej2 commit b08f0e6d1546caaf627b21f8c94044285d5d5b9c-dirty"
 
imgteam 
parents:  
diff
changeset
 | 
62 # may be improperly placed if local maxima are suppressed | 
| 
 
8e608a6e44ac
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/image_processing/imagej2 commit b08f0e6d1546caaf627b21f8c94044285d5d5b9c-dirty"
 
imgteam 
parents:  
diff
changeset
 | 
63 # by the tolerance. | 
| 
 
8e608a6e44ac
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/image_processing/imagej2 commit b08f0e6d1546caaf627b21f8c94044285d5d5b9c-dirty"
 
imgteam 
parents:  
diff
changeset
 | 
64 mf = MaximumFinder() | 
| 
 
8e608a6e44ac
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/image_processing/imagej2 commit b08f0e6d1546caaf627b21f8c94044285d5d5b9c-dirty"
 
imgteam 
parents:  
diff
changeset
 | 
65 if output_type == 'Single_Points': | 
| 
 
8e608a6e44ac
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/image_processing/imagej2 commit b08f0e6d1546caaf627b21f8c94044285d5d5b9c-dirty"
 
imgteam 
parents:  
diff
changeset
 | 
66 output_type_param = mf.SINGLE_POINTS | 
| 
 
8e608a6e44ac
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/image_processing/imagej2 commit b08f0e6d1546caaf627b21f8c94044285d5d5b9c-dirty"
 
imgteam 
parents:  
diff
changeset
 | 
67 elif output_type == 'Maxima_Within_Tolerance': | 
| 
 
8e608a6e44ac
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/image_processing/imagej2 commit b08f0e6d1546caaf627b21f8c94044285d5d5b9c-dirty"
 
imgteam 
parents:  
diff
changeset
 | 
68 output_type_param = mf.IN_TOLERANCE | 
| 
 
8e608a6e44ac
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/image_processing/imagej2 commit b08f0e6d1546caaf627b21f8c94044285d5d5b9c-dirty"
 
imgteam 
parents:  
diff
changeset
 | 
69 elif output_type == 'Segmented_Particles': | 
| 
 
8e608a6e44ac
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/image_processing/imagej2 commit b08f0e6d1546caaf627b21f8c94044285d5d5b9c-dirty"
 
imgteam 
parents:  
diff
changeset
 | 
70 output_type_param = mf.SEGMENTED | 
| 
 
8e608a6e44ac
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/image_processing/imagej2 commit b08f0e6d1546caaf627b21f8c94044285d5d5b9c-dirty"
 
imgteam 
parents:  
diff
changeset
 | 
71 elif output_type == 'List': | 
| 
 
8e608a6e44ac
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/image_processing/imagej2 commit b08f0e6d1546caaf627b21f8c94044285d5d5b9c-dirty"
 
imgteam 
parents:  
diff
changeset
 | 
72 output_type_param = mf.LIST | 
| 
 
8e608a6e44ac
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/image_processing/imagej2 commit b08f0e6d1546caaf627b21f8c94044285d5d5b9c-dirty"
 
imgteam 
parents:  
diff
changeset
 | 
73 elif output_type == 'Count': | 
| 
 
8e608a6e44ac
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/image_processing/imagej2 commit b08f0e6d1546caaf627b21f8c94044285d5d5b9c-dirty"
 
imgteam 
parents:  
diff
changeset
 | 
74 output_type_param = mf.COUNT | 
| 
 
8e608a6e44ac
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/image_processing/imagej2 commit b08f0e6d1546caaf627b21f8c94044285d5d5b9c-dirty"
 
imgteam 
parents:  
diff
changeset
 | 
75 # Get a new byteProcessor with a normal (uninverted) LUT where | 
| 
 
8e608a6e44ac
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/image_processing/imagej2 commit b08f0e6d1546caaf627b21f8c94044285d5d5b9c-dirty"
 
imgteam 
parents:  
diff
changeset
 | 
76 # the marked points are set to 255 (Background 0). Pixels outside | 
| 
 
8e608a6e44ac
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/image_processing/imagej2 commit b08f0e6d1546caaf627b21f8c94044285d5d5b9c-dirty"
 
imgteam 
parents:  
diff
changeset
 | 
77 # of the roi of the input image_processor_copy are not set. No | 
| 
 
8e608a6e44ac
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/image_processing/imagej2 commit b08f0e6d1546caaf627b21f8c94044285d5d5b9c-dirty"
 
imgteam 
parents:  
diff
changeset
 | 
78 # output image is created for output types POINT_SELECTION, LIST | 
| 
 
8e608a6e44ac
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/image_processing/imagej2 commit b08f0e6d1546caaf627b21f8c94044285d5d5b9c-dirty"
 
imgteam 
parents:  
diff
changeset
 | 
79 # and COUNT. In these cases findMaxima returns null. | 
| 
 
8e608a6e44ac
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/image_processing/imagej2 commit b08f0e6d1546caaf627b21f8c94044285d5d5b9c-dirty"
 
imgteam 
parents:  
diff
changeset
 | 
80 byte_processor = mf.findMaxima( image_processor_copy, | 
| 
 
8e608a6e44ac
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/image_processing/imagej2 commit b08f0e6d1546caaf627b21f8c94044285d5d5b9c-dirty"
 
imgteam 
parents:  
diff
changeset
 | 
81 noise_tolerance, | 
| 
 
8e608a6e44ac
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/image_processing/imagej2 commit b08f0e6d1546caaf627b21f8c94044285d5d5b9c-dirty"
 
imgteam 
parents:  
diff
changeset
 | 
82 ImageProcessor.NO_THRESHOLD, | 
| 
 
8e608a6e44ac
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/image_processing/imagej2 commit b08f0e6d1546caaf627b21f8c94044285d5d5b9c-dirty"
 
imgteam 
parents:  
diff
changeset
 | 
83 output_type_param, | 
| 
 
8e608a6e44ac
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/image_processing/imagej2 commit b08f0e6d1546caaf627b21f8c94044285d5d5b9c-dirty"
 
imgteam 
parents:  
diff
changeset
 | 
84 exclude_edge_maxima, | 
| 
 
8e608a6e44ac
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/image_processing/imagej2 commit b08f0e6d1546caaf627b21f8c94044285d5d5b9c-dirty"
 
imgteam 
parents:  
diff
changeset
 | 
85 False ) | 
| 
 
8e608a6e44ac
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/image_processing/imagej2 commit b08f0e6d1546caaf627b21f8c94044285d5d5b9c-dirty"
 
imgteam 
parents:  
diff
changeset
 | 
86 # Invert the image or ROI. | 
| 
 
8e608a6e44ac
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/image_processing/imagej2 commit b08f0e6d1546caaf627b21f8c94044285d5d5b9c-dirty"
 
imgteam 
parents:  
diff
changeset
 | 
87 byte_processor.invert() | 
| 
 
8e608a6e44ac
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/image_processing/imagej2 commit b08f0e6d1546caaf627b21f8c94044285d5d5b9c-dirty"
 
imgteam 
parents:  
diff
changeset
 | 
88 if output_type == 'Segmented_Particles' and not light_background: | 
| 
 
8e608a6e44ac
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/image_processing/imagej2 commit b08f0e6d1546caaf627b21f8c94044285d5d5b9c-dirty"
 
imgteam 
parents:  
diff
changeset
 | 
89 # Invert the values in this image's LUT (indexed color model). | 
| 
 
8e608a6e44ac
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/image_processing/imagej2 commit b08f0e6d1546caaf627b21f8c94044285d5d5b9c-dirty"
 
imgteam 
parents:  
diff
changeset
 | 
90 byte_processor.invertLut() | 
| 
 
8e608a6e44ac
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/image_processing/imagej2 commit b08f0e6d1546caaf627b21f8c94044285d5d5b9c-dirty"
 
imgteam 
parents:  
diff
changeset
 | 
91 image_plus = ImagePlus( "output", byte_processor ) | 
| 
 
8e608a6e44ac
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/image_processing/imagej2 commit b08f0e6d1546caaf627b21f8c94044285d5d5b9c-dirty"
 
imgteam 
parents:  
diff
changeset
 | 
92 IJ.saveAs( image_plus, output_datatype, tmp_output_path ) | 
| 
 
8e608a6e44ac
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/image_processing/imagej2 commit b08f0e6d1546caaf627b21f8c94044285d5d5b9c-dirty"
 
imgteam 
parents:  
diff
changeset
 | 
93 except Exception, e: | 
| 
 
8e608a6e44ac
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/image_processing/imagej2 commit b08f0e6d1546caaf627b21f8c94044285d5d5b9c-dirty"
 
imgteam 
parents:  
diff
changeset
 | 
94 jython_utils.handle_error( error_log, str( e ) ) | 
