I found this JS script for doing the latter part here:
- Code: Select all
importClass(Packages.loci.plugins.BF);
importClass(Packages['loci.plugins.in.ImporterOptions']); // 'in' is a reserved word, hence the different syntax
importClass(Packages.loci.common.Region);
var path = "/path/to/file";
var options = new ImporterOptions();
options.setId(path);
options.setAutoscale(true);
options.setCrop(true);
options.setCropRegion(0, new Region(x, y, w. h));
options.setColorMode(ImporterOptions.COLOR_MODE_COMPOSITE);
var imps = BF.openImagePlus(options);
imps[0].show();
I also found the file open dialog here:
- Code: Select all
File.openDialog(title)
How do I do both of these things in a JS script? Specifically, how do I create the file open dialog in JS?
If it is easier to do both in a macro ijm script, then how do I access BF and set the import options?