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

Extensions of FileIO interface #373

Merged
merged 14 commits into from
Sep 29, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ notifications:
email: false
script:
- if [[ -a .git/shallow ]]; then git fetch --unshallow; fi
- julia -e 'Pkg.clone("https://github.com/JuliaIO/FileIO.jl.git")'
- julia -e 'Pkg.clone(pwd()); Pkg.build("Images")'
- julia -e 'Pkg.test("Images", coverage=true)'
after_success:
Expand Down
3 changes: 1 addition & 2 deletions REQUIRE
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@ julia 0.3
Compat 0.4
Colors
ColorVectorSpace
BinDeps
@osx Homebrew
SIUnits
Zlib
Graphics 0.1
FileIO
4 changes: 2 additions & 2 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ install:
build_script:
# Need to convert from shallow to complete for Pkg.clone to work
- IF EXIST .git\shallow (git fetch --unshallow)
- C:\projects\julia\bin\julia -F -e "versioninfo();
Pkg.clone(pwd(), \"Images\"); Pkg.build(\"Images\")"
- C:\projects\julia\bin\julia -F -e "versioninfo(); Pkg.clone(\"https://github.com/JuliaIO/FileIO.jl.git\", \"FileIO\")"
- C:\projects\julia\bin\julia -F -e "Pkg.clone(pwd(), \"Images\"); Pkg.build(\"Images\")"

test_script:
- C:\projects\julia\bin\julia --check-bounds=yes -e "Pkg.test(\"Images\")"
105 changes: 0 additions & 105 deletions deps/build.jl

This file was deleted.

29 changes: 17 additions & 12 deletions src/Images.jl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
VERSION >= v"0.4.0-dev+6521" && __precompile__(@unix? true : false)
VERSION >= v"0.4.0-dev+6521" && __precompile__(true)

module Images

Expand All @@ -11,7 +11,7 @@ import Base: atan2, clamp, convert, copy, copy!, ctranspose, delete!, done, elty
start, strides, sub, sum, write, writemime, zero
# "deprecated imports" are below

using Colors, ColorVectorSpace, FixedPointNumbers, Compat
using Colors, ColorVectorSpace, FixedPointNumbers, Compat, FileIO
import Colors: Fractional, red, green, blue
typealias AbstractGray{T} Color{T,1}
typealias TransparentRGB{C<:AbstractRGB,T} TransparentColor{C,T,4}
Expand All @@ -38,9 +38,6 @@ immutable TypeConst{N} end # for passing compile-time constants to functions
include("core.jl")
include("map.jl")
include("overlays.jl")
const have_imagemagick = include("ioformats/libmagickwand.jl")
@osx_only include("ioformats/OSXnative.jl")
include("io.jl")
include("labeledarrays.jl")
include("algorithms.jl")
include("connected.jl")
Expand Down Expand Up @@ -148,12 +145,6 @@ export # types
widthheight,
raw,

# io functions
add_image_file_format,
imread,
imwrite,
loadformat,

# iterator functions
first_index,
iterate_spatial,
Expand Down Expand Up @@ -245,6 +236,21 @@ export # Deprecated exports
scalesigned


import FileIO: load, save
@deprecate imread(filename; kwargs...) load(filename; kwargs...)
@deprecate imwrite(img, filename; kwargs...) save(filename, img; kwargs...)
export load, save

# only mime writeable to PNG if 2D (used by IJulia for example)
mimewritable(::MIME"image/png", img::AbstractImage) = sdims(img) == 2 && timedim(img) == 0
# We have to disable Color's display via SVG, because both will get
# sent with unfortunate results. See IJulia issue #229
mimewritable{T<:Color}(::MIME"image/svg+xml", ::AbstractMatrix{T}) = false

function __init__()
add_mime(MIME("image/png"), AbstractImage, :ImageMagick)
end

import Base: scale, scale! # delete when deprecations are removed
@deprecate scaleminmax ScaleMinMax
@deprecate scaleminmax(img::AbstractArray, min::Real, max::Real) ScaleMinMax(RGB24, img, min, max)
Expand All @@ -264,7 +270,6 @@ import Base: scale, scale! # delete when deprecations are removed
@deprecate copy(A::AbstractArray, B::AbstractArray) copyproperties(A, B)
@deprecate share(A::AbstractArray, B::AbstractArray) shareproperties(A, B)


const ScaleInfo = MapInfo # can't deprecate types?

end
2 changes: 1 addition & 1 deletion src/core.jl
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ type Image{T,N,A<:AbstractArray} <: AbstractImageDirect{T,N}
data::A
properties::Dict{ASCIIString,Any}
end
Image{T,N}(data::AbstractArray{T,N}, props::Dict) = Image{eltype(data),N,typeof(data)}(data,props)
Image(data::AbstractArray, props::Dict) = Image{eltype(data),ndims(data),typeof(data)}(data,props)
Image(data::AbstractArray; kwargs...) = Image(data, kwargs2dict(kwargs))

# Indexed image (colormap)
Expand Down
Loading