Skip to content

BDV: store relative path instead of absolute - #4440

Open
melissalinkert wants to merge 1 commit into
ome:developfrom
melissalinkert:gh-3957
Open

BDV: store relative path instead of absolute#4440
melissalinkert wants to merge 1 commit into
ome:developfrom
melissalinkert:gh-3957

Conversation

@melissalinkert

Copy link
Copy Markdown
Member

Fixes #3957.

I could easily reproduce the original issue in #3957 with curated/bdv/public/samples/:

$ showinf -no-upgrade -cache HisYFP-SPIM.xml
$ mkdir tmp
$ mv HisYFP* tmp
$ mv .*.bfmemo tmp
$ cd tmp
$ $ showinf -no-upgrade -cache HisYFP-SPIM.xml 
Checking file format [BDV]
Initializing reader
Exception in thread "main" ch.systemsx.cisd.hdf5.exceptions.HDF5FileNotFoundException: Path does not exit. (/home/melissa/data/bf-data-repo/automated-tests/curated/bdv/public/samples/HisYFP-SPIM.h5)
	at ch.systemsx.cisd.hdf5.HDF5BaseReader.openFile(HDF5BaseReader.java:221)
	at ch.systemsx.cisd.hdf5.HDF5BaseReader.<init>(HDF5BaseReader.java:177)
	at ch.systemsx.cisd.hdf5.HDF5BaseReader.<init>(HDF5BaseReader.java:155)
	at ch.systemsx.cisd.hdf5.HDF5ReaderConfigurator.reader(HDF5ReaderConfigurator.java:81)
	at ch.systemsx.cisd.hdf5.HDF5FactoryProvider$HDF5Factory.openForReading(HDF5FactoryProvider.java:55)
	at ch.systemsx.cisd.hdf5.HDF5Factory.openForReading(HDF5Factory.java:62)
	at loci.formats.services.JHDFServiceImpl.setFile(JHDFServiceImpl.java:92)
	at loci.formats.in.BDVReader.initializeJHDFService(BDVReader.java:378)
	at loci.formats.in.BDVReader.reopenFile(BDVReader.java:365)
	at loci.formats.ImageReader.reopenFile(ImageReader.java:870)
	at loci.formats.Memoizer.setId(Memoizer.java:712)
	at loci.formats.ReaderWrapper.setId(ReaderWrapper.java:692)
	at loci.formats.tools.ImageInfo.testRead(ImageInfo.java:1054)
	at loci.formats.tools.ImageInfo.main(ImageInfo.java:1165)

This fix does not make it so that a pre-existing memo file will work, but does make it so that newly generated memo files no longer exhibit this problem.

I have not tried to address any more structural concerns about relative vs absolute paths in memo files that were mentioned in #3957. We likely need to discuss that internally first, given the potential impact on OMERO.

@melissalinkert melissalinkert added this to the 9.0.0 milestone Jun 11, 2026
@melissalinkert
melissalinkert requested a review from sbesson August 10, 2026 14:59

@sbesson sbesson left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using this change, I can still reproduce the original issue by creating a cache file, renaming the directory and reinitializing the reader

sbesson@Sebastien-GS-MacBook-Pro-2025 bdv % ../bftools/showinf -version
Version: 8.5.0
Build date: 18 March 2026
VCS revision: 877c317e4e396381dc76e56c1539b24947f71dce
sbesson@Sebastien-GS-MacBook-Pro-2025 bdv % ../bftools/showinf -nopix -cache drosophila.xml | grep memo
sbesson@Sebastien-GS-MacBook-Pro-2025 bdv % ../bftools/showinf -nopix -cache drosophila.xml | grep memo
sbesson@Sebastien-GS-MacBook-Pro-2025 bdv % cd ../
sbesson@Sebastien-GS-MacBook-Pro-2025 Downloads % mv bdv bdv2 
sbesson@Sebastien-GS-MacBook-Pro-2025 Downloads % cd bdv2    
sbesson@Sebastien-GS-MacBook-Pro-2025 bdv2 % ../bftools/showinf -nopix -cache drosophila.xml | grep memo
Exception in thread "main" ch.systemsx.cisd.hdf5.exceptions.HDF5FileNotFoundException: Path does not exit. (/Users/sbesson/Downloads/bdv/drosophila.h5)
	at ch.systemsx.cisd.hdf5.HDF5BaseReader.openFile(HDF5BaseReader.java:221)
	at ch.systemsx.cisd.hdf5.HDF5BaseReader.<init>(HDF5BaseReader.java:177)
	at ch.systemsx.cisd.hdf5.HDF5BaseReader.<init>(HDF5BaseReader.java:155)
	at ch.systemsx.cisd.hdf5.HDF5ReaderConfigurator.reader(HDF5ReaderConfigurator.java:81)
	at ch.systemsx.cisd.hdf5.HDF5FactoryProvider$HDF5Factory.openForReading(HDF5FactoryProvider.java:55)
	at ch.systemsx.cisd.hdf5.HDF5Factory.openForReading(HDF5Factory.java:62)
	at loci.formats.services.JHDFServiceImpl.setFile(JHDFServiceImpl.java:92)
	at loci.formats.in.BDVReader.initializeJHDFService(BDVReader.java:378)
	at loci.formats.in.BDVReader.reopenFile(BDVReader.java:365)
	at loci.formats.ImageReader.reopenFile(ImageReader.java:870)
	at loci.formats.Memoizer.setId(Memoizer.java:712)
	at loci.formats.ReaderWrapper.setId(ReaderWrapper.java:692)
	at loci.formats.tools.ImageInfo.testRead(ImageInfo.java:1054)
	at loci.formats.tools.ImageInfo.main(ImageInfo.java:1165)

With this PR included the workflow above is fixed

sbesson@Sebastien-GS-MacBook-Pro-2025 bdv2 % rm .drosophila.xml.bfmemo 
sbesson@Sebastien-GS-MacBook-Pro-2025 bdv2 % ~/Documents/GitHub/bioformats/tools/showinf -version
Version: 8.6.0-SNAPSHOT
Build date: 17 August 2026
VCS revision: 2803431bd9d4bb9779eaf3f3792c983497657928
sbesson@Sebastien-GS-MacBook-Pro-2025 bdv2 % ~/Documents/GitHub/bioformats/tools/showinf -nopix -cache -debug  drosophila.xml | grep memo 
saved to temp file: /Users/sbesson/Downloads/bdv2/.drosophila.xml.bfmemo2740089922917667026
saved memo file: /Users/sbesson/Downloads/bdv2/.drosophila.xml.bfmemo (53141 bytes)
sbesson@Sebastien-GS-MacBook-Pro-2025 bdv2 % ~/Documents/GitHub/bioformats/tools/showinf -nopix -cache -debug  drosophila.xml | grep memo
loaded memo file: /Users/sbesson/Downloads/bdv2/.drosophila.xml.bfmemo (53141 bytes)
sbesson@Sebastien-GS-MacBook-Pro-2025 bdv2 % cd ../
sbesson@Sebastien-GS-MacBook-Pro-2025 Downloads % mv bdv2 bdv  
sbesson@Sebastien-GS-MacBook-Pro-2025 Downloads % cd bdv     
sbesson@Sebastien-GS-MacBook-Pro-2025 bdv % ~/Documents/GitHub/bioformats/tools/showinf -nopix -cache -debug  drosophila.xml | grep memo
loaded memo file: /Users/sbesson/Downloads/bdv/.drosophila.xml.bfmemo (53141 bytes)

However, initializing the file from one directory above still fails with HDF5FileNotFoundException

sbesson@Sebastien-GS-MacBook-Pro-2025 Downloads % rm bdv/.drosophila.xml.bfmemo 
sbesson@Sebastien-GS-MacBook-Pro-2025 Downloads % ~/Documents/GitHub/bioformats/tools/showinf -nopix -cache -debug bdv/drosophila.xml | grep memo
saved to temp file: /Users/sbesson/Downloads/bdv/.drosophila.xml.bfmemo2581172668934219037
saved memo file: /Users/sbesson/Downloads/bdv/.drosophila.xml.bfmemo (53144 bytes)
sbesson@Sebastien-GS-MacBook-Pro-2025 Downloads % ~/Documents/GitHub/bioformats/tools/showinf -nopix -cache -debug bdv/drosophila.xml | grep memo
loaded memo file: /Users/sbesson/Downloads/bdv/.drosophila.xml.bfmemo (53144 bytes)
sbesson@Sebastien-GS-MacBook-Pro-2025 Downloads % mv bdv bdv2 
sbesson@Sebastien-GS-MacBook-Pro-2025 Downloads % ~/Documents/GitHub/bioformats/tools/showinf -nopix -cache -debug bdv2/drosophila.xml | grep memo
loaded memo file: /Users/sbesson/Downloads/bdv2/.drosophila.xml.bfmemo (53144 bytes)
Exception in thread "main" ch.systemsx.cisd.hdf5.exceptions.HDF5FileNotFoundException: Path does not exit. (/Users/sbesson/Downloads/bdv/drosophila.h5)
	at ch.systemsx.cisd.hdf5.HDF5BaseReader.openFile(HDF5BaseReader.java:221)
	at ch.systemsx.cisd.hdf5.HDF5BaseReader.<init>(HDF5BaseReader.java:177)
	at ch.systemsx.cisd.hdf5.HDF5BaseReader.<init>(HDF5BaseReader.java:155)
	at ch.systemsx.cisd.hdf5.HDF5ReaderConfigurator.reader(HDF5ReaderConfigurator.java:81)
	at ch.systemsx.cisd.hdf5.HDF5FactoryProvider$HDF5Factory.openForReading(HDF5FactoryProvider.java:55)
	at ch.systemsx.cisd.hdf5.HDF5Factory.openForReading(HDF5Factory.java:62)
	at loci.formats.services.JHDFServiceImpl.setFile(JHDFServiceImpl.java:92)
	at loci.formats.in.BDVReader.initializeJHDFService(BDVReader.java:387)
	at loci.formats.in.BDVReader.reopenFile(BDVReader.java:374)
	at loci.formats.ImageReader.reopenFile(ImageReader.java:870)
	at loci.formats.Memoizer.setId(Memoizer.java:712)
	at loci.formats.ReaderWrapper.setId(ReaderWrapper.java:692)
	at loci.formats.tools.ImageInfo.testRead(ImageInfo.java:1054)
	at loci.formats.tools.ImageInfo.main(ImageInfo.java:1165)

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

Successfully merging this pull request may close these issues.

BDV: Remove absolute file paths

2 participants