-
Notifications
You must be signed in to change notification settings - Fork 13
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
Saving OIB: metadata is lost #27
Comments
Thanks a lot for reporting this! Actually, when converting an OIB file to OME.TIFF pixel size metadata seems to be preserved both by bfconvert and RBioFormats. library(RBioFormats)
#> Loading required package: rJava
#> BioFormats library version 6.9.1
fname_oib <- "Image0010_01.oib"
oib <- read.image(fname_oib, normalize = FALSE, subset = list(C = 2))
globalMetadata(oib, pattern = "WidthConvertValue|HeightConvertValue|WidthUnit")
#> $`[Reference Image Parameter] WidthUnit`
#> [1] "um"
#>
#> $`[Reference Image Parameter] HeightConvertValue`
#> [1] "6.214"
#>
#> $`[Reference Image Parameter] WidthConvertValue`
#> [1] "6.214"
fname_tif <- sub(".oib", ".ome.tif", fname_oib)
write.image(oib, fname_tif, force = TRUE)
tif <- read.image(fname_tif, normalize = FALSE)
globalMetadata(tif, pattern = "WidthConvertValue|HeightConvertValue|WidthUnit")
#> $`[Reference Image Parameter] WidthUnit`
#> [1] "um"
#>
#> $`[Reference Image Parameter] HeightConvertValue`
#> [1] "6.214"
#>
#> $`[Reference Image Parameter] WidthConvertValue`
#> [1] "6.214" Created on 2022-05-17 by the reprex package (v2.0.1) Nevertheless, there seem to be some problem in handling of resolution-related metadata entries in the case of plain TIFF files, as illustrated by the following example. I will look into this, so stay tuned. library(RBioFormats)
#> Loading required package: rJava
#> BioFormats library version 6.9.1
fname_oib <- "Image0010_01.oib"
fname_tif <- sub(".oib", ".tif", fname_oib)
oib <- read.image(fname_oib, normalize = FALSE, subset = list(C = 2))
write.image(oib, fname_tif, force = TRUE)
tif <- read.image(fname_tif, normalize = FALSE)
globalMetadata(tif, pattern = "Resolution")
#> $YResolution
#> [1] 0
#>
#> $ResolutionUnit
#> [1] "Centimeter"
#>
#> $XResolution
#> [1] 0
system(sprintf("bfconvert -channel 1 -overwrite %s %s", fname_oib, fname_tif))
tif <- read.image(fname_tif, normalize = FALSE)
globalMetadata(tif, pattern = "Resolution")
#> $YResolution
#> [1] 1609.269
#>
#> $ResolutionUnit
#> [1] "Centimeter"
#>
#> $XResolution
#> [1] 1609.269 Created on 2022-05-17 by the reprex package (v2.0.1) |
When saving this OIB file with RBioFormats the pixel size metadata is lost.
Here's what I did:
Doing the equivalent using the bfconvert command line tool preserves the pixel size metadata:
bfconvert Image0010_01.oib Image0010_01.ome.tiff
More info here: https://github.com/hmbotelho/oib_to_tif
The text was updated successfully, but these errors were encountered: