glencoesoftware / bioformats2raw

Bio-Formats image file format to raw format converter
GNU General Public License v2.0
82 stars 36 forks source link

Memo directory setting not being applied properly #238

Closed DavidStirling closed 10 months ago

DavidStirling commented 10 months ago

Running the following command:

/Users/david/Downloads/bioformats2raw-0.9.0/bin/bioformats2raw 
/Users/david/Downloads/ngff-con-testing/source/image.png 
/Users/david/Downloads/ngff-con-testing/dest/test.zarr 
--keep-memo-files 
--memo-directory /Users/david/Downloads/ngff-con-testing/working

The resulting zarr is produced as expected, but I don't seem to get any .bfmemo files saved to the specified directory. Instead I get an empty folder generated at /Users/david/Downloads/ngff-con-testing/working/Users/david/Downloads/ngff-con-testing/source and nothing else in the memo directory. There aren't any hidden files present. I get the same result with a few different images.

I'm not sure if I'm misunderstanding what the settings do or if something isn't working correctly.

melissalinkert commented 10 months ago

This is very likely due to the use of Memoizer.DEFAULT_MINIMUM_ELAPSED in this block:

https://github.com/glencoesoftware/bioformats2raw/blob/master/src/main/java/com/glencoesoftware/bioformats2raw/Converter.java#L1589

That constant's value is 100 (https://github.com/ome/bioformats/blob/develop/components/formats-bsd/src/loci/formats/Memoizer.java#L344) which indicates that if initialization took less than 100ms a memo file will not be generated. The idea is that for very fast initializations, saving/loading a memo file would be slower than just reinitializing the file as normal.

Do you see the expected behavior with a plate or other larger/more complex input dataset?

DavidStirling commented 10 months ago

@melissalinkert You're absolutely correct, turns out that most of my larger files just initialize very quickly.

To prevent future confusion, do you think it might be worth updating this line in the docs:

During conversion, a temporary .*.bfmemo file will be created

to

During conversion, a temporary .*.bfmemo file may be created?