-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #20 from tlnagy/tn/add-mmap
Basic load-only mmap support
- Loading branch information
Showing
12 changed files
with
221 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,4 +2,4 @@ | |
Manifest.toml | ||
/dev/ | ||
docs/build/ | ||
docs/src/generated/ | ||
docs/src/examples/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
# # Reading TIFFs | ||
|
||
# Loading most TIFFs should just work, see [Writing TIFFs](@ref) for more | ||
# advanced manipulation of TIFF objects. But we'll quickly run through a common | ||
# use cases. | ||
|
||
#md # ```@contents | ||
#md # Pages = ["reading.md"] | ||
#md # Depth = 5 | ||
#md # ``` | ||
|
||
get_example(name) = download("https://github.com/tlnagy/exampletiffs/blob/master/$name?raw=true") #hide | ||
filepath = get_example("spring.tif") #hide | ||
|
||
# ### Basic loading | ||
|
||
# At it's most basic, we can just point `TiffImages.jl` to the filepath of an | ||
# image and it will attempt to load it. Here, we're loading `spring.tif` from | ||
# the [`tlnagy/exampletiffs`](https://github.com/tlnagy/exampletiffs) repo | ||
|
||
using TiffImages | ||
img = TiffImages.load(filepath) | ||
|
||
# If you're a graphical environment, you can load the `Images.jl` repo to get | ||
# a nice graphical representation of your image. If you're in the REPL, I highly | ||
# recommend the `ImageInTerminal.jl` package for some visual feedback. | ||
|
||
# Continuing on, `img` here behaves exactly as you would expect a Julian array | ||
# to despite the funky type signature | ||
|
||
typeof(img) | ||
|
||
# Everything should behave as expected | ||
|
||
eltype(img) | ||
#--------- | ||
|
||
# Accessing and setting data should work as expected | ||
img[160:180, 50] | ||
#--------- | ||
img[160:180, 50] .= 1.0 | ||
img | ||
|
||
|
||
# ### Memory-mapped files | ||
|
||
# `TiffImages.jl` also supports memory-mapping so that you can load images that | ||
# are larger than the available memory. | ||
|
||
img = TiffImages.load(filepath, mmap=true) | ||
img[:, :, 1] | ||
|
||
# Naturally, this only really makes sense for large images, not the single pane | ||
# image here. Currently, memory-mapped files are readonly so trying to set a | ||
# value will throw an error | ||
|
||
# ```julia | ||
# img[1, 1, 1] = 0 # this won't work | ||
# ``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
1f6b34a
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@JuliaRegistrator register
1f6b34a
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Registration pull request created: JuliaRegistries/General/27613
After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.
This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:
Also, note the warning: This looks like a new registration that registers version 0.2.0.
Ideally, you should register an initial release with 0.0.1, 0.1.0 or 1.0.0 version numbers
This can be safely ignored. However, if you want to fix this you can do so. Call register() again after making the fix. This will update the Pull request.