Skip to content
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

Should LazyBufferedTIFFs subtype DenseTIFFs or be more general? #154

Open
chrstphrbrns opened this issue Mar 28, 2024 · 1 comment
Open
Labels
enhancement New feature or request

Comments

@chrstphrbrns
Copy link
Contributor

julia> a=TiffImages.load("/home/chris/exampletiffs/mri.tif";lazyio=true);
  0.994805 seconds (3.59 M allocations: 187.083 MiB, 1.63% gc time, 99.31% compilation time: 20% of which was recompilation)

julia> typeof(a)
TiffImages.DenseTaggedImage{...}
@tlnagy
Copy link
Owner

tlnagy commented Mar 29, 2024

This is the expected behavior?

julia> TiffImages.load("mri.tif"; lazyio=true)
128×128×27 TiffImages.DenseTaggedImage{ColorTypes.RGB{FixedPointNumbers.N0f16}, 3, UInt32, IndirectArrays.IndirectArray{ColorTypes.RGB{FixedPointNumbers.N0f16}, 3, UInt8, Base.ReinterpretArray{UInt8, 3, TiffImages.Palette{FixedPointNumbers.N0f8}, LazyBufferedTIFF{TiffImages.Palette{FixedPointNumbers.N0f8}, UInt32, Matrix{TiffImages.Palette{FixedPointNumbers.N0f8}}}, false}, OffsetArrays.OffsetVector{ColorTypes.RGB{FixedPointNumbers.N0f16}, Base.ReshapedArray{ColorTypes.RGB{FixedPointNumbers.N0f16}, 1, Base.ReinterpretArray{ColorTypes.RGB{FixedPointNumbers.N0f16}, 2, UInt16, LinearAlgebra.Adjoint{UInt16, Matrix{UInt16}}, false}, Tuple{Base.MultiplicativeInverses.SignedMultiplicativeInverse{Int64}}}}}}:

All the extra types just wrap LazyBufferedTIFF which does the lazy disk calls when you use getindex. Now whether we should always wrap LazyBufferedTIFF with DenseTaggedImage is a different question.

There could a reasonable argument that the current design is too restrictive and LazyBufferedTIFFs shouldn't always be wrapped but instead the wrapping be contingent on the structure of the TIFF.

@tlnagy tlnagy changed the title load(...; lazyio=true) returns DenseTaggedImage Should LazyBufferedTIFFs subtype DenseTIFFs or be more general? Mar 29, 2024
@tlnagy tlnagy added the enhancement New feature or request label Mar 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants