Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Combine multiple metamorph files into sinlge .tif file #3186

Open
hummuscience opened this issue Jul 17, 2018 · 4 comments
Open

Combine multiple metamorph files into sinlge .tif file #3186

hummuscience opened this issue Jul 17, 2018 · 4 comments

Comments

@hummuscience
Copy link

hummuscience commented Jul 17, 2018

I am trying to concatenate a time series of MetaMorph files into a singe .tif file with bfconvert (command line tool) but cannot make it work.

Is it at all possible? If so, what is the correct syntax?

This is what I am trying:

./bfconvert ~/mnt/Muad/ca-imaging/20180517/6tg-ko/ 6tg-ko.tif
/home/generalubuntu/mnt/Muad/ca-imaging/20180517/6tg-ko/
Exception in thread "main" java.io.FileNotFoundException: /home/generalubuntu/mnt/Muad/ca-imaging/20180517/6tg-ko (Is a directory)
	at java.io.RandomAccessFile.open0(Native Method)
	at java.io.RandomAccessFile.open(RandomAccessFile.java:316)
	at java.io.RandomAccessFile.<init>(RandomAccessFile.java:243)
	at loci.common.NIOFileHandle.<init>(NIOFileHandle.java:123)
	at loci.common.NIOFileHandle.<init>(NIOFileHandle.java:139)
	at loci.common.NIOFileHandle.<init>(NIOFileHandle.java:148)
	at loci.common.Location.getHandle(Location.java:324)
	at loci.common.Location.getHandle(Location.java:294)
	at loci.common.Location.getHandle(Location.java:284)
	at loci.common.Location.getHandle(Location.java:274)
	at loci.common.Location.checkValidId(Location.java:349)
	at loci.formats.ImageReader.getReader(ImageReader.java:177)
	at loci.formats.ImageReader.setId(ImageReader.java:839)
	at loci.formats.tools.ImageConverter.testConvert(ImageConverter.java:385)
	at loci.formats.tools.ImageConverter.main(ImageConverter.java:884)

these files can be used as example:

https://www.dropbox.com/s/2xvxycbwvm9p85k/test-series.zip?dl=0

@sbesson
Copy link
Member

sbesson commented Jul 30, 2018

Hi @Cumol, the Bio-Formats command-line tools and more generally IFormatReader.setId method is expecting a file as the input and will not handle directories as suggested by the exception.

Converting Metamorph files into a single (OME-)TIFF should definitely work as long as you point the bfconvert utility to one of the files consituting the fileset.

Using your test files and Bio-Formats 5.9.0, the two commands below should produce a single OME-TIFF and TIFF image:

sbesson@ls30630:Downloads $ bfconvert 23.001 23.ome.tiff
23.001
MetamorphTiffReader initializing 23.001
Reading IFDs
Populating metadata
Populating OME metadata
[Metamorph TIFF] -> 23.ome.tiff [OME-TIFF]
	Converted 1/10 planes (10%)
	Converted 10/10 planes (100%)
[done]
6.068s elapsed (3.5+325.3ms per plane, 1761ms overhead)
sbesson@ls30630:Downloads $ bfconvert 23.001 23.tiff
23.001
MetamorphTiffReader initializing 23.001
Reading IFDs
Populating metadata
Populating OME metadata
[Metamorph TIFF] -> 23.tiff [Tagged Image File Format]
	Converted 1/10 planes (10%)
	Converted 10/10 planes (100%)
[done]
6.69s elapsed (3.9+216.6ms per plane, 3615ms overhead)

@hummuscience
Copy link
Author

hummuscience commented Aug 10, 2018

@sbesson wanted to try it out and wondered why it still gives the same error. It seems like th command line tools on the website are still the older version:

https://docs.openmicroscopy.org/bio-formats/5.8.2/users/comlinetools/index.html

When I run bfconvert -version it outputs 5.6.0 (from August 2017)

Additional question. What determines the speed of conversion? RAM? Number of processes?

@hummuscience
Copy link
Author

hummuscience commented Aug 10, 2018

I tried one full dataset and was able to convert it correctly.

Then tried another one and got the following output:

23.001
MetamorphTiffReader initializing 23.001
Reading IFDs
Populating metadata
Populating OME metadata
Error reading IFD type at: 6
Exception in thread "main" java.lang.NullPointerException
	at loci.common.xml.XMLTools.sanitizeXML(XMLTools.java:298)
	at loci.formats.in.MetamorphTiffReader.parseFile(MetamorphTiffReader.java:628)
	at loci.formats.in.MetamorphTiffReader.initFile(MetamorphTiffReader.java:217)
	at loci.formats.FormatReader.setId(FormatReader.java:1397)
	at loci.formats.ImageReader.setId(ImageReader.java:842)
	at loci.formats.tools.ImageConverter.testConvert(ImageConverter.java:385)
	at loci.formats.tools.ImageConverter.main(ImageConverter.java:884)

currently trying to find out how to replicate this with a small number of files

UPDATE: the first 10 files are converted properly. I wonder what is causing the issue. If it is one of th 15k files that follow, it might be hard to find out which. Is there a way to "skip" corrupt files?

@dgault
Copy link
Member

dgault commented Aug 10, 2018

With regards the version, are you running the command from the bftools folder? Using the link you had in https://docs.openmicroscopy.org/bio-formats/5.8.2/users/comlinetools/index.html I get the below:
./bfconvert -version Version: 5.8.2 Build date: 20 April 2018 VCS revision: 07ecd9a5d239985f8ae57462c12124c2fa5ccd9b

As for the error message, the MetamorphTiffReader expects the files to contain a blob of XML metadata in the Image Description. That particular error would suggest that this is missing. If you have the libtiff tools you can check the file using tiffinfo, this will print out the TIFF IFD metadata and you should see the XML blob in Image Description.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants