Just to get you started…
using JavaCall
try
# init JVM wtih bioformats_package.jar on classpath
JavaCall.init(["-ea", "-Xmx1024M", "-Djava.class.path=bioformats_package.jar"])
end
# import java classes
const JChannelFiller = @jimport loci.formats.ChannelFiller
const JChannelSeparator = @jimport loci.formats.ChannelSeparator
const JOMEXMLServiceImpl = @jimport loci.formats.services.OMEXMLServiceImpl
const JOMEXMLMetadata = @jimport loci.formats.ome.OMEXMLMetadata
const JOMEXMLService = @jimport loci.formats.services.OMEXMLService
const JMetadataStore = @jimport loci.formats.meta.MetadataStore
# example of how get_angles function may look like
function get_angles(obj, full_filename)
ret = []
try
# same as `new ChannelFiller()`
# empty tuple `()` here means that constructor doesn't take any args
r = JChannelFiller(())
# same as new ChannelSeparator(r)
# again, first argument - `(JChannelFiller,)` - a tuple of input types
# the rest - `r` - is a list of actual arguments
r = JChannelSeparator((JChannelFiller,), r)
# same as `new OMEXMLServiceImpl()`
OMEXMLService = JOMEXMLServiceImpl(())
# same as `meta = OMEXMLService.createMEXMLMetadata()`
meta = jcall(OMEXMLService, "createOMEXMLMetadata", JOMEXMLMetadata, ())
# same as `r.setMetadataStore(meta)`
jcall(r, "setMetadataStore", Void, (JMetadataStore,), meta)
...
end
end
As you may guess, I know nothing about the domain or BioFormats, so it’s mostly just a hint for you to see how it may look like. Basically, you need to learn how to:
- Add
.jarfiles usingJavaCall.init() - Import Java classes using
@jimport. - Create new objects using constructor syntax, e.g.
r = JChannelFiller(()). - Call methods using
jcall, e.g.jcall(r, "setMetadataStore", Void, (JMetadataStore,), meta).
So I think it’s pretty doable.
Note that this example requires bioformats_package.jar and some other lib because creating ChannelFiller throws:
ClassNotFoundException: loci.formats.in.SlideBook6Reader