Bioformats in Julia?

BTW by some reason I wasn’t able to apply “imwrite” function, got “not defined” error.

Not quite sure what you mean exactly, but FYI other readers like ImageMagick use load and save for image I/O, as defined by the FileIO.jl package. I’m not aware of a definition for imwrite.

one can found several places where it was mentioned, e.g.

the last post there, it looks like, yours.

I tried “save” but got errors as well, likely some package wrongly installed. I’ll check it in Monday.

2014 was so last-century. I’d even forgotten we ever had imwrite.

3 Likes

I now have acceptable route for OPT images’ processing, that combines several ideas advised by the community:

  1. “load” - from Julia
  2. reading angles metadata from Bioformats accessed via JavaCall, using XML for parsing
  3. … reconstructing …
  4. “save” - also from Julia

(code is below)

There is one mysterious thing that is still unsolved.
It isn’t likely to be major, but anyway.
I specify for “save” procedure explicitly that it should interpret the reconstruction (3D stack of images) as XYZ but not XYT.
When I load the saved tiff image to ImageJ, I can see that it is XYZ.
However, when I open the same image via another app that uses Bioformats , e.g. Icy, it interprets this image as XYT.
Maybe someone has an idea how to fix this?

# get angles
r = bfGetReader(src_img_filename)
angles = bfGetModulo(r,"Z")
jcall(r, "close", Void, ())

# get projections
proj = convert(Array{Float64,3},load(src_img_filename))

# ..do reconstruction using "proj" and "angles"

save(dst_img_filename,
colorview(Gray,AxisArray(normedview(convert(Array{Normed{UInt16,16},3},reconstruction)),:x,:y,:z)))
1 Like

In case anyone here is interested, I wrote a package to open OME-TIFF files in Julia: GitHub - tlnagy/OMETIFF.jl: I/O operations for OME-TIFF files in Julia

using FileIO
load("path/to/file.ome.tiff")

It’s new and still has some limitations (as of 17-08-22)[1]

  • No support for files >4gb
  • TIFFs split across multiple files don’t work either

but it can open all the basic OME-TIFF files from the openmicroscopy.org spec page and load them into the Images.jl framework.


  1. I hope to implement these eventually. ↩︎

1 Like

Fantastic work! Really happy to see this.

1 Like

I see a related package based on JavaCall.jl:
https://github.com/ahnlabb/BioformatsLoader.jl