Skip to content

Commit d5b98fc

Browse files
authored
Merge pull request #18 from tlnagy/tn/package-rename
Rename from TIFF -> TiffImages
2 parents b6ba7ce + cfe540e commit d5b98fc

15 files changed

+122
-128
lines changed

Project.toml

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
name = "TIFF"
1+
name = "TiffImages"
22
uuid = "731e570b-9d59-4bfa-96dc-6df516fadf69"
33
authors = ["Tamas Nagy <[email protected]>"]
4-
version = "0.1.1"
4+
version = "0.2.0"
55

66
[deps]
77
ColorTypes = "3da002f7-5984-5a60-b8a6-cbb66c0b333f"
@@ -15,10 +15,4 @@ PkgVersion = "eebad327-c553-4316-9ea0-9fa01ccd7688"
1515
ProgressMeter = "92933f4c-e287-5a05-a399-4b506db050ca"
1616

1717
[compat]
18-
julia = "1.4"
19-
20-
[extras]
21-
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
22-
23-
[targets]
24-
test = ["Test"]
18+
julia = "1.4, 1.5"

README.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
1-
# 💎 TIFF.jl
1+
# 💎 TiffImages.jl
22

33
| **Documentation** | **Build Status** |
44
|:----------------------------------|:--------------------------------------------------------------|
55
| [![][docs-dev-img]][docs-dev-url] | [![][status-img]][status-url] [![][travis-img]][travis-url] [![][codecov-img]][codecov-url] |
66

7-
This package aims to be a fast, minimal, and correct TIFF reader and writer written in Julia.
7+
This package aims to be a fast, minimal, and correct TIFF reader and writer written in Julia.
88

99
This is a WIP. Be warned. Here be🐉.
1010

1111
[docs-dev-img]: https://img.shields.io/badge/docs-dev-blue.svg
12-
[docs-dev-url]: https://tamasnagy.com/TIFF.jl/dev
12+
[docs-dev-url]: https://tamasnagy.com/TiffImages.jl/dev
1313

14-
[travis-img]: https://travis-ci.com/tlnagy/TIFF.jl.svg?branch=master
15-
[travis-url]: https://travis-ci.com/tlnagy/TIFF.jl
14+
[travis-img]: https://travis-ci.com/tlnagy/TiffImages.jl.svg?branch=master
15+
[travis-url]: https://travis-ci.com/tlnagy/TiffImages.jl
1616

17-
[codecov-img]: https://codecov.io/gh/tlnagy/TIFF.jl/branch/master/graph/badge.svg
18-
[codecov-url]: https://codecov.io/gh/tlnagy/TIFF.jl
17+
[codecov-img]: https://codecov.io/gh/tlnagy/TiffImages.jl/branch/master/graph/badge.svg
18+
[codecov-url]: https://codecov.io/gh/tlnagy/TiffImages.jl
1919

2020
[status-img]: https://www.repostatus.org/badges/latest/wip.svg
2121
[status-url]: https://www.repostatus.org/#wip

docs/make.jl

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
using Documenter
2-
using TIFF
2+
using TiffImages
33

44
using Literate
55
using Images
@@ -12,13 +12,13 @@ for ex in EXAMPLES
1212
Literate.markdown(ex, OUTPUT, documenter = true)
1313
end
1414

15-
DocMeta.setdocmeta!(TIFF, :DocTestSetup, :(using TIFF); recursive=true)
15+
DocMeta.setdocmeta!(TiffImages, :DocTestSetup, :(using TiffImages); recursive=true)
1616
makedocs(
1717
format = Documenter.HTML(
18-
prettyurls = true,
18+
prettyurls = true,
1919
),
20-
modules=[TIFF],
21-
sitename="TIFF.jl",
20+
modules=[TiffImages],
21+
sitename="TiffImages.jl",
2222
authors="Tamas Nagy and contributors",
2323
pages = [
2424
"Home" => "index.md",
@@ -37,5 +37,5 @@ makedocs(
3737
)
3838

3939
deploydocs(
40-
repo = "github.com/tlnagy/TIFF.jl.git",
40+
repo = "github.com/tlnagy/TiffImages.jl.git",
4141
)

docs/src/contributing.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,12 @@ the community in identifying edge cases.
77

88
There is incredible diversity in the TIFF ecosystem so much so that there is a
99
backronym "Thousand Incompatible File Formats" to describe it. I have tried to
10-
establish a good baseline test set of TIFFs that should guarantee that `TIFF.jl`
10+
establish a good baseline test set of TIFFs that should guarantee that `TiffImages.jl`
1111
should "just work tm" for most people, but if you have a TIFF that you run into
12-
that breaks `TIFF.jl` please do the following:
12+
that breaks `TiffImages.jl` please do the following:
1313

14-
1. create a pull request against the
14+
1. create a pull request against the
1515
[example TIFF](https://github.com/tlnagy/exampletiffs) repo adding the file.
1616
The smaller the file, the better.
1717
2. update the README table with license information, etc.
18-
3. Open an issue against `TIFF.jl` with the error message and the expected result
18+
3. Open an issue against `TiffImages.jl` with the error message and the expected result

docs/src/index.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# TIFF.jl
1+
# TiffImages.jl
22

33
*Pure-Julia TIFF reader and writer with a focus on correctness* 🧐
44

@@ -16,7 +16,7 @@ do as much lazily and flexibly as possible.
1616

1717
## Features
1818

19-
TIFF.jl supports:
19+
TiffImages.jl supports:
2020

2121
- [x] The TIFF 6.0 baseline spec
2222
- [x] Thorough testing

docs/src/lib/extend/index.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
# Extending TIFF.jl
1+
# Extending TiffImages.jl
22

3-
If you want to extend `TIFF.jl` to add support for more features or change how
3+
If you want to extend `TiffImages.jl` to add support for more features or change how
44
TIFF data is loaded, you have come to right place.
55

66
```@docs
7-
TIFF.Tag
7+
TiffImages.Tag
88
```

docs/src/lib/extend/tags.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Built-in Tags
22

33
```@docs
4-
TIFF.TiffTag
4+
TiffImages.TiffTag
55
```

examples/writing.jl

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# # Writing TIFFs
22

3-
# This page is a tutorial for saving TIFFs using TIFF.jl and covers some common
3+
# This page is a tutorial for saving TIFFs using TiffImages.jl and covers some common
44
# use cases
55

66
#md # ```@contents
@@ -9,7 +9,7 @@
99
#md # ```
1010

1111
# You might want to write TIFFs to disk too. Now this can be done quite simply
12-
# with TIFF.jl. Say you have some AbstractArray type that you want to save, here
12+
# with TiffImages.jl. Say you have some AbstractArray type that you want to save, here
1313
# we'll call it `data`:
1414

1515
using Random
@@ -19,21 +19,21 @@ Random.seed!(123)
1919
data = rand(RGB{N0f8}, 10, 10)
2020

2121
#md # !!! note
22-
#md # TIFF.jl only works with AbstractArrays with `eltype`s of `<:Colorant` because
22+
#md # TiffImages.jl only works with AbstractArrays with `eltype`s of `<:Colorant` because
2323
#md # the writer needs to know how to represent the image data on disk. Make sure to
2424
#md # convert your `AbstractArrays` using before passing them. See the
2525
#md # [common strategies](#Strategies-for-saving-common-types) section
2626
#md # below for tips.
27-
28-
# ## Converting to `TIFF.jl`'s TIFF type
27+
28+
# ## Converting to `TiffImages.jl`'s TIFF type
2929
# Next lets convert `data` to a TIFF type
3030

31-
using TIFF
32-
img = TIFF.DenseTaggedImage(data)
31+
using TiffImages
32+
img = TiffImages.DenseTaggedImage(data)
3333

3434
# Wait nothing happened! Hang with me, lets take a closer look at our new object
3535
# using the `dump` command. We can see that there's now new information
36-
# associated with our data! TIFF.jl usually represents TIFF images as simply the
36+
# associated with our data! TiffImages.jl usually represents TIFF images as simply the
3737
# data and associated tags that describe the data
3838

3939
dump(img; maxdepth=1)
@@ -54,26 +54,26 @@ ifd
5454
# These are some of the most basic tags that are required by the TIFF spec. We
5555
# can even update it to add our own custom tags
5656

57-
ifd[TIFF.IMAGEDESCRIPTION] = "This is very important data"
57+
ifd[TiffImages.IMAGEDESCRIPTION] = "This is very important data"
5858
ifd
5959

6060
# We can even add tags that aren't in the standard set in
61-
# [`TIFF.TiffTag`](@ref) as long as they are a `UInt16`
61+
# [`TiffImages.TiffTag`](@ref) as long as they are a `UInt16`
6262

6363
ifd[UInt16(34735)] = UInt16[1, 2, 3]
6464
ifd
6565

6666
# We can also delete tags if we decide we don't want them:
6767

68-
delete!(ifd, TIFF.IMAGEDESCRIPTION)
68+
delete!(ifd, TiffImages.IMAGEDESCRIPTION)
6969
ifd
7070

7171
#md # !!! warning
72-
#md # Careful with `delete!`, if any of core tags are deleted, TIFF.jl and
72+
#md # Careful with `delete!`, if any of core tags are deleted, TiffImages.jl and
7373
#md # other readers might fail to read the file
7474

7575
# ## Saving to disk
76-
#
76+
#
7777
# Once you're happy with your TIFF object, you can write it to disk as follows:
7878

7979
open("test.tif", "w") do io
@@ -82,32 +82,32 @@ end
8282

8383
# And to just double check, we can load it right back in
8484

85-
TIFF.load("test.tif")
85+
TiffImages.load("test.tif")
8686

8787
# ## Strategies for saving common types
8888

8989
# The general strategy for saving arrays will differ a bit depending on the
9090
# type. The key step is the convert or reinterpret the arrays so that the
9191
# elements are subtypes of `Colors.Colorant`
9292

93-
# #### Unsigned Integers
93+
# #### Unsigned Integers
9494

9595
# Say you want to save a 3D array of small integers as grayscale values.
9696

9797
data2 = rand(UInt8.(1:255), 5, 10)
9898
eltype(data2)
9999

100-
# You can't directly save the `data2` since TIFF.jl needs some color information
100+
# You can't directly save the `data2` since TiffImages.jl needs some color information
101101
# to properly save the file. You can use
102102
# [`reinterpret`](https://docs.julialang.org/en/v1/base/arrays/#Base.reinterpret)
103103
# to accomplish this:
104104

105105
grays = reinterpret(Gray{N0f8}, data2)
106-
img2 = TIFF.DenseTaggedImage(grays)
106+
img2 = TiffImages.DenseTaggedImage(grays)
107107

108108
# Here the data are first reinterpreted as `N0f8`s, which is a
109109
# [`FixedPointNumber`](https://github.com/JuliaMath/FixedPointNumbers.jl) then
110-
# wrapped with a Gray type that marks this as a grayscale image. TIFF.jl uses
110+
# wrapped with a Gray type that marks this as a grayscale image. TiffImages.jl uses
111111
# this information to update the TIFF tags
112112

113113
# #### Floating point numbers
@@ -117,7 +117,7 @@ img2 = TIFF.DenseTaggedImage(grays)
117117

118118
data = rand(Float64, 3, 5, 10);
119119
colors = dropdims(reinterpret(RGB{eltype(data)}, data), dims=1) # drop first dimension
120-
img3 = TIFF.DenseTaggedImage(colors)
120+
img3 = TiffImages.DenseTaggedImage(colors)
121121

122122
# Here we dropped the first dimension since it was collapsed into the RGB type
123123
# when we ran the `reinterpret` command.
@@ -131,7 +131,7 @@ img3 = TIFF.DenseTaggedImage(colors)
131131

132132
data = rand(-100:100, 5, 5)
133133
#--------------------------
134-
img4 = TIFF.DenseTaggedImage(reinterpret(Gray{Q0f63}, data))
134+
img4 = TiffImages.DenseTaggedImage(reinterpret(Gray{Q0f63}, data))
135135
println(img4.ifds[1])
136136

137137
# As you can see the `SAMPLEFORMATS` and `BITSPERSAMPLE` tags correctly updated

src/TIFF.jl renamed to src/TiffImages.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
module TIFF
1+
module TiffImages
22

33
using ColorTypes
44
using DocStringExtensions

src/compression.jl

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ function Base.read!(tf::TiffFile, arr::AbstractArray{T, N}, ::Val{COMPRESSION_PA
2424
arr[pos:(pos-n)] .= nxt[1]
2525
pos += -n
2626
end
27-
pos += 1
27+
pos += 1
2828
end
2929
end
3030

@@ -34,19 +34,19 @@ end
3434
Given a `read!` signature, returns the compression technique implemented.
3535
3636
```jldoctest
37-
julia> TIFF.get_inflator(first(methods(read!, [TIFF.TiffFile, AbstractArray, Val{TIFF.COMPRESSION_NONE}], [TIFF])).sig)
38-
COMPRESSION_NONE::CompressionType = 1
37+
julia> TiffImages.get_inflator(first(methods(read!, [TiffImages.TiffFile, AbstractArray, Val{TiffImages.COMPRESSION_NONE}], [TiffImages])).sig)
38+
COMPRESSION_NONE::CompressionType = 1
3939
```
4040
"""
4141
get_inflator(::Type{Tuple{typeof(read!), TiffFile, AbstractArray{T, N} where {T, N}, Val{C}}}) where C = C
4242

4343
# autogenerate nice error messages for all non-implemented inflation methods
4444
implemented = map(x->get_inflator(x.sig), methods(read!, [TiffFile, AbstractArray, Val], ))
45-
comps = Set(instances(TIFF.CompressionType))
45+
comps = Set(instances(CompressionType))
4646
setdiff!(comps, implemented)
4747

4848
for comp in comps
4949
eval(quote
50-
Base.read!(tf::TiffFile, arr::AbstractArray, ::Val{$comp}) = error("Compression ", $comp, " is not implemented. Please open an issue against TIFF.jl.")
50+
Base.read!(tf::TiffFile, arr::AbstractArray, ::Val{$comp}) = error("Compression ", $comp, " is not implemented. Please open an issue against TiffImages.jl.")
5151
end)
5252
end

src/files.jl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ Base.read(io::IOStream, t::Type{TiffFile}) = read(Stream(format"TIFF", io, extra
3535

3636
function Base.write(file::TiffFile{O}) where O
3737
seekstart(file.io)
38-
38+
3939
if ENDIAN_BOM == 0x04030201 #little endian
4040
write(file.io, "II")
4141
else
@@ -85,18 +85,18 @@ function Base.read!(file::TiffFile, arr::AbstractArray)
8585
end
8686

8787
function Base.read!(io::IOStream, arr::SubArray{T,N,P,I,L}) where {T, N, P <: BitArray, I <: Tuple{UnitRange, Int64}, L}
88-
error("Strided bilevel TIFFs are not yet supported. Please open an issue against TIFF.jl.")
88+
error("Strided bilevel TIFFs are not yet supported. Please open an issue against TiffImages.jl.")
8989
end
9090

9191
function Base.read!(file::TiffFile, arr::BitArray)
92-
Bc = arr.chunks
92+
Bc = arr.chunks
9393
n = length(arr)
9494
nc = length(read!(file.io, Bc))
9595
if length(Bc) > 0 && Bc[end] & Base._msk_end(n) Bc[end]
9696
Bc[end] &= Base._msk_end(n) # ensure that the BitArray is not broken
9797
end
9898
for i in 1:nc
99-
Bc[i] = TIFF.reversebits(Bc[i])
99+
Bc[i] = reversebits(Bc[i])
100100
end
101101
arr
102102
end

src/utils.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,18 +45,18 @@ const _mask4_uint128 = (UInt128(0x0f0f0f0f0f0f0f0f) << 64) | UInt128(0x0f0f0f0f0
4545
4646
Reverse the bit order in each byte of `x`. Julia assumes the first bit of each
4747
byte is packed as a 0x01, while in TIFFs it's actually packed as 0x80. This
48-
function flips the bit packing order.
48+
function flips the bit packing order.
4949
5050
!!! note
5151
This function does not flip the byte packing order, a la `bswap`.
5252
5353
This function should be applied to a BitArray after it is read in via
54-
[`reversebits!`](@ref).
54+
[`reversebits!`](@ref).
5555
5656
Code adapted from https://github.com/JuliaLang/julia/pull/34791
5757
5858
```jldoctest
59-
julia> TIFF.reversebits(0x0101) == 0x8080
59+
julia> TiffImages.reversebits(0x0101) == 0x8080
6060
true
6161
```
6262
"""

0 commit comments

Comments
 (0)