Skip to content

Commit

Permalink
Merge pull request #31 from JuliaIO/teh/helix
Browse files Browse the repository at this point in the history
Switch to Project.toml and fixes for multichannel images
  • Loading branch information
timholy authored Jan 14, 2020
2 parents 569413d + 51e5f65 commit 06eb9cd
Show file tree
Hide file tree
Showing 12 changed files with 64 additions and 75 deletions.
3 changes: 2 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@ language: julia
os:
- linux
- osx
- windows
julia:
- 0.7
- 1.0
- 1
- nightly
notifications:
email: false
Expand Down
40 changes: 40 additions & 0 deletions Project.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name = "NRRD"
uuid = "9bb6cfbd-7763-5393-b1b5-1c8e09872146"
authors = ["Tim Holy <tim.holy@gmail.com>"]
version = "0.6.0"

[deps]
AxisArrays = "39de3d68-74b9-583c-8d2d-e117c070f3a9"
ColorVectorSpace = "c3611d14-8923-5661-9e6a-0046d554d3a4"
FileIO = "5789e2e9-d7fb-5bc7-8068-2c6fae9b9549"
ImageAxes = "2803e5a7-5153-5ecf-9a86-9b4c37f5f5ac"
ImageCore = "a09fc81d-aa75-5fe9-8630-4744c3626534"
Libz = "2ec943e9-cfe8-584d-b93d-64dcb6d567b7"
MappedArrays = "dbb5928d-eab1-5f90-85c2-b9b0edb7c900"
Mmap = "a63ad114-7e13-5084-954f-fe012c677804"
Printf = "de0858da-6303-5e67-8744-51eddeeeb8d7"
Quaternions = "94ee1d12-ae83-5a48-8b1c-48b8ff168ae0"
StaticArrays = "90137ffa-7385-5640-81b9-e52037218182"
Unitful = "1986cc42-f94f-5a68-af5c-568840ba703d"

[compat]
AxisArrays = "0.3, 0.4"
ColorVectorSpace = "0.7, 0.8"
FileIO = "1"
ImageAxes = "0.6"
ImageCore = "0.8.1"
Libz = "1"
MappedArrays = "0.2"
Quaternions = "0.4"
StaticArrays = "0.11, 0.12"
Unitful = "0.14, 0.15, 0.16, 0.17, 0.18"
julia = "1"

[extras]
ImageMetadata = "bc367c6b-8a6b-528e-b4bd-a4b897500b49"
SimpleTraits = "699a6c99-e7fa-54fc-8d76-47d257e15c1d"
Statistics = "10745b16-79ce-11e8-11f9-7d13ad32a3b2"
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"

[targets]
test = ["Statistics", "Test", "SimpleTraits", "ImageMetadata"]
8 changes: 5 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
# NRRD
[![NRRD](http://pkg.julialang.org/badges/NRRD_0.4.svg)](http://pkg.julialang.org/?pkg=NRRD)
[![NRRD](http://pkg.julialang.org/badges/NRRD_0.5.svg)](http://pkg.julialang.org/?pkg=NRRD)
[![Build Status](https://travis-ci.org/JuliaIO/NRRD.jl.svg?branch=master)](https://travis-ci.org/JuliaIO/NRRD.jl)
[![codecov.io](http://codecov.io/github/JuliaIO/NRRD.jl/coverage.svg?branch=master)](http://codecov.io/github/JuliaIO/NRRD.jl?branch=master)
[![PkgEval][pkgeval-img]][pkgeval-url]

Package for reading NRRD files.
Implements the [FileIO](https://github.com/JuliaIO/FileIO.jl) interface.
Expand All @@ -25,7 +24,7 @@ just the header. Assuming you want to save "rich" axis information, a
low-level approach using AxisArrays is the following:

```julia
using NRRD, FileIO, FixedPointNumbers, AxisArrays, Unitful
using NRRD, FileIO, ImageCore, AxisArrays, Unitful
using Unitful: μm, s

# For a 480x640x200 image with time as the third axis,
Expand All @@ -42,3 +41,6 @@ open("mydata.nhdr", "w") do io
NRRD.write_header(io, "0004", header)
end
```

[pkgeval-img]: https://juliaci.github.io/NanosoldierReports/pkgeval_badges/N/NRRD.svg
[pkgeval-url]: https://juliaci.github.io/NanosoldierReports/pkgeval_badges/report.html
13 changes: 0 additions & 13 deletions REQUIRE

This file was deleted.

43 changes: 0 additions & 43 deletions appveyor.yml

This file was deleted.

17 changes: 8 additions & 9 deletions src/NRRD.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,15 @@ module NRRD

using Mmap, Printf
# Packages needed to return the possible range of element types
using FixedPointNumbers, Colors, ColorVectorSpace, StaticArrays, Quaternions
using ImageCore, ColorVectorSpace, StaticArrays, Quaternions
# Other packages
using AxisArrays, ImageAxes, Unitful, MappedArrays
using FileIO
import Libz
import FixedPointNumbers

using Colors: AbstractGray
using AxisArrays: HasAxes

string2type = Dict(
const string2type = Dict(
"signed char" => Int8,
"int8" => Int8,
"int8_t" => Int8,
Expand Down Expand Up @@ -66,7 +64,7 @@ type2string(::Type{T}) where {T} = type2string(eltype(T), T)
type2string(::Type{T}, ::Type{T}) where {T} = error("type $T unrecognized")
type2string(::Type{T1}, ::Type{T2}) where {T1,T2} = type2string(T1)

space2axes = Dict(
const space2axes = Dict(
"right-anterior-superior" => (3,(:R,:A,:S)),
"ras" => (3,(:R,:A,:S)),
"left-anterior-superior" => (3,(:L,:A,:S)),
Expand Down Expand Up @@ -104,9 +102,9 @@ const axes2space = Dict(
# We put these in a dict so that we don't eval untrusted
# strings. Please submit PRs to add to this list if you need
# additional unit support.
unit_string_dict = Dict("" => 1, "m" => u"m", "mm" => u"mm", "s" => u"s",
"um" => u"μm", "μm" => u"μm", "microns" => u"μm",
"pixel" => 1)
const unit_string_dict = Dict("" => 1, "m" => u"m", "mm" => u"mm", "s" => u"s",
"um" => u"μm", "μm" => u"μm", "microns" => u"μm",
"pixel" => 1)

struct QString end # string with quotes around it: "mm"
VTuple{T} = Tuple{Vararg{T}} # space-delimited tuple: 80 150
Expand Down Expand Up @@ -620,7 +618,7 @@ struct UnknownColor{T,N} <: Color{T,N}
end

"""
outer_eltype!(header, Traw) -> T, nd, perm
T, nd, perm = outer_eltype!(header, Traw)
Extract the julia array `eltype` `T`, the number of dimensions `nd`
**excluding** color/complex/vector/matrix element data, and any
Expand Down Expand Up @@ -1055,6 +1053,7 @@ nrrd_format(io, ::Type{StringPTuple{T}}, s::AbstractString) where {T} = nrrd_for
nrrd_format(io, ::Type{StringPTuple{T}}, container) where {T} = nrrd_format(io, PTuple{T}, container)

alloctype(::Type{T}) where {T} = T
alloctype(::Type{PTuple{T}}) where {T} = Any
alloctype(::Type{StringPTuple{T}}) where {T} = Any # Union{String,Vector{T}}
alloctype(::Type{IntFloat}) = Union{Int,Float64}

Expand Down
2 changes: 0 additions & 2 deletions test/REQUIRE

This file was deleted.

Binary file added test/io/test_helix.nrrd
Binary file not shown.
2 changes: 1 addition & 1 deletion test/make_ufixed.jl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using FileIO, NRRD, FixedPointNumbers, Colors
using FileIO, NRRD, ImageCore

Alast = nothing
for (A, name) in ((rand(UInt8, 3, 5), "uint8"),
Expand Down
2 changes: 1 addition & 1 deletion test/readremote.jl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using FileIO, FixedPointNumbers, Colors, ImageCore, Test, Statistics
using FileIO, ImageCore, Test, Statistics

workdir = joinpath(tempdir(), "ImagesNRRD")
isdir(workdir) || mkdir(workdir)
Expand Down
7 changes: 6 additions & 1 deletion test/runtests.jl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using FileIO, FixedPointNumbers, ColorTypes, Unitful, AxisArrays, ImageAxes, ImageMetadata
using FileIO, ImageCore, Unitful, AxisArrays, ImageAxes, ImageMetadata
using Test, Base.CoreLogging

include("unu-make.jl")
Expand Down Expand Up @@ -180,6 +180,11 @@ include("unu-make.jl")
end
end

@testset "Extended eltype" begin
img = load(joinpath(dirname(@__FILE__), "io", "test_helix.nrrd"))
@test axisnames(img)[end-2:end] == (:R, :A, :S)
end

GC.gc() # to close any mmapped files
try
rm(workdir, recursive=true)
Expand Down
2 changes: 1 addition & 1 deletion test/unu-make.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Test headers written by `unu make`
using NRRD, FileIO, Colors, AxisArrays, ImageAxes, Unitful, SimpleTraits
using NRRD, FileIO, ImageCore, AxisArrays, ImageAxes, Unitful, SimpleTraits
using Test

headerpath = joinpath(dirname(@__FILE__), "headers")
Expand Down

2 comments on commit 06eb9cd

@timholy
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator register()

@JuliaRegistrator
Copy link

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/7914

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 Julia TagBot is installed, or can be done manually through the github interface, or via:

git tag -a v0.6.0 -m "<description of version>" 06eb9cda94eb3875516742fa06ff5ba77d2835f8
git push origin v0.6.0

Please sign in to comment.