TiffImages.jl icon indicating copy to clipboard operation
TiffImages.jl copied to clipboard

[WIP] Add support for writing to mmapped TIFFs

Open tlnagy opened this issue 3 years ago • 7 comments

This will complete TiffImages.jl support for mmapped TIFFs. There are still some features that are needed before this is ready to merge:

  • [ ] Support for out-of-memory copy
  • [ ] Proper errors for compressed images
  • [ ] Support for whole plane writing for speed?
  • [ ] Append!
  • [ ] Tests

Allocations

Despite my best efforts setindex! is still not zero allocation, despite no allocations reported by running julia in --track-allocations=all mode.

To reproduce:

julia> img = TiffImages.load("/home/tlnagy/Documents/exampletiffs/julia.tif", mmap=true);
[ Info: Watching /home/tlnagy/Documents/exampletiffs/julia.tif for changes

julia> filepath = download("https://github.com/tlnagy/exampletiffs/blob/master/julia.tif?raw=true")
"/tmp/jl_sP369j"

julia> img = TiffImages.load(filepath, mmap=true);
[ Info: Watching /tmp/jl_sP369j for changes

julia> convert!(img.data; writeable=true) # convert to writeable

julia> img[:, :, 1] .= 1.0; # warm up setindex

julia> @time img[:, :, 1] .= 1.0;
  0.360166 seconds (303.86 k allocations: 9.351 MiB, 4.10% gc time)

Thoughts @timholy, @IanButterworth?

tlnagy avatar Mar 02 '21 20:03 tlnagy