export images after open xml file

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

export images after open xml file

Ken Nguyen
Hi

I have an xml file that created 6 years ago.  I can open in imageJ with TrakEM2.  I can see many layers contain montage TEM images, and many layers are missing.  When I try to export images from the layer that I see, it blanks out with no real TEM images.  I look into system log, it gives me a comment as below:

done recreateBuckets chunk
Crash detector file is G:/Pristionchus/Series15/trakem2.1283239982185.2011277730.99217/trakem2.mipmaps/.open.t2
waiting for TMLHandler fus...
done waiting TMLHandler fus.
Created crash detection system.
removing kl: javax.swing.plaf.basic.BasicTreeUI$Handler@66247465
removing kl: javax.swing.plaf.basic.BasicTreeUI$Handler@a0e1bff
removing kl: javax.swing.plaf.basic.BasicTreeUI$Handler@27a3821c
B set to false
Done Opening displays (1.55s approx.)
C set to false
File not found: G:/Pristionchus/Series15/trakem2.1283239982185.2011277730.99217/trakem2.mipmaps/4/22/67/9.8524_Montage Acquisition0003.dm3.rag
SUBMITTING to regen 8524_Montage Acquisition0003.dm3 z=3080.0 #22679

As I understand that it tries to regenerate mipmaps from original montage files, but I don't have them except xml file.  Is there away the I can export the layer images?  Thanks

Ken

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: export images after open xml file

Albert Cardona-2
Hi Ken,

Some TrakEM2 commands export using the original data, and some use the
mipmaps if available. Check e.g. the "Export - Export for web" menu
item from the right-click menu which lets you choose to use mipmaps
for exporting.

Otherwise, more control is available from a script. For example, use,
from the Script Editor in Jython:

# See:
# https://github.com/trakem2/TrakEM2/blob/master/src/main/java/mpicbg/trakem2/transform/ExportBestFlatImage.java

from ini.trakem2.display import Display, Patch
from mpicbg.trakem2.transform import ExportBestFlatImage
from ij import IJ, ImagePlus

backgroundValue = 0 # black
scale = 1.0 # 100% magnification

display = Display.getFront() # Make sure your TrakEM2 project is open
first and a display shows!
patches = display.getLayer().getDisplayables(Patch)
bounds = display.getLayerSet().get2DBounds() # the whole layer

exporter = ExportBestFlatImage(patches, bounds, backgroundValue, scale)

# Option 1: an 8-bit ByteProcessor in greyscale
bp = exporter.makeGrayFlatImage()

# Option 2: 8-bit grayscape and a mask, but both in FloatProcessor
pair = exporter.makeFlatFloatGrayImageAndAlpha()
fp = pair.a
mask = pair.b

# Save as a PNG:
imp = ImagePlus("layer_ + str(display.getLayer().getZ()), bp)
FileSaver(imp).saveAsPng("/path/to/folder/" + imp.getTitle() + ".png")


To export each layer independently, run the above on a loop of all layers, like:

for layer in display.getLayerSet().getLayers():
  # export:
  ...


Hope this helps.

Albert

Missatge de Ken Nguyen <[hidden email]> del dia dc., 3 de
febr. 2021 a les 18:57:

>
> Hi
>
> I have an xml file that created 6 years ago.  I can open in imageJ with TrakEM2.  I can see many layers contain montage TEM images, and many layers are missing.  When I try to export images from the layer that I see, it blanks out with no real TEM images.  I look into system log, it gives me a comment as below:
>
> done recreateBuckets chunk
> Crash detector file is G:/Pristionchus/Series15/trakem2.1283239982185.2011277730.99217/trakem2.mipmaps/.open.t2
> waiting for TMLHandler fus...
> done waiting TMLHandler fus.
> Created crash detection system.
> removing kl: javax.swing.plaf.basic.BasicTreeUI$Handler@66247465
> removing kl: javax.swing.plaf.basic.BasicTreeUI$Handler@a0e1bff
> removing kl: javax.swing.plaf.basic.BasicTreeUI$Handler@27a3821c
> B set to false
> Done Opening displays (1.55s approx.)
> C set to false
> File not found: G:/Pristionchus/Series15/trakem2.1283239982185.2011277730.99217/trakem2.mipmaps/4/22/67/9.8524_Montage Acquisition0003.dm3.rag
> SUBMITTING to regen 8524_Montage Acquisition0003.dm3 z=3080.0 #22679
>
> As I understand that it tries to regenerate mipmaps from original montage files, but I don't have them except xml file.  Is there away the I can export the layer images?  Thanks
>
> Ken
>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html

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