tlnagy / OMETIFF.jl

I/O operations for OME-TIFF files in Julia
Other
24 stars 7 forks source link

Handle cases where file is renamed and the filepath in the OME-XML is out of date #14

Closed tlnagy closed 4 years ago

tlnagy commented 6 years ago

I believe this logic here should be updated:

https://github.com/tlnagy/OMETIFF.jl/blob/b1b763752396dbaf076264c9df79d391301cbe9c/src/files.jl#L30-L31

tlnagy commented 6 years ago

This isn't that straight-forward because it looks like UUIDs aren't actually required.

JiangXL commented 4 years ago

Any update?

tlnagy commented 4 years ago

None. I would be happy to review a PR if you want to give it a stab.

If you're trying it on a single file OME-TIFF and getting that error then it might be caused by this line:

https://github.com/tlnagy/OMETIFF.jl/blob/60c3c80534f465309ff8010c493520872fbd4b97/src/files.jl#L139

Replacing that line with TiffFile(open(filepath)) instead will bypass the error message, potentially. I haven't tested that though.

More generally, the flexibility of the OMETIFF file spec hurts us here because UUIDs and filepaths are both optional. I think the longer term strategy is to update the TiffFile constructor with the logic from here:

The FileName attribute of the UUID is optional, but strongly recommended—otherwise, the OME-TIFF reader must scan OME-TIFF files in the working directory looking for matching UUID signatures.

So I believe the approach should be to scan the directory of the filepath and load each ome.tif and check its XML to see if the UUID matches the reference.

JiangXL commented 4 years ago

It is a long holiday with big chunk time next week, then I will attempt to follow your advice.

tlnagy commented 4 years ago

It ended up being a little more difficult than anticipated but it should be resolved by #62.

The one exception that still needs to be resolved is if you have a multiple file OME-TIFF that you've renamed one or multiple files.

tlnagy commented 4 years ago

OMETIFF v0.3.6 has these fixes

JiangXL commented 4 years ago

It works smoothly.