Page 1 of 2

testing new reader

PostPosted: Tue Jun 19, 2018 6:33 am
by Albin
Hi all,

I am currently working on writing a reader for .ISQ format in java. As I have understood it to be able to test the code with ImageInfo (which is referred to here https://docs.openmicroscopy.org/bio-for ... guide.html) I need to add that format into the library in a file called reader.txt.
Is there any workaround or do I need to start contribute to their Github already (https://github.com/openmicroscopy/biofo ... eInfo.java)?

Thanks!
/Albin

Re: testing new reader

PostPosted: Tue Jun 19, 2018 10:19 am
by dgault
Hi Albin,

You will be able to test your reader without having to modify and rebuild the Bio-Formats code. The new class can be built into a separate JAR and as long as your reader uses the package name loci.formats.in and is included on the Java classpath then you will be able to test it with the command line tools.

For example you can then run
Code: Select all
showinf -format ISQ /path/to/test/file
and the showinf tool will try to locate the reader loci.formats.in.ISQReader

David Gault

Re: testing new reader

PostPosted: Tue Jun 19, 2018 11:46 am
by Albin
Hi,

Thanks a lot one step in right direction!

Now I get this error
"Unknown reader: ISQ
Exception in thread "main" loci.formats.UnknownFormatException: Unknown file format: /Users/Hedwall/Desktop/C0003094.ISQ
at loci.formats.ImageReader.getReader(ImageReader.java:197)
at loci.formats.ImageReader.getFormat(ImageReader.java:156)
at loci.formats.tools.ImageInfo.configureReaderPreInit(ImageInfo.java:433)
at loci.formats.tools.ImageInfo.testRead(ImageInfo.java:1029)
at loci.formats.tools.ImageInfo.main(ImageInfo.java:1120)"

Is my java class/JAR placed wrong or why does it now recognise the format? Might be a code fault as well?

/Albin

Re: testing new reader

PostPosted: Tue Jun 19, 2018 3:42 pm
by dgault
It is most likely that the Jar is not found on the Java classpath, having it in the same folder as the bioformats_package.jar should also work. Otherwise it is worth checking that the package name for the reader is correct
loci.formats.in
and that the reader name matches (so using the option -format ISQ will see it looking for a reader with the name ISQReader).

Re: testing new reader

PostPosted: Wed Jun 20, 2018 1:48 pm
by Albin
I have now tried to move the Jar everywhere and not any place work... I have also multi checked the naming everywhere still no luck. I have also added my reader to the reader.txt with a texteditor, but it feels like it did not matter because I can delete everything in the file and when trying with a Nifti file it still works, thoughts?

The only thing I can think of is that I have three copies of bioformats_package.jar in total on my ssd, is this bad? The Showinf won't even reach my reader and I still get unknown file format error.

Requesting assistance!

// Albin

Re: testing new reader

PostPosted: Thu Jun 21, 2018 9:32 am
by Albin
We now tested that it does find the folder with ISQReader.jar because it does use the bioformats_package.jar in that folder.
Still with -format ISQ we get Unknown file format. The source code (ISQReader.java) remains in loci.formats.in like the other readers while ISQReader.jar is placed in bioformats/tools together with the bioformats_package.jar

Re: testing new reader

PostPosted: Thu Jun 21, 2018 10:03 am
by sbesson
Hi Albin,

sorry for the confusion. I tested this workflow with another external reader,the 3i Slidebook reader. Opening a Slidebook SLD file with the default command-line tools using our internal SlidebookReader:

Code: Select all
sbesson@ls30630:tmp $ showinf seewald_five.sld -nopix | grep initializing
SlidebookReader initializing seewald_five.sld


To update the command-line tools to consume the 3i Slidebook6Reader, as you confirmed, just putting the new JAR under the same folder as bioformats_package.jar is not sufficient. The most efficient way to extend the command-line tools classpath is to use the BF_CP environment variable i.e.

Code: Select all
sbesson@ls30630:tmp $ BF_CP=/tmp/SlideBook6Reader.jar showinf seewald_five.sld -nopix | grep initializing
SlideBook6Reader initializing seewald_five.sld


Can you test whether this works in your case? If not, it might be useful to see your source code for the new reader e.g. on GitHub.

Best,
Sebastien

Re: testing new reader

PostPosted: Thu Jun 21, 2018 10:51 am
by Albin
Albins-MacBook-Pro:~ Hedwall$ BF_CP=/Users/Hedwall/bioformats/tools/showinf /Users/Hedwall/Desktop/C0003094.ISQ -nopix | grep initializing /Users/Hedwall/bioformats/tools/ISQReader.jar initializing /Users/Hedwall/Desktop/C0003094.ISQ
-bash: /Users/Hedwall/Desktop/C0003094.ISQ: cannot execute binary file
grep: initializing: No such file or directory

If I used your command correctly, this is what I got


//Albin

Re: testing new reader

PostPosted: Thu Jun 21, 2018 10:55 am
by sbesson
Can you try

Code: Select all
BF_CP=/Users/Hedwall/bioformats/tools/ISQReader.jar /Users/Hedwall/bioformats/tools/showinf /Users/Hedwall/Desktop/C0003094.ISQ -nopix | grep initializing


Best,
Sebastien

Re: testing new reader

PostPosted: Thu Jun 21, 2018 11:00 am
by Albin
Albins-MacBook-Pro:~ Hedwall$ BF_CP=/Users/Hedwall/bioformats/tools/ISQReader.jar /Users/Hedwall/bioformats/tools/showinf /Users/Hedwall/Desktop/C0003094.ISQ -nopix | grep initializing
Exception in thread "main" loci.formats.UnknownFormatException: Unknown file format: /Users/Hedwall/Desktop/C0003094.ISQ
at loci.formats.ImageReader.getReader(ImageReader.java:197)
at loci.formats.ImageReader.getFormat(ImageReader.java:156)
at loci.formats.tools.ImageInfo.configureReaderPreInit(ImageInfo.java:433)
at loci.formats.tools.ImageInfo.testRead(ImageInfo.java:1029)
at loci.formats.tools.ImageInfo.main(ImageInfo.java:1120)

Does it even reach my code part now? I am so lost