annotate imagej2_create_image_jython_script.py @ 2:756e062741dc draft default tip

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:57:39 +0000
parents 7a44772cc89f
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
3f6599ec7d30 "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
7a44772cc89f "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/image_processing/imagej2 commit 2afb24f3c81d625312186750a714d702363012b5"
imgteam
parents: 0
diff changeset
2
0
3f6599ec7d30 "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
3f6599ec7d30 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/image_processing/imagej2 commit b08f0e6d1546caaf627b21f8c94044285d5d5b9c-dirty"
imgteam
parents:
diff changeset
4
3f6599ec7d30 "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
3f6599ec7d30 "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
7a44772cc89f "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/image_processing/imagej2 commit 2afb24f3c81d625312186750a714d702363012b5"
imgteam
parents: 0
diff changeset
7 title = sys.argv[-6]
7a44772cc89f "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/image_processing/imagej2 commit 2afb24f3c81d625312186750a714d702363012b5"
imgteam
parents: 0
diff changeset
8 width = int(sys.argv[-5])
7a44772cc89f "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/image_processing/imagej2 commit 2afb24f3c81d625312186750a714d702363012b5"
imgteam
parents: 0
diff changeset
9 height = int(sys.argv[-4])
7a44772cc89f "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/image_processing/imagej2 commit 2afb24f3c81d625312186750a714d702363012b5"
imgteam
parents: 0
diff changeset
10 depth = int(sys.argv[-3])
2
756e062741dc planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/image_processing/imagej2 commit 57a0433defa3cbc37ab34fbb0ebcfaeb680db8d5
imgteam
parents: 1
diff changeset
11 type = sys.argv[-2].replace("_", " ")
1
7a44772cc89f "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/image_processing/imagej2 commit 2afb24f3c81d625312186750a714d702363012b5"
imgteam
parents: 0
diff changeset
12 tmp_image_path = sys.argv[-1]
0
3f6599ec7d30 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/image_processing/imagej2 commit b08f0e6d1546caaf627b21f8c94044285d5d5b9c-dirty"
imgteam
parents:
diff changeset
13
1
7a44772cc89f "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/image_processing/imagej2 commit 2afb24f3c81d625312186750a714d702363012b5"
imgteam
parents: 0
diff changeset
14 imp = IJ.newImage(title, type, width, height, depth)
7a44772cc89f "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/image_processing/imagej2 commit 2afb24f3c81d625312186750a714d702363012b5"
imgteam
parents: 0
diff changeset
15 IJ.save(imp, "%s" % tmp_image_path)