We're Hiring!

testing new reader

Historical discussions about the Bio-Formats library. Please look for and ask new questions at https://forum.image.sc/tags/bio-formats
Please note:
Historical discussions about the Bio-Formats library. Please look for and ask new questions at https://forum.image.sc/tags/bio-formats

If you are having trouble with image files, there is information about reporting bugs in the Bio-Formats documentation. Please send us the data and let us know what version of Bio-Formats you are using. For issues with your code, please provide a link to a public repository, ideally GitHub.

testing new reader

Postby Albin » Tue Jun 19, 2018 6:33 am

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
Albin
 
Posts: 22
Joined: Mon Jun 18, 2018 12:23 pm

Re: testing new reader

Postby dgault » Tue Jun 19, 2018 10:19 am

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
User avatar
dgault
Team Member
 
Posts: 208
Joined: Fri Aug 14, 2015 2:56 pm

Re: testing new reader

Postby Albin » Tue Jun 19, 2018 11:46 am

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
Albin
 
Posts: 22
Joined: Mon Jun 18, 2018 12:23 pm

Re: testing new reader

Postby dgault » Tue Jun 19, 2018 3:42 pm

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).
User avatar
dgault
Team Member
 
Posts: 208
Joined: Fri Aug 14, 2015 2:56 pm

Re: testing new reader

Postby Albin » Wed Jun 20, 2018 1:48 pm

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
Albin
 
Posts: 22
Joined: Mon Jun 18, 2018 12:23 pm

Re: testing new reader

Postby Albin » Thu Jun 21, 2018 9:32 am

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
Albin
 
Posts: 22
Joined: Mon Jun 18, 2018 12:23 pm

Re: testing new reader

Postby sbesson » Thu Jun 21, 2018 10:03 am

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
User avatar
sbesson
Team Member
 
Posts: 421
Joined: Tue Feb 28, 2012 7:20 pm

Re: testing new reader

Postby Albin » Thu Jun 21, 2018 10:51 am

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
Albin
 
Posts: 22
Joined: Mon Jun 18, 2018 12:23 pm

Re: testing new reader

Postby sbesson » Thu Jun 21, 2018 10:55 am

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
User avatar
sbesson
Team Member
 
Posts: 421
Joined: Tue Feb 28, 2012 7:20 pm

Re: testing new reader

Postby Albin » Thu Jun 21, 2018 11:00 am

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
Albin
 
Posts: 22
Joined: Mon Jun 18, 2018 12:23 pm

Next

Return to User Discussion [Legacy]

Who is online

Users browsing this forum: No registered users and 1 guest

cron