Mercurial > repos > imgteam > imagej2_find_edges
annotate imagej2_sharpen_jython_script.py @ 3:633bea9c8ee0 draft default tip
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/image_processing/imagej2 commit 8f49f3c66b5a1de99ec15e65c2519a56792f1d56
| author | imgteam | 
|---|---|
| date | Wed, 25 Sep 2024 15:57:43 +0000 | 
| parents | c8dfbf4b899c | 
| children | 
| 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 | 
| 1 
c8dfbf4b899c
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/image_processing/imagej2 commit 2afb24f3c81d625312186750a714d702363012b5"
 imgteam parents: 
0diff
changeset | 2 | 
| 0 
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 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 | 
| 
8e608a6e44ac
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/image_processing/imagej2 commit b08f0e6d1546caaf627b21f8c94044285d5d5b9c-dirty"
 imgteam parents: diff
changeset | 5 # 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 | 6 # provide support for argparse. | 
| 1 
c8dfbf4b899c
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/image_processing/imagej2 commit 2afb24f3c81d625312186750a714d702363012b5"
 imgteam parents: 
0diff
changeset | 7 input_file = sys.argv[-3] | 
| 
c8dfbf4b899c
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/image_processing/imagej2 commit 2afb24f3c81d625312186750a714d702363012b5"
 imgteam parents: 
0diff
changeset | 8 tmp_output_path = sys.argv[-2] | 
| 
c8dfbf4b899c
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/image_processing/imagej2 commit 2afb24f3c81d625312186750a714d702363012b5"
 imgteam parents: 
0diff
changeset | 9 output_datatype = sys.argv[-1] | 
| 0 
8e608a6e44ac
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/image_processing/imagej2 commit b08f0e6d1546caaf627b21f8c94044285d5d5b9c-dirty"
 imgteam parents: diff
changeset | 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 # Open the input image file. | 
| 1 
c8dfbf4b899c
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/image_processing/imagej2 commit 2afb24f3c81d625312186750a714d702363012b5"
 imgteam parents: 
0diff
changeset | 12 input_image_plus = IJ.openImage(input_file) | 
| 0 
8e608a6e44ac
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/image_processing/imagej2 commit b08f0e6d1546caaf627b21f8c94044285d5d5b9c-dirty"
 imgteam parents: diff
changeset | 13 | 
| 
8e608a6e44ac
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/image_processing/imagej2 commit b08f0e6d1546caaf627b21f8c94044285d5d5b9c-dirty"
 imgteam parents: diff
changeset | 14 # 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 | 15 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 | 16 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 | 17 | 
| 1 
c8dfbf4b899c
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/image_processing/imagej2 commit 2afb24f3c81d625312186750a714d702363012b5"
 imgteam parents: 
0diff
changeset | 18 # Run the command. | 
| 
c8dfbf4b899c
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/image_processing/imagej2 commit 2afb24f3c81d625312186750a714d702363012b5"
 imgteam parents: 
0diff
changeset | 19 IJ.run(input_image_plus_copy, "Sharpen", "") | 
| 
c8dfbf4b899c
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/image_processing/imagej2 commit 2afb24f3c81d625312186750a714d702363012b5"
 imgteam parents: 
0diff
changeset | 20 # Save the ImagePlus object as a new image. | 
| 
c8dfbf4b899c
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/image_processing/imagej2 commit 2afb24f3c81d625312186750a714d702363012b5"
 imgteam parents: 
0diff
changeset | 21 IJ.saveAs(input_image_plus_copy, output_datatype, tmp_output_path) | 
