These are chat archives for fiji/fiji

24th
Aug 2018
Jan Eglinger
@imagejan
Aug 24 2018 14:14
Can I run BF.openImagePlus("somePath") headless in a unit test? I'm getting NullPointers without any meaningful stack trace when I try it, even with a "[...].fake" path.
Are there any examples out there where this is done in a test?
Curtis Rueden
@ctrueden
Aug 24 2018 18:15
@imagejan I would be surprised if it works, due to Bio-Formats's extension of the GenericDialog class.
I think I tried running it headless once, and got frustrated as well.
Can you use ij.scifio().datasetIO().open(...) instead? That's headless.
Jan Eglinger
@imagejan
Aug 24 2018 19:29
@ctrueden thanks. I tried using SCIFIO as well (adding sci-fi-bf-compatas a dependency, because I need to open a Metamorph nd dataset), but also got a single NullPointer in the test, without a stack trace (except the ones thrown as warning during Bio-Formats discovery of reader classes). Will investigate more next week.
Curtis Rueden
@ctrueden
Aug 24 2018 19:39
$ Fiji.app/Contents/MacOS/ImageJ-macosx --ij2 --headless --run ~/Desktop/print-dims.groovy 'filename="/Users/curtis/data/goliath/unsorted/2011-11-01/DOX FAZ1 568 PLK 4881.nd"'
MetamorphReader initializing /Users/curtis/data/goliath/unsorted/2011-11-01/DOX FAZ1 568 PLK 4881.nd
Initializing /Users/curtis/data/goliath/unsorted/2011-11-01/DOX FAZ1 568 PLK 4881.nd
Looking for STK file in /Users/curtis/data/goliath/unsorted/2011-11-01
Reading IFDs
Populating metadata
Populating OME metadata
Reading IFDs
Populating metadata
Populating OME metadata
Reading IFDs
Populating metadata
Populating OME metadata
Reading IFDs
Populating metadata
Populating OME metadata
Reading IFDs
Populating metadata
Populating OME metadata
1600
1200
41
4
And the contents of print-dims.groovy:
#@ ImageJ ij
#@ String filename

dataset = ij.scifio().datasetIO().open(filename)

for (d = 0; d < dataset.numDimensions(); d++) {
  println(dataset.dimension(d))
}

@imagejan I also tried adding the following lines:

import loci.plugins.BF
imp = BF.openImagePlus(filename)
println(imp)

And it also works headless; after reading the data again I see:

[img["DOX FAZ1 568 PLK 4881_w1Cy3.stk" (-3), 16-bit, 1600x1200x4x41x1]]
So there is something weird about your environment.