Login  Register

Exporting 16-bit image from TrakEM2?

Posted by mer on Apr 26, 2017; 9:08pm
URL: http://imagej.273.s1.nabble.com/Exporting-16-bit-image-from-TrakEM2-tp5018618.html

Hi!

I am using TrakEM2 to manually register images. I'd like to save the registered images as 16-bit greyscale.

I thought I found the solution to this with the following script from: http://imagej.net/TrakEM2_Scripting

1 from ini.trakem2.display import Display, Patch
2 from java.awt import Color
3
4 front = Display.getFront() # the active TrakEM2 display window
5 layer = front.getLayer()
6 tiles = front.getSelection().get(Patch)  # selected Patch instances only
7 backgroundColor = Color.black
8 scale = 1.0
9
10 roi = tiles[0].getBoundingBox()
11 for tile in tiles[1:]:
12  roi.add(tile.getBoundingBox())
13
14 print "Creating flat image from", len(tiles), "image tiles"
15  
16 ip = Patch.makeFlatImage(
17           ImagePlus.GRAY16,
18           layer,
19           roi,
20           scale,
21           tiles,
22           backgroundColor,
23           True)  # use the min and max of each tile
24
25 imp = ImagePlus("Flat montage", ip)
26 imp.show()

buuuut I seem to be getting an error: "line 10, in <module> IndexError: index out of range"

I'm not the most scripting-savvy of researchers and my troubleshooting attempts have failed--Anyone more experienced have thoughts on this?

Please and Thanks,

M