Imglyb + BigDataViewer

Thanks @hanslovsky and @ctrueden.


didn’t seem to work. I’ll try wrapping a local Fiji installation as you suggested. Would this carry over into impacting the functionality of imglyb? Or would it only ensure that if I called BDV or BigStitcher through pyimagej that the correct B3D JAR is found?

Anyway I’ll try it tomorrow and report back on the result(s).


The code is now working as I had initially wanted. I am able to use imglyb to visualize the BigStitcher style H5/XML files on the fly in BDV. Thank you @hanslovsky @ctrueden and @tpietzsch for your help and input. The last error I had was because of the B3D compression, but using @ctrueden advice fixed the problem by adding the jhdf5 JAR specifically to the class path. Below is the working code - thanks everyone!

import jnius_config
import tempfile
tmp_dir = tempfile.mkdtemp()

import imagej
ij = imagej.init('C:\\Users\\AERB\\Documents\\', headless = False)

import pathlib
import subprocess
import os
from jnius import autoclass

java_code = '''
import java.util.List;
import bdv.util.BdvStackSource;
import bdv.util.BdvFunctions;

public class MyShow
	public static List< BdvStackSource< ? > > show( final AbstractSpimData< ? > spimData )
		return spimData );

fp = pathlib.Path(tmp_dir) / ''
with open(fp, 'w') as f:

javac = pathlib.Path(os.environ[ 'JAVA_HOME' ]) / 'bin' / 'javac'

proc = 
    [ str(javac), '-cp', str(jnius_config.split_char.join( jnius_config.get_classpath()) ), str(fp) ],

if proc.returncode != 0:
	print (proc.stderr)

MyShow = autoclass('MyShow')

xmlFilename = 'Y:\\test\\data.xml'

spimData = autoclass('bdv.spimdata.SpimDataMinimal')
spimXML = autoclass('bdv.spimdata.XmlIoSpimDataMinimal')

spimData = spimXML().load(xmlFilename)

Glad to hear you got it to work and thank you for sharing the code. If this solves your initial question, you can mark any post as a answer for this thread and the forum will show this with a check mark. In this case it’s probably best to mark your own reply as the answer.

1 Like