Posted by
Albert Cardona-2 on
Mar 12, 2018; 3:33pm
URL: http://imagej.273.s1.nabble.com/TrakEM-question-tp5020256p5020268.html
Hi Kenneth,
Glad you find TrakEM2 useful.
Internally, TrakEM2 organizes data as a list of 2D planes. Each plane,
or section, is modeled by a "Layer" object. The list of Layer
instances is the LayerSet.
As you point out, your volume is too large for visualization as an
orthoslices at 100 % resolution, and you have two parameters to play
with: the ROI to restrict to a subvolume, and the magnification.
Here is a script that uses both, in jython, and opens an image stack.
It requires:
1. That a TrakEM2 project is open.
2. That an ROI is draw using the rectangle tool (optional).
3. Write in the first and last sections (indices, not Z) that you want
to include).
Will produce 8-bit images. If you want RGB, use ImagePlus.COLOR_RGB in
the getFlatImage function. (GRAY16 and GRAY32 won't work.)
For 16-bit, use the ExportUnsignedShort.makeFlatImage method instead.
If you are intending to visualize the entire volume rather than a
small bit, there are alternatives.
For one, consider exporting the data as N5
(
https://github.com/saalfeldlab/n5) and then using the BigDataViewer
or the BigCAT to visualize the volume in arbitrary zooms and
rotations, as well as orthoslices. With compression, the data would
take about 50% of the current storage space.
Another option is to view the whole TrakEM2 projevt volume as an
ImgLib2 RandomAccessibleInterval (ask Stephan Saalfeld about the
script), and then using whatever ImgLib2-based tools you like to crop,
process, or visualize, including the BigDataViewer.
Yet another option is to export the data for CATMAID (see:
https://github.com/axtimwalde/fiji-scripts/blob/master/TrakEM2/catmaid-export2.bsh).
Best,
Albert
####################
# Export an ImageStack from a range of TrakEM2 layers
from ini.trakem2.display import Display, Displayable
from ij import ImagePlus, ImageStack
# zero-based index:
index_first_section = 10
index_last_section = 20
magnification = 0.25
front = Display.getFront()
layerset = front.getLayerSet()
layers = layerset.getLayers().subList(index_first_section,
index_last_section + 1)
loader = layerset.getProject().getLoader()
# Can be null
roi = front.getRoi()
# The whole 2D area, or just that of the ROI
bounds = roi.getBounds() if roi else layerset.get2DBounds()
stack = ImageStack(int(bounds.width * magnification + 0.5),
int(bounds.height * magnification + 0.5))
print stack
for layer in layers:
imp = loader.getFlatImage(layer, bounds, magnification, -1,
ImagePlus.GRAY8, Displayable, False)
stack.addSlice(imp.getProcessor())
ImagePlus("stack", stack).show()
###################
2018-03-10 9:20 GMT-05:00 Kenneth Sloan <
[hidden email]>:
> We are using TrakEM to look at a stack of EM images. It works great!
>
> But, we would like to generate orthogonal views of the stack of images.
>
> I am, alas, completely ignorant of how TrakEM manages the images (multiple tiles, multiple slices).
>
> It seems clear that the image displayed by ImageJ is not a "stack" as far as ImageJ is concerned.
> Any attempt to select that window and apply any Stack command fails miserably ("must be a stack").
> I didn't really think that would work, but I tried it.
>
> So...is there a way to produce a (perhaps low resolution, perhaps a limited "brick") stack that can be treated as a normal ImageJ stack of images, so that we could use (for example) "Orthogonal Views").
>
> I expect this will be expensive. The data set is 10-20TB. So, the key is probably "lower resolution or restricted region in x,y,z"
>
> --
> Kenneth Sloan
>
[hidden email]
> Vision is the art of seeing what is invisible to others.
>
> --
> ImageJ mailing list:
http://imagej.nih.gov/ij/list.html--
http://albert.rierol.nethttp://www.janelia.org/lab/cardona-labhttps://www.pdn.cam.ac.uk/directory/albert-cardona--
ImageJ mailing list:
http://imagej.nih.gov/ij/list.html