Quantcast

Exporting 16-bit image from TrakEM2?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
mer
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Exporting 16-bit image from TrakEM2?

mer
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
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Exporting 16-bit image from TrakEM2?

Albert Cardona-2
The error means: select one Patch, currently none are selected and therefore index 0 is out of bounds.

Albert, TrakEM2 main author.


> On Apr 26, 2017, at 5:08 PM, mer <[hidden email]> wrote:
>
> 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
>
>
>
> --
> View this message in context: http://imagej.1557.x6.nabble.com/Exporting-16-bit-image-from-TrakEM2-tp5018618.html
> Sent from the ImageJ mailing list archive at Nabble.com.
>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Loading...