Coder Social home page Coder Social logo

imageview.jl's Introduction

ImageView.jl

An image display GUI for Julia.

Installation

To install the ImageView package:

Pkg.add("ImageView")

Preparation

First let's try it with a photograph. If you have an image on your computer, load it this way:

using ImageView, Images
img = load("my_photo.jpg")

Any typical image format should be fine, it doesn't have to be a jpg. The TestImages package contains several standard images:

using TestImages
img = testimage("mandrill")

Demonstration of the GUI

For simplicity, you should first test ImageView at the REPL prompt or in an IDE; script usage is discussed later below.

You can view the image using imshow:

imshow(img)

You should get a window with your image:

photo

You can use imshow() if you want to choose an image using a file dialog.

Try resizing the image window by dragging one of its corners; you'll see that the aspect ratio of the image is preserved when you resize. If instead you want the image to fill the pane, try imshow(img, aspect=:none). Here's a comparison of the two:

aspect=:auto (default) aspect=:none
photo photo

Next, Ctrl-click and drag somewhere inside the image. You'll see the typical rubberband selection, and once you let go the image display will zoom in on the selected region. Again, the aspect ratio of the display is preserved. If you click on the image without holding down Ctrl, you can drag the image to look at nearby regions. Ctrl-double-click on the image to restore the full region.

If you have a wheel mouse, zoom in again and scroll the wheel, which should cause the image to pan vertically. If you scroll while holding down Shift, it pans horizontally; hold down Ctrl and you affect the zoom setting. Note as you zoom via the mouse, the zoom stays focused around the mouse pointer location, making it easy to zoom in on some small feature simply by pointing your mouse at it and then Ctrl-scrolling.

You can view the image upside-down with

imshow(img, flipy=true)

(flipx flips the image horizontally) or switch the horizontal and vertical axes with

imshow(img, axes=(2,1)).

The window can be closed using Ctrl-W (use Cmd-W on a Mac). All windows opened by ImageView can be closed using Ctrl-Shift-W (Cmd-Shift-W on a Mac). Fullscreen can be toggled using F11 (on Linux or Windows, use Cmd-Shift-F on a Mac).

For movies, 3D, and 4D images, ImageView will create a "player" widget.

img = testimage("mri")
imshow(img)

The "mri" image is an AxisArray, and consequently you can select axes by name:

imshow(img, axes=(:S, :P), flipy=true)  # a sagittal plane (Superior, Posterior)
imshow(img) imshow(img, axes=(:S, :P), flipy=true)
photo photo

Finally, right-clicking on the image yields context menu that allows you to save the image shown in the viewer (including annotations) to a PNG file or to the clipboard, and a brightness/contrast GUI:

Contrast GUI snapshot

You can adjust the contrast by adjusting the sliders or by entering values into the text boxes.

Programmatic usage

Simple command-line utilities

ImageView.closeall() closes all open windows.

You can place multiple images in the same window using imshow_gui:

using ImageView, TestImages, Gtk4
gui = imshow_gui((300, 300), (2, 1))  # 2 columns, 1 row of images (each initially 300×300)
canvases = gui["canvas"]
imshow(canvases[1,1], testimage("lighthouse"))
imshow(canvases[1,2], testimage("mandrill"))
show(gui["window"])

canvasgrid snapshot

gui["window"] returns the window; gui["canvas"] either returns a single canvas (if there is just one), or an array if you've specified a grid of canvases.

Gtk4.show(win) is sometimes needed when using the lower-level utilities of this package. Generally you should call it after you've finished assembling the entire window, so as to avoid redraws with each subsequent change.

The dictionary and region-of-interest manipulations

imshow returns a dictionary containing a wealth of information about the state of the viewer. Perhaps most interesting is the "roi" entry, which itself is another dictionary containing information about the current selected region or interest. These are Observables signals, and consequently you can even manipulate the state of the GUI by push!ing new values to these signals.

For example, using the "mri" image above, you can select the 5th slice with

guidict = imshow(img)
guidict["roi"]["slicedata"].signals[1][] = 5

SliceData objects contain information about which axes are displayed and the current slice indices of those axes perpendicular to the view plane. Likewise, "image roi" contains the actual image data currently being shown in the window (including all zoom/slice settings).

The "zoom"- and "pan"-related signals originate from GtkObservables, and users should see the documentation for that package for more information.

Coupling two or more images together

imshow allows you to pass many more arguments; please use ?imshow to see some of the options. We can use these extra arguments to couple the zoom and slice regions between two images. Let's make a "fake" image encoding the segmentation of an image:

using ImageView, GtkObservables, TestImages, Images

# Prepare the data
mri = testimage("mri")
mriseg = RGB.(mri)
mriseg[mri .> 0.5] .= colorant"red"

Now we display the images:

guidata = imshow(mri, axes=(1,2))
zr = guidata["roi"]["zoomregion"]
slicedata = guidata["roi"]["slicedata"]
imshow(mriseg, nothing, zr, slicedata)

Here we used imshow to create the first window, and then extracted the zoomregion and slicedata information from that display and used them to initialize a second window with the second image. If you zoom, pan, or change the slice plane in one window, it makes the same change in the other.

Alternatively, you can place both displays in a single window:

zr, slicedata = roi(mri, (1,2))
gd = imshow_gui((200, 200), (1,2); slicedata=slicedata)
imshow(gd["frame"][1,1], gd["canvas"][1,1], mri, nothing, zr, slicedata)
imshow(gd["frame"][1,2], gd["canvas"][1,2], mriseg, nothing, zr, slicedata)

You should see something like this:

coupled

Annotations

You can add and remove various annotations to images (currently text, points, and lines). There are two basic styles of annotation: "anchored" and "floating." An "anchored" annotation is positioned at a particular pixel location within the image; if you zoom or pan, the annotation will move with the image, and may not even be shown if the corresponding position is off-screen. In contrast, a "floating" annotation is not tied to a particular location in the image, and will always be displayed at approximately the same position within the window even if you zoom or pan. As a consequence, "anchored" annotations are best for labeling particular features in the image, and "floating" annotations are best for things like scalebars.

Here's an example of adding a 30-pixel scale bar to an image:

guidict = imshow(img)
scalebar(guidict, 30; x = 0.1, y = 0.05)

x and y describe the center of the scale bar in normalized coordinates, with (0,0) in the upper left. In this example, the length of the scale bar is in pixels, but if you're using the Unitful package for the image's pixelspacing, then you should set the length to something like 50μm.

The remaining examples are for fixed annotations. Here is a demonstration:

using Images, ImageView
z = ones(10,50);
y = 8; x = 2;
z[y,x] = 0
guidict = imshow(z)
idx = annotate!(guidict, AnnotationText(x, y, "x", color=RGB(0,0,1), fontsize=3))
idx2 = annotate!(guidict, AnnotationPoint(x+10, y, shape='.', size=4, color=RGB(1,0,0)))
idx3 = annotate!(guidict, AnnotationPoint(x+20, y-6, shape='.', size=1, color=RGB(1,0,0), linecolor=RGB(0,0,0), scale=true))
idx4 = annotate!(guidict, AnnotationLine(x+10, y, x+20, y-6, linewidth=2, color=RGB(0,1,0)))
idx5 = annotate!(guidict, AnnotationBox(x+10, y, x+20, y-6, linewidth=2, color=RGB(0,0,1)))
# This shows that you can remove annotations, too:
delete!(guidict, idx)

This is what this looks like before delete!ing the first annotation:

annotations

If you have a grid of images, then each image needs its own set of annotations, initialized by calling annotations():

using ImageView, Images, Gtk4
# Create the window and a 2x2 grid of canvases, each 300x300 pixels in size
gui = imshow_gui((300, 300), (2, 2))
canvases = gui["canvas"]
# Create some single-color images (just for testing purposes)
makeimage(color) = fill(color, 100, 100)
imgs = makeimage.([colorant"red" colorant"green";
                   colorant"blue" colorant"purple"])
# Create empty annotations structures for each canvas
anns = [annotations() annotations();
        annotations() annotations()]
# Draw the images on the canvases. Note that we supply the annotation object for each.
roidict = [imshow(canvases[1,1], imgs[1,1], anns[1,1]) imshow(canvases[1,2], imgs[1,2], anns[1,2]);
           imshow(canvases[2,1], imgs[2,1], anns[2,1]) imshow(canvases[2,2], imgs[2,2], anns[2,2])]
# Now we'll add an annotation to the lower-right image
annotate!(anns[2,2], canvases[2,2], roidict[2,2], AnnotationBox(5, 5, 30, 80, linewidth=3, color=RGB(1,1,0)))

grid annotations

Annotation API

AnnotationText(x, y, str;
               z = NaN, t =  NaN,
               color = RGB(0,0,0), angle = 0.0, fontfamily = "sans", fontsize = 10,
               fontoptions = "",  halign = "center", valign = "center", markup = false, scale=true)

Place str at position (x,y).

Properties:

  • z - position on z axis, for 3D images
  • t - position on time axis, for movie-like images
  • color
  • angle
  • fontfamily
  • fontsize - font size in points
  • fontoptions
  • halign - "center", "left", or "right"
  • valign - "center", "top", or "bottom"
  • markup
  • scale - scale the text as the image is zoomed (default: true)
AnnotationPoints([xy | xys | x, y];
                 z = NaN, t = NaN, size=10.0, shape::Char='x',
                 color = RGB(1,1,1), linewidth=1.0, linecolor=color, scale::Bool=false)

Annotate the point xy, (x,y), or the points xys. xys maybe a Vector of tuples Vector{(Real,Real)}, or a 2 x N Matrix. Points are assumed to be in (x,y) order. (TODO: this could be generalized, as with lines.)

Properties:

  • z - position on z axis, for 3D images
  • t - position on time axis, for movie-like images
  • size - how large to draw the point
  • shape - one of '.', 'x', 'o', '+', '*'
  • color
  • linewidth - width of lines used to draw the point
  • linecolor - line color; defaults to color; filled circles (shape='.') can have a different outline and fill color
  • scale - scale the drawn size of the point when the image is scaled (default: false)
AnnotationLines(line | lines | c1,c2,c3,c4;
                z = NaN, t = NaN,
                color = RGB(1,1,1), linewidth=1.0, coord_order="xyxy")

Draw line, lines, or the line with coordinates (c1,c2,c3,c4). line is specified as a tuple of point tuples, ((x1,y1),(x2,y2)). lines may be a Vector of such lines, or a 4 x N matrix. For a matrix or when specifying coordinates independently, the coordinate order is specified by coord_order, which defaults to "xyxy".

Properties:

  • z - position on z axis, for 3D images
  • t - position on time axis, for movie-like images
  • color
  • linewidth - width of the line(s)
  • coord_order - for matrix or coordinate inputs, the order of the coordinates (e.g., "xyxy", "xxyy", "yyxx")
AnnotationBox(left, top, right, bottom | (x1,y1), (x2,y2) | bb::Graphics.BoundingBox;
              z = NaN, t = NaN,
              color = RGB(1,1,1), linewidth=1.0, coord_order="xyxy")

Draw a box. Box can be specified using four values for (left, top, right, bottom), as a pair of tuples, (x1,y1),(x2,y2), or as a BoundingBox. The coordinate order the pair of tuples may be specified by coord_order, which defaults to "xyxy".

Properties:

  • z - position on z axis, for 3D images
  • t - position on time axis, for movie-like images
  • color
  • linewidth - width of the lines

Additional notes

Calling imshow from a script file

If you call Julia from a script file, the GLib main loop (which is responsible for handling events like mouse clicks, etc.) will not start automatically, and the julia process will terminate at the end of the program. This will cause any windows opened with imshow() to terminate, which is probably not what you intend. We want to start the main loop and then make it only terminate the process when the image window is closed. Below is some example code to do this:

using Images, ImageView, TestImages, Gtk4

img = testimage("mandrill")
guidict = imshow(img);

#If we are not in a REPL
if (!isinteractive())

    # Create a condition object
    c = Condition()

    # Get the window
    win = guidict["gui"]["window"]
    
    # Start the GLib main loop
    @async Gtk4.GLib.glib_main()

    # Notify the condition object when the window closes
    signal_connect(win, :close_request) do widget
        notify(c)
    end

    # Wait for the notification before proceeding ...
    wait(c)
end

This will prevent the julia process from terminating immediately. Note that if we did not call signal_connect, the process will keep waiting even after the image window has closed, and you will have to manually close it with CTRL + C.

If you are opening more than one window you will need to create more than one Condition object, if you wish to wait until the last one is closed. See (here)[https://juliagtk.github.io/Gtk4.jl/dev/howto/nonreplusage/] for more information.

imageview.jl's People

Contributors

bjarthur avatar cmey avatar cody-g avatar dfdx avatar evizero avatar femtocleaner[bot] avatar github-actions[bot] avatar haoyangrong avatar jakebolewski avatar johnnychen94 avatar juliatagbot avatar jwahlstrand avatar kmsquire avatar lucasb-eyer avatar mateuszbaran avatar motatoes avatar pitmonticone avatar rsrock avatar silenj avatar sremedios avatar stefankarpinski avatar timholy avatar tkelman avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

imageview.jl's Issues

TclError

I've updated all the packages on my w7 machine and got:

           _

_ _ ()_ | A fresh approach to technical computing
() | () () | Documentation: http://docs.julialang.org
_ _ | | __ _ | Type "help()" for help.
| | | | | | |/ ` | |
| | |
| | | | (
| | | Version 0.3.2+2 (2014-10-22 01:21 UTC)
/ |_'|||__'| | release-0.3/6babc84* (fork: 180 commits, 134 days)
|__/ | x86_64-w64-mingw32

julia> using ImageView
ERROR: TclError("error initializing Tcl: Can't find a usable init.tcl in the following directories: \n {C:
tcl} C:/Python34/share/tcl8.6 C:/Python34/lib/tcl8.6 {C:/Program Files/Julia-0.3.2/lib/tcl8.6} {C:/Program Fi
/Program Files/Julia-0.3.2/library} {C:/Program Files/library} {C:/Program Files/tcl8.6.1/library} C:/tcl8.6.
is probably means that Tcl wasn't installed properly.\n")
in init at C:\Users\dolejm1.julia\v0.3\Tk\src\tkwidget.jl:58
while loading C:\Users\dolejm1.julia\v0.3\Tk\src\tkwidget.jl, in expression starting on line 453
while loading C:\Users\dolejm1.julia\v0.3\Tk\src\Tk.jl, in expression starting on line 25
while loading C:\Users\dolejm1.julia\v0.3\ImageView\src\ImageView.jl, in expression starting on line 7

[PkgEval] ImageView may have a testing issue on Julia 0.4 (2014-10-08)

PackageEvaluator.jl is a script that runs nightly. It attempts to load all Julia packages and run their tests (if available) on both the stable version of Julia (0.3) and the nightly build of the unstable version (0.4). The results of this script are used to generate a package listing enhanced with testing results.

On Julia 0.4

  • On 2014-10-05 the testing status was Tests pass.
  • On 2014-10-08 the testing status changed to Package doesn't load.

Tests pass. means that PackageEvaluator found the tests for your package, executed them, and they all passed.

Package doesn't load. means that PackageEvaluator did not find tests for your package. Additionally, trying to load your package with using failed.

Special message from @IainNZ: This change may be due to breaking changes to Dict in JuliaLang/julia#8521, or the removal of deprecated syntax in JuliaLang/julia#8607.

This issue was filed because your testing status became worse. No additional issues will be filed if your package remains in this state, and no issue will be filed if it improves. If you'd like to opt-out of these status-change messages, reply to this message saying you'd like to and @IainNZ will add an exception. If you'd like to discuss PackageEvaluator.jl please file an issue at the repository. For example, your package may be untestable on the test machine due to a dependency - an exception can be added.

Test log:

>>> 'Pkg.add("ImageView")' log

WARNING: deprecated syntax "(String=>String)[]" at /home/idunning/pkgtest/.julia/v0.4/BinDeps/src/BinDeps.jl:146.
Use "Dict{String,String}()" instead.

WARNING: deprecated syntax "(String=>String)[]" at /home/idunning/pkgtest/.julia/v0.4/BinDeps/src/BinDeps.jl:147.
Use "Dict{String,String}()" instead.

WARNING: deprecated syntax "(String=>String)[]" at /home/idunning/pkgtest/.julia/v0.4/BinDeps/src/BinDeps.jl:148.
Use "Dict{String,String}()" instead.

WARNING: deprecated syntax "(String=>String)[]" at /home/idunning/pkgtest/.julia/v0.4/BinDeps/src/BinDeps.jl:149.
Use "Dict{String,String}()" instead.

WARNING: deprecated syntax "(Symbol=>Any)[]" at /home/idunning/pkgtest/.julia/v0.4/BinDeps/src/dependencies.jl:224.
Use "Dict{Symbol,Any}()" instead.

WARNING: deprecated syntax "(Symbol=>Any)[]" at /home/idunning/pkgtest/.julia/v0.4/BinDeps/src/dependencies.jl:383.
Use "Dict{Symbol,Any}()" instead.

WARNING: deprecated syntax "{a=>b, ...}" at /home/idunning/pkgtest/.julia/v0.4/BinDeps/src/dependencies.jl:387.
Use "Dict{Any,Any}(a=>b, ...)" instead.

WARNING: deprecated syntax "(Any=>Any)[]" at /home/idunning/pkgtest/.julia/v0.4/BinDeps/src/dependencies.jl:494.
Use "Dict{Any,Any}()" instead.

WARNING: deprecated syntax "(Any=>Any)[]" at /home/idunning/pkgtest/.julia/v0.4/BinDeps/src/dependencies.jl:555.
Use "Dict{Any,Any}()" instead.

WARNING: deprecated syntax "(Any=>Any)[]" at /home/idunning/pkgtest/.julia/v0.4/BinDeps/src/dependencies.jl:660.
Use "Dict{Any,Any}()" instead.

WARNING: deprecated syntax "{a=>b, ...}" at /home/idunning/pkgtest/.julia/v0.4/Cairo/deps/build.jl:53.
Use "Dict{Any,Any}(a=>b, ...)" instead.

WARNING: deprecated syntax "{a=>b, ...}" at /home/idunning/pkgtest/.julia/v0.4/Cairo/deps/build.jl:63.
Use "Dict{Any,Any}(a=>b, ...)" instead.

WARNING: deprecated syntax "{a=>b, ...}" at /home/idunning/pkgtest/.julia/v0.4/Cairo/deps/build.jl:73.
Use "Dict{Any,Any}(a=>b, ...)" instead.

WARNING: deprecated syntax "{a=>b, ...}" at /home/idunning/pkgtest/.julia/v0.4/Cairo/deps/build.jl:88.
Use "Dict{Any,Any}(a=>b, ...)" instead.

WARNING: deprecated syntax "[a=>b, ...]" at /home/idunning/pkgtest/.julia/v0.4/Cairo/deps/build.jl:136.
Use "Dict(a=>b, ...)" instead.

WARNING: deprecated syntax "[a=>b, ...]" at /home/idunning/pkgtest/.julia/v0.4/Images/deps/build.jl:78.
Use "Dict(a=>b, ...)" instead.

WARNING: deprecated syntax "[a=>b, ...]" at /home/idunning/pkgtest/.julia/v0.4/Tk/deps/build.jl:54.
Use "Dict(a=>b, ...)" instead.
INFO: Installing BinDeps v0.3.5
INFO: Installing Cairo v0.2.18
INFO: Installing Color v0.3.8
INFO: Installing FixedPointNumbers v0.0.4
INFO: Installing ImageView v0.1.7
INFO: Installing Images v0.4.17
INFO: Installing IniFile v0.2.3
INFO: Installing SHA v0.0.3
INFO: Installing SIUnits v0.0.2
INFO: Installing TexExtensions v0.0.2
INFO: Installing Tk v0.2.15
INFO: Installing URIParser v0.0.3
INFO: Installing Winston v0.11.5
INFO: Installing Zlib v0.1.7
INFO: Building Cairo
INFO: Building Images
INFO: Building Tk
INFO: Package database updated
INFO: METADATA is out-of-date a you may not have the latest version of ImageView
INFO: Use `Pkg.update()` to get the latest versions of your packages

>>> 'using ImageView' log

WARNING: deprecated syntax "{a=>b, ...}" at /home/idunning/pkgtest/.julia/v0.4/Color/src/names_data.jl:6.
Use "Dict{Any,Any}(a=>b, ...)" instead.

WARNING: deprecated syntax "{a=>b, ...}" at /home/idunning/pkgtest/.julia/v0.4/Color/src/maps_data.jl:9.
Use "Dict{Any,Any}(a=>b, ...)" instead.

WARNING: deprecated syntax "{a=>b, ...}" at /home/idunning/pkgtest/.julia/v0.4/Color/src/maps_data.jl:20.
Use "Dict{Any,Any}(a=>b, ...)" instead.

WARNING: deprecated syntax "[a=>b, ...]" at /home/idunning/pkgtest/.julia/v0.4/Cairo/src/constants.jl:126.
Use "Dict(a=>b, ...)" instead.

WARNING: deprecated syntax "[a=>b, ...]" at /home/idunning/pkgtest/.julia/v0.4/Cairo/src/constants.jl:139.
Use "Dict(a=>b, ...)" instead.

WARNING: deprecated syntax "[a=>b, ...]" at /home/idunning/pkgtest/.julia/v0.4/Cairo/src/constants.jl:147.
Use "Dict(a=>b, ...)" instead.

WARNING: deprecated syntax "(String=>String)[]" at /home/idunning/pkgtest/.julia/v0.4/BinDeps/src/BinDeps.jl:146.
... truncated ...

WARNING: deprecated syntax "[a=>b, ...]" at /home/idunning/pkgtest/.julia/v0.4/Images/src/core.jl:560.
Use "Dict(a=>b, ...)" instead.

WARNING: deprecated syntax "[a=>b, ...]" at /home/idunning/pkgtest/.julia/v0.4/Images/src/core.jl:566.
Use "Dict(a=>b, ...)" instead.

WARNING: deprecated syntax "(ASCIIString=>Any)[]" at /home/idunning/pkgtest/.julia/v0.4/Images/src/core.jl:626.
Use "Dict{ASCIIString,Any}()" instead.

WARNING: deprecated syntax "(ASCIIString=>Any)[]" at /home/idunning/pkgtest/.julia/v0.4/Images/src/core.jl:1008.
Use "Dict{ASCIIString,Any}()" instead.

WARNING: deprecated syntax "[a=>b, ...]" at /home/idunning/pkgtest/.julia/v0.4/Images/src/ioformats/libmagickwand.jl:96.
Use "Dict(a=>b, ...)" instead.
Julia Version 0.4.0-dev+998
Commit e24fac0 (2014-10-07 22:02 UTC)
Platform Info:
  System: Linux (x86_64-unknown-linux-gnu)
  CPU: Intel(R) Xeon(R) CPU E5-2650 0 @ 2.00GHz
  WORD_SIZE: 64
  BLAS: libopenblas (USE64BITINT DYNAMIC_ARCH NO_AFFINITY Sandybridge)
  LAPACK: libopenblas
  LIBM: libopenlibm
  LLVM: libLLVM-3.3

ERROR: `Dict{K,V}` has no method matching Dict{K,V}(::Array{ASCIIString,1}, ::UnitRange{Int64})
 in include at ./boot.jl:245
 in include_from_node1 at ./loading.jl:128
 in include at ./boot.jl:245
 in include_from_node1 at ./loading.jl:128
 in reload_path at ./loading.jl:152
 in _require at ./loading.jl:67
 in require at ./loading.jl:54
 in require_3B_3964 at /home/idunning/julia04/usr/bin/../lib/julia/sys.so
 in include at ./boot.jl:245
 in include_from_node1 at ./loading.jl:128
 in reload_path at ./loading.jl:152
 in _require at ./loading.jl:67
 in require at ./loading.jl:52
 in require_3B_3964 at /home/idunning/julia04/usr/bin/../lib/julia/sys.so
 in include at ./boot.jl:245
 in include_from_node1 at loading.jl:128
 in process_options at ./client.jl:293
 in _start at ./client.jl:362
 in _start_3B_3789 at /home/idunning/julia04/usr/bin/../lib/julia/sys.so
while loading /home/idunning/pkgtest/.julia/v0.4/Images/src/ioformats/libmagickwand.jl, in expression starting on line 94
while loading /home/idunning/pkgtest/.julia/v0.4/Images/src/Images.jl, in expression starting on line 32
while loading /home/idunning/pkgtest/.julia/v0.4/ImageView/src/ImageView.jl, in expression starting on line 9
while loading /home/idunning/pkgtest/.julia/v0.4/ImageView/testusing.jl, in expression starting on line 2

>>> test log
no tests to run
>>> end of log

ImageView struggles with oversized images and/or transparency?

I tried out the following PNG:

https://f.cloud.github.com/assets/259840/1630592/ebbb3412-574e-11e3-8925-f16adae5b537.png

Which results in the following output:

2013-11-27-113948_1366x768_scrot

It might be a bit tricky to see, it's that effect when you draw over the old screen output without "cleaning it up" first. You know, like the windows solitaire win screen.

By comparison, this test image I made seems to work fine, giving the expected neutral gray background for transparent pixels:

transparencytest

Import Error

Hi this is a import error in Xubuntu 14.04.1

ERROR: TclError("error initializing Tk: version conflict for package \"Tcl\": have 8.5.15, need 8.6")
 in init at /home/elsuizo/.julia/v0.3/Tk/src/tkwidget.jl:61
 in include at ./boot.jl:245
 in include_from_node1 at ./loading.jl:128
 in include at ./boot.jl:245
 in include_from_node1 at ./loading.jl:128
 in reload_path at loading.jl:152
 in _require at loading.jl:67
 in require at loading.jl:54
 in include at ./boot.jl:245
 in include_from_node1 at ./loading.jl:128
 in reload_path at loading.jl:152
 in _require at loading.jl:67
 in require at loading.jl:51
while loading /home/elsuizo/.julia/v0.3/Tk/src/tkwidget.jl, in expression starting on line 452
while loading /home/elsuizo/.julia/v0.3/Tk/src/Tk.jl, in expression starting on line 25
while loading /home/elsuizo/.julia/v0.3/ImageView/src/ImageView.jl, in expression starting on line 7

my versioninfo() output is:

Julia Version 0.3.0
Commit 7681878 (2014-08-20 20:43 UTC)
Platform Info:
System: Linux (x86_64-linux-gnu)
CPU: AMD Athlon(tm) II X2 270 Processor
WORD_SIZE: 64
BLAS: libblas.so.3
LAPACK: liblapack.so.3
LIBM: libopenlibm
LLVM: libLLVM-3.3

Size

Run view(zeros(100,100)) and you'll get a window with 100x100-sized content. The problem is that the content itself only is 100x84, because the "statusbar" has a height of 16.

I wanted to write a PR that adds 16 to whfull, but I don't think the xypos label's height is fixed to 16 anywhere in code and I couldn't find any obvious way of fixing it.

METADATA broken - missing commit

Pkg.update() gives:

INFO: Updating cache of ImageView...
ERROR: Missing package versions (possible metadata misconfiguration):  ImageView v(v"0.0.8",v"0.0.9") [7655e53e8f4a938ca393ab9b7b66f25213028a1e[1:10]]

 in error at error.jl:21
 in _resolve at pkg.jl:253
 in anonymous at no file:209
 in cd at file.jl:25
 in cd at pkg/dir.jl:30
 in update at pkg.jl:173

Probably you forgot to push the commit?

Calling display() in a script - image window closes right away

Not sure if this is a bug or no, but I tried to save the following script and then call it with julia <scriptname>:

using Images
using ImageView

img = imread("path/to/file")
imgc, imgslice = display(img)

Seems to work but the image window shows up for a split-second and then closes right away. No errors appear. Same script works fine in the REPL though ..

I experience same behavior on both Windows 7 and Ubuntu 12.04

Make a test/REQUIRE file

When 0.3 comes out, we can start using Pkg.test() more widely, as well as the useful test-only dependency file test/REQUIRE. PackageEvaluator has now learnt to look for those files, so it'd be great if you could add one that just contains the line TestImages

Problem with contrast GUI

I can't seem to figure this one out. When attempting to adjust contrast, I get the following:

julia> error during Tk callback: 
ERROR: BoundsError()
 in parentdims at subarray.jl:254
 in translate_linear_indexes at subarray.jl:240
 in translate_indexes at subarray.jl:223
 in getindex at subarray.jl:263
 in prepare_histogram at /Users/rrock/.julia/ImageView/src/contrast.jl:104
 in contrastgui at /Users/rrock/.julia/ImageView/src/contrast.jl:69
 in contrastgui at /Users/rrock/.julia/ImageView/src/contrast.jl:26
 in anonymous at /Users/rrock/.julia/ImageView/src/display.jl:255
 in jl_tcl_callback at /Users/rrock/.julia/Tk/src/tkwidget.jl:119
 in tcl_doevent at /Users/rrock/.julia/Tk/src/tkwidget.jl:20
 in _uv_hook_asynccb at stream.jl:399
 in process_events at stream.jl:457
 in event_loop at multi.jl:1457
 in anonymous at client.jl:305

The problem seems to be with img[:] at line 104 of contrast.jl. I can't see why that should be so difficult, however...

display failure

This happens on linux (ubuntu 12.04) with tcl/tk 8.5:

julia> imgc, imsl = ImageView.display(img)
ERROR: getgc: Canvas is not drawable
 in wait_initialized at /home/jeff/.julia/Tk/src/tkwidget.jl:416
 in getgc at /home/jeff/.julia/Tk/src/tkwidget.jl:422
 in set_coords at /home/jeff/.julia/ImageView/src/display.jl:528
 in resize at /home/jeff/.julia/ImageView/src/display.jl:438
 in display at /home/jeff/.julia/ImageView/src/display.jl:283

I can get past this error with the following change, which I assume is not really correct:

--- a/src/display.jl
+++ b/src/display.jl
@@ -235,7 +235,7 @@ function display{A<:AbstractArray}(img::A; proplist...)
     grid(framec, 1, 1, sticky="nsew")
     grid_rowconfigure(win, 1, weight=1) # scale this cell when the window resiz
     grid_columnconfigure(win, 1, weight=1)
-    c = Canvas(framec, ww, wh)
+    c = Canvas(win, ww, wh)
     imgc.c = c
     # Place the canvas and set its resize properties
     grid(c, 1, 1, sticky="nsew")        # fill the edges of its cell on all 4 s

I get the same error for other GUIs that ImageView opens.

Winston and other julia Tk code works for me on this system.

"error during Tk callback"

Occured when closing a window displaying a jpeg, but not consistenly.

julia> display(img)
(ImageCanvas,ImageSlice2d: zoom = BoundingBox(0.0,854.0,0.0,480.0))

julia> error during Tk callback: 
ERROR: TclError("bad window path name \".jl_win5.jl_ttk_frame6.jl_ttk_frame7\"")
 in tcl_eval at /home/job/.julia/Tk/src/tkwidget.jl:97
 in tcl_eval at /home/job/.julia/Tk/src/tkwidget.jl:91
 in setbb! at /home/job/.julia/ImageView/src/display.jl:82
 in resize at /home/job/.julia/ImageView/src/display.jl:463
 in zoombb at /home/job/.julia/ImageView/src/display.jl:539
 in anonymous at /home/job/.julia/ImageView/src/display.jl:400
 in rubberband_stop at /home/job/.julia/ImageView/src/rubberband.jl:76
 in anonymous at /home/job/.julia/ImageView/src/rubberband.jl:36
 in anonymous at /home/job/.julia/Tk/src/tkwidget.jl:392
 in jl_tcl_callback at /home/job/.julia/Tk/src/tkwidget.jl:145

Ubuntu 13.10, running Julia nightly. Doesn't seem to break anything at first glance, but might point at something happening under the hood that shouldn't be?

view() does not work with m-n-1 arrays

The following snippet reproduces the issue:

img = zeros(100,100,1)
view(img, colordim=3)

ERROR: Wrong number of spatial dimensions for plain Array, use an AbstractImage type

We have to forcibly wrap the array into an Image object only to view it?

"imshow_cmd not defined" on OSX

When trying to run imshow on a matrix representing an image, I get the error "imshow_cmd not defined".

I'm on OSX, which on which it looks like imshow_cmd is supposed to be "open". I tried running open on the tmp.ppm file that gets generated and it seems the OSX by default can't open ppm files.

This seems to behave the same with and without imagemagick installed (via homebrew)

ERROR: `width` has no method matching width(::Canvas)

Hello, I'm having some trouble reproducing your examples. After doing Pkg.update(),

julia> using ImageView, Images, TestImages

julia> img = testimage("mandrill")
RGB Image with:
  data: 512x512 Array{RGB{UfixedBase{Uint8,8}},2}
  properties:
    imagedescription: <suppressed>
    spatialorder:  x y
    pixelspacing:  1 1

julia> view(img)
error during Tk callback:
ERROR: `width` has no method matching width(::Canvas)
 in setbb! at /Users/adare/.julia/v0.3/ImageView/src/display.jl:82
 in resize at /Users/adare/.julia/v0.3/ImageView/src/display.jl:518
 in anonymous at /Users/adare/.julia/v0.3/ImageView/src/display.jl:450
 in configure at /Users/adare/.julia/v0.3/Tk/src/tkwidget.jl:246
 in init_canvas at /Users/adare/.julia/v0.3/Tk/src/tkwidget.jl:407
 in anonymous at /Users/adare/.julia/v0.3/Tk/src/tkwidget.jl:386
 in jl_tcl_callback at /Users/adare/.julia/v0.3/Tk/src/tkwidget.jl:145
 in tcl_doevent at /Users/adare/.julia/v0.3/Tk/src/tkwidget.jl:20 (repeats 2 times)
 in _uv_hook_asynccb at stream.jl:489
 in process_events at /Applications/Julia-0.3.6.app/Contents/Resources/julia/lib/julia/sys.dylib
 in wait at /Applications/Julia-0.3.6.app/Contents/Resources/julia/lib/julia/sys.dylib (repeats 2 times)
 in wait_full at /Applications/Julia-0.3.6.app/Contents/Resources/julia/lib/julia/sys.dylib
 in take! at /Applications/Julia-0.3.6.app/Contents/Resources/julia/lib/julia/sys.dylib
 in take_ref at /Applications/Julia-0.3.6.app/Contents/Resources/julia/lib/julia/sys.dylib
 in call_on_owner at /Applications/Julia-0.3.6.app/Contents/Resources/julia/lib/julia/sys.dylib
 in send_to_backend at REPL.jl:573
 in send_to_backend at REPL.jl:570
 in anonymous at REPL.jl:584
 in run_interface at /Applications/Julia-0.3.6.app/Contents/Resources/julia/lib/julia/sys.dylib
 in run_frontend at /Applications/Julia-0.3.6.app/Contents/Resources/julia/lib/julia/sys.dylib
 in run_repl at /Applications/Julia-0.3.6.app/Contents/Resources/julia/lib/julia/sys.dylib
 in _start at /Applications/Julia-0.3.6.app/Contents/Resources/julia/lib/julia/sys.dylib
ERROR: `width` has no method matching width(::Canvas)
 in setbb! at /Users/adare/.julia/v0.3/ImageView/src/display.jl:82
 in resize at /Users/adare/.julia/v0.3/ImageView/src/display.jl:518
 in view at /Users/adare/.julia/v0.3/ImageView/src/display.jl:319

And a few details about my system:

julia> versioninfo()
Julia Version 0.3.6
Commit 0c24dca* (2015-02-17 22:12 UTC)
Platform Info:
  System: Darwin (x86_64-apple-darwin13.4.0)
  CPU: Intel(R) Core(TM) i7-4870HQ CPU @ 2.50GHz
  WORD_SIZE: 64
  BLAS: libopenblas (USE64BITINT DYNAMIC_ARCH NO_AFFINITY Haswell)
  LAPACK: libopenblas
  LIBM: libopenlibm
  LLVM: libLLVM-3.3

Thanks in advance for any help or suggestions.

[PkgEval] ImageView may have a testing issue on Julia 0.3 (2014-08-27)

PackageEvaluator.jl is a script that runs nightly. It attempts to load all Julia packages and run their tests (if available) on both the stable version of Julia (0.3) and the nightly build of the unstable version (0.4). The results of this script are used to generate a package listing enhanced with testing results.

On Julia 0.3

  • On 2014-08-26 the testing status was Tests pass.
  • On 2014-08-27 the testing status changed to Package doesn't load.

Tests pass. means that PackageEvaluator found the tests for your package, executed them, and they all passed.

Package doesn't load. means that PackageEvaluator did not find tests for your package. Additionally, trying to load your package with using failed.

This issue was filed because your testing status became worse. No additional issues will be filed if your package remains in this state, and no issue will be filed if it improves. If you'd like to opt-out of these status-change messages, reply to this message saying you'd like to and @IainNZ will add an exception. If you'd like to discuss PackageEvaluator.jl please file an issue at the repository. For example, your package may be untestable on the test machine due to a dependency - an exception can be added.

Test log:

>>> 'Pkg.add("ImageView")' log
INFO: Cloning cache of ImageView from git://github.com/timholy/ImageView.jl.git
INFO: Installing Cairo v0.2.16
INFO: Installing ImageView v0.1.2
INFO: Installing IniFile v0.2.3
INFO: Installing Tk v0.2.13
INFO: Installing Winston v0.11.3
INFO: Building Cairo
INFO: Building Images
INFO: Building Tk
INFO: Package database updated

>>> 'using ImageView' log
ERROR: function split does not accept keyword arguments
 in _atox at /home/idunning/pkgtest/.julia/v0.3/Winston/src/config.jl:36
 in config_options at /home/idunning/pkgtest/.julia/v0.3/Winston/src/config.jl:68
 in iniattr at /home/idunning/pkgtest/.julia/v0.3/Winston/src/Winston.jl:2539
 in HalfAxisX at /home/idunning/pkgtest/.julia/v0.3/Winston/src/Winston.jl:572
 in FramedPlot at /home/idunning/pkgtest/.julia/v0.3/Winston/src/Winston.jl:996
 in include at ./boot.jl:245
 in include_from_node1 at ./loading.jl:128
 in reload_path at loading.jl:152
 in _require at loading.jl:67
 in require at loading.jl:54
 in include at ./boot.jl:245
 in include_from_node1 at ./loading.jl:128
 in include at ./boot.jl:245
 in include_from_node1 at ./loading.jl:128
 in reload_path at loading.jl:152
 in _require at loading.jl:67
 in require at loading.jl:51
 in include at ./boot.jl:245
 in include_from_node1 at loading.jl:128
 in process_options at ./client.jl:285
 in _start at ./client.jl:354
 in _start_3B_1717 at /home/idunning/julia03/usr/bin/../lib/julia/sys.so
while loading /home/idunning/pkgtest/.julia/v0.3/Winston/src/Winston.jl, in expression starting on line 2671
while loading /home/idunning/pkgtest/.julia/v0.3/ImageView/src/contrast.jl, in expression starting on line 6
while loading /home/idunning/pkgtest/.julia/v0.3/ImageView/src/ImageView.jl, in expression starting on line 19
while loading /home/idunning/pkgtest/.julia/v0.3/ImageView/testusing.jl, in expression starting on line 2
Julia Version 0.3.1-pre+26
Commit 91ba8a9 (2014-08-26 16:55 UTC)
Platform Info:
  System: Linux (x86_64-unknown-linux-gnu)
  CPU: Intel(R) Xeon(R) CPU E5-2650 0 @ 2.00GHz
  WORD_SIZE: 64
  BLAS: libopenblas (USE64BITINT DYNAMIC_ARCH NO_AFFINITY Sandybridge)
  LAPACK: libopenblas
  LIBM: libopenlibm
  LLVM: libLLVM-3.3


>>> test log
no tests to run
>>> end of log

Fair warning: ImageView will switch to Gtk

With the merger of JuliaGraphics/Gtk.jl#110, Gtk should finally be easily installable automatically on all 3 platforms. In my opinion, this is a major watershed for Julia. Maybe we can finally have some graphics now 😄.

When I get some time (which I don't have, currently), I'm planning on switching the master branch of ImageView over to use Gtk. I'll probably also do some cleanups at the same time. If you don't want to risk suffering after the switch is made, I highly recommend trying Pkg.add("Gtk"); Pkg.test("Gtk") now and seeing how it goes. I'd be interested in hearing reports, successful or not. Problems should presumably be reported to https://github.com/JuliaLang/Gtk.jl/issues (which I watch, so I'll hear about it if you file it there).

CCing some non-watching contributors & issue-filers (to either this package or Images): @rsrock, @lucasb-eyer, @moehabib, @juliohm, @elsuizo, @JeffBezanson, @jiahao, @ssfrr, @waldyrious, @tknopp, @daniel-perry, @ihnorton, @lindahua, @jwmerrill, @cbecker. Also @staticfloat and @vtjnash, who made this transition possible.

"no method limits(PlotComposite)" in contrast gui

I get this error when trying to open the contrast GUI, with both the released version and current master:

julia> error during Tk callback: 
ERROR: no method limits(PlotComposite)
 in rerender at /home/jeff/.julia/ImageView/src/contrast.jl:87
 in setrange at /home/jeff/.julia/ImageView/src/contrast.jl:215
 in contrastgui at /home/jeff/.julia/ImageView/src/contrast.jl:106
 in contrastgui at /home/jeff/.julia/ImageView/src/contrast.jl:26
 in anonymous at /home/jeff/.julia/ImageView/src/display.jl:285
 in jl_tcl_callback at /home/jeff/.julia/Tk/src/tkwidget.jl:145

Rubberband shifted on scaled windows

This one really can wait until later, it's not a showstopper. I don't want to be a PITA, I'm just filing this to keep track of the issue...

A rubberband on a resized window, or an already zoomed window, is not drawn under the mouse. Also there are some small drawing glitches. Will need to pull out the scaled corner coordinates.

Status of contrast settings with new Color types

@timholy, what's the plan for using contrast settings for Gray{UfixedX} image types? From my quick look at FixedPointNumbers, it looks to be bitwidth focused. Will we still be able to set arbitrary black/white points (let's say, white = 153 for a Gray{Ufixed8} image)?

This capability will be pretty important. We do a lot of low-light imaging, so even though I am using a camera with a dynamic range of 14 or 16 bits, I almost never fill that range.

Warning: using Base.Graphics in module Main conflicts with an existing identifier.

For Julia 0.3 there should not be a requirement for Graphics. This leads to the following warning when starting Julia Warning: using Base.Graphics in module Main conflicts with an existing identifier. which then causes the test in test/spawn.jl on line 154 to fail with:

exception on 1: ERROR: test failed: readall(@cmd "\$exename -f -e 'println(STDERR,\"Hello World\")'" .> @cmd "cat") == "Hello World\n"

'using ImageView' results in TclError

          _

_ _ ()_ | A fresh approach to technical computing
() | () () | Documentation: http://docs.julialang.org
_ _ | | __ _ | Type "help()" for help.
| | | | | | |/ ` | |
| | |
| | | | (
| | | Version 0.3.4-pre+33 (2014-12-05 08:24 UTC)
/ |_'|||__'| | Commit ebfc7da* (4 days old release-0.3)
|__/ | x86_64-redhat-linux

julia> Pkg.add("ImageView")
INFO: Nothing to be done

julia> using ImageView
ERROR: TclError("error initializing Tk: unknown color name "BACKGROUND"")
in init at /home/phil/.julia/v0.3/Tk/src/tkwidget.jl:61
in include at ./boot.jl:245
in include_from_node1 at ./loading.jl:128
in include at ./boot.jl:245
in include_from_node1 at ./loading.jl:128
in reload_path at loading.jl:152
in _require at loading.jl:67
in require at loading.jl:54
in include at ./boot.jl:245
in include_from_node1 at ./loading.jl:128
in reload_path at loading.jl:152
in _require at loading.jl:67
in require at loading.jl:51
while loading /home/phil/.julia/v0.3/Tk/src/tkwidget.jl, in expression starting on line 453
while loading /home/phil/.julia/v0.3/Tk/src/Tk.jl, in expression starting on line 25
while loading /home/phil/.julia/v0.3/ImageView/src/ImageView.jl, in expression starting on line 7

I'm on Centos7.

ImageView keeps crashing Julia

This happens both in Lighttable and the REPL (current version 3.1 Homebrew install on mac osx 10.9.5)

It was happening intermittently before. Now have done a fresh install and it still crashing Julia..

Any advice welcome
Also once it is working any advice on how to use Imageview within Gtk would be very appreciated e.g.:
img = imread("filename.jpg")
but then how to convert to an @image object? and push! the object into a @window..

julia> using ImageView

2014-10-15 00:33:37.115 julia[25493:507] -[NSApplication _setup:]: unrecognized selector sent to instance 0x7fe2c5b09b90
2014-10-15 00:33:37.117 julia[25493:507] An uncaught exception was raised
2014-10-15 00:33:37.118 julia[25493:507] -[NSApplication _setup:]: unrecognized selector sent to instance 0x7fe2c5b09b90
2014-10-15 00:33:37.118 julia[25493:507] (
0 CoreFoundation 0x00007fff8265825c exceptionPreprocess + 172
1 libobjc.A.dylib 0x00007fff8c61ce75 objc_exception_throw + 43
2 CoreFoundation 0x00007fff8265b12d -[NSObject(NSObject) doesNotRecognizeSelector:] + 205
3 CoreFoundation 0x00007fff825b6272 forwarding + 1010
4 CoreFoundation 0x00007fff825b5df8 CF_forwarding_prep_0 + 120
5 libtk.dylib 0x0000000118e29ed6 TkpInit + 459
6 libtk.dylib 0x0000000118da7b0f Tk_Init + 1687
7 ??? 0x0000000111f45e2a 0x0 + 4596194858
8 ??? 0x0000000111f45c12 0x0 + 4596194322
9 libjulia.dylib 0x0000000103e66e94 jl_apply_generic + 244
10 libjulia.dylib 0x0000000103eb34a1 do_call + 209
11 libjulia.dylib 0x0000000103eb1d80 eval + 736
12 libjulia.dylib 0x0000000103eb20f7 eval + 1623
13 libjulia.dylib 0x0000000103eb31fb eval_body + 667
14 libjulia.dylib 0x0000000103eb338a jl_interpret_toplevel_thunk_with + 250
15 libjulia.dylib 0x0000000103ec06ef jl_toplevel_eval_flex + 1279
16 libjulia.dylib 0x0000000103ec0c84 jl_parse_eval_all + 292
17 libjulia.dylib 0x0000000103ec0e7b jl_load + 123
18 ??? 0x00000001053f3f13 0x0 + 4382998291
19 libjulia.dylib 0x0000000103e66e28 jl_apply_generic + 136
20 ??? 0x00000001053f35d2 0x0 + 4382995922
21 libjulia.dylib 0x0000000103e66e28 jl_apply_generic + 136
22 libjulia.dylib 0x0000000103eb34a1 do_call + 209
23 libjulia.dylib 0x0000000103eb1d80 eval + 736
24 libjulia.dylib 0x0000000103ec06cd jl_toplevel_eval_flex + 1245
25 libjulia.dylib 0x0000000103ec0052 jl_eval_module_expr + 690
26 libjulia.dylib 0x0000000103ec03bc jl_toplevel_eval_flex + 460
27 libjulia.dylib 0x0000000103ec0c84 jl_parse_eval_all + 292
28 libjulia.dylib 0x0000000103ec0e7b jl_load + 123
29 ??? 0x00000001053f3f13 0x0 + 4382998291
30 libjulia.dylib 0x0000000103e66e28 jl_apply_generic + 136
31 ??? 0x00000001053f35d2 0x0 + 4382995922
32 libjulia.dylib 0x0000000103e66e28 jl_apply_generic + 136
33 libjulia.dylib 0x0000000103eb34a1 do_call + 209
34 libjulia.dylib 0x0000000103eb1d80 eval + 736
35 libjulia.dylib 0x0000000103ec06cd jl_toplevel_eval_flex + 1245
36 libjulia.dylib 0x0000000103e6c2a0 jl_f_top_eval + 304
37 ??? 0x0000000110bb888b 0x0 + 4575692939
38 ??? 0x0000000110bb8455 0x0 + 4575691861
39 libjulia.dylib 0x0000000103e66e28 jl_apply_generic + 136
40 ??? 0x0000000110bb3258 0x0 + 4575670872
41 ??? 0x0000000110bb2db3 0x0 + 4575669683
42 libjulia.dylib 0x0000000103e66e28 jl_apply_generic + 136
43 libjulia.dylib 0x0000000103ec1738 eval_import_path
+ 504
44 libjulia.dylib 0x0000000103ec043a jl_toplevel_eval_flex + 586
45 libjulia.dylib 0x0000000103ec0052 jl_eval_module_expr + 690
46 libjulia.dylib 0x0000000103ec03bc jl_toplevel_eval_flex + 460
47 libjulia.dylib 0x0000000103ec0c84 jl_parse_eval_all + 292
48 libjulia.dylib 0x0000000103ec0e7b jl_load + 123
49 ??? 0x00000001053f3f13 0x0 + 4382998291
50 libjulia.dylib 0x0000000103e66e28 jl_apply_generic + 136
51 ??? 0x00000001053f35d2 0x0 + 4382995922
52 libjulia.dylib 0x0000000103e66e28 jl_apply_generic + 136
53 libjulia.dylib 0x0000000103eb34a1 do_call + 209
54 libjulia.dylib 0x0000000103eb1d80 eval + 736
55 libjulia.dylib 0x0000000103ec06cd jl_toplevel_eval_flex + 1245
56 libjulia.dylib 0x0000000103e6c327 jl_f_top_eval + 439
57 ??? 0x0000000110bb888b 0x0 + 4575692939
58 ??? 0x0000000110bb8455 0x0 + 4575691861
59 libjulia.dylib 0x0000000103e66e28 jl_apply_generic + 136
60 ??? 0x0000000110bb31c2 0x0 + 4575670722
61 ??? 0x0000000110bb2db3 0x0 + 4575669683
62 libjulia.dylib 0x0000000103e66e28 jl_apply_generic + 136
63 libjulia.dylib 0x0000000103ec1738 eval_import_path
+ 504
64 libjulia.dylib 0x0000000103ec043a jl_toplevel_eval_flex + 586
65 libjulia.dylib 0x0000000103e6c327 jl_f_top_eval + 439
66 ??? 0x00000001109b4a1a 0x0 + 4573579802
67 ??? 0x00000001109b4467 0x0 + 4573578343
68 libjulia.dylib 0x0000000103e66e28 jl_apply_generic + 136
69 ??? 0x000000011099d5a3 0x0 + 4573484451
70 libjulia.dylib 0x0000000103eb991e start_task + 158
71 libjulia.dylib 0x0000000103eb83e9 julia_trampoline + 121
72 julia 0x0000000103e51a34 start + 52
)
2014-10-15 00:33:37.120 julia[25493:507] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[NSApplication setup:]: unrecognized selector sent to instance 0x7fe2c5b09b90'
*** First throw call stack:
(
0 CoreFoundation 0x00007fff8265825c exceptionPreprocess + 172
1 libobjc.A.dylib 0x00007fff8c61ce75 objc_exception_throw + 43
2 CoreFoundation 0x00007fff8265b12d -[NSObject(NSObject) doesNotRecognizeSelector:] + 205
3 CoreFoundation 0x00007fff825b6272 ___forwarding
+ 1010
4 CoreFoundation 0x00007fff825b5df8 CF_forwarding_prep_0 + 120
5 libtk.dylib 0x0000000118e29ed6 TkpInit + 459
6 libtk.dylib 0x0000000118da7b0f Tk_Init + 1687
7 ??? 0x0000000111f45e2a 0x0 + 4596194858
8 ??? 0x0000000111f45c12 0x0 + 4596194322
9 libjulia.dylib 0x0000000103e66e94 jl_apply_generic + 244
10 libjulia.dylib 0x0000000103eb34a1 do_call + 209
11 libjulia.dylib 0x0000000103eb1d80 eval + 736
12 libjulia.dylib 0x0000000103eb20f7 eval + 1623
13 libjulia.dylib 0x0000000103eb31fb eval_body + 667
14 libjulia.dylib 0x0000000103eb338a jl_interpret_toplevel_thunk_with + 250
15 libjulia.dylib 0x0000000103ec06ef jl_toplevel_eval_flex + 1279
16 libjulia.dylib 0x0000000103ec0c84 jl_parse_eval_all + 292
17 libjulia.dylib 0x0000000103ec0e7b jl_load + 123
18 ??? 0x00000001053f3f13 0x0 + 4382998291
19 libjulia.dylib 0x0000000103e66e28 jl_apply_generic + 136
20 ??? 0x00000001053f35d2 0x0 + 4382995922
21 libjulia.dylib 0x0000000103e66e28 jl_apply_generic + 136
22 libjulia.dylib 0x0000000103eb34a1 do_call + 209
23 libjulia.dylib 0x0000000103eb1d80 eval + 736
24 libjulia.dylib 0x0000000103ec06cd jl_toplevel_eval_flex + 1245
25 libjulia.dylib 0x0000000103ec0052 jl_eval_module_expr + 690
26 libjulia.dylib 0x0000000103ec03bc jl_toplevel_eval_flex + 460
27 libjulia.dylib 0x0000000103ec0c84 jl_parse_eval_all + 292
28 libjulia.dylib 0x0000000103ec0e7b jl_load + 123
29 ??? 0x00000001053f3f13 0x0 + 4382998291
30 libjulia.dylib 0x0000000103e66e28 jl_apply_generic + 136
31 ??? 0x00000001053f35d2 0x0 + 4382995922
32 libjulia.dylib 0x0000000103e66e28 jl_apply_generic + 136
33 libjulia.dylib 0x0000000103eb34a1 do_call + 209
34 libjulia.dylib 0x0000000103eb1d80 eval + 736
35 libjulia.dylib 0x0000000103ec06cd jl_toplevel_eval_flex + 1245
36 libjulia.dylib 0x0000000103e6c2a0 jl_f_top_eval + 304
37 ??? 0x0000000110bb888b 0x0 + 4575692939
38 ??? 0x0000000110bb8455 0x0 + 4575691861
39 libjulia.dylib 0x0000000103e66e28 jl_apply_generic + 136
40 ??? 0x0000000110bb3258 0x0 + 4575670872
41 ??? 0x0000000110bb2db3 0x0 + 4575669683
42 libjulia.dylib 0x0000000103e66e28 jl_apply_generic + 136
43 libjulia.dylib 0x0000000103ec1738 eval_import_path
+ 504
44 libjulia.dylib 0x0000000103ec043a jl_toplevel_eval_flex + 586
45 libjulia.dylib 0x0000000103ec0052 jl_eval_module_expr + 690
46 libjulia.dylib 0x0000000103ec03bc jl_toplevel_eval_flex + 460
47 libjulia.dylib 0x0000000103ec0c84 jl_parse_eval_all + 292
48 libjulia.dylib 0x0000000103ec0e7b jl_load + 123
49 ??? 0x00000001053f3f13 0x0 + 4382998291
50 libjulia.dylib 0x0000000103e66e28 jl_apply_generic + 136
51 ??? 0x00000001053f35d2 0x0 + 4382995922
52 libjulia.dylib 0x0000000103e66e28 jl_apply_generic + 136
53 libjulia.dylib 0x0000000103eb34a1 do_call + 209
54 libjulia.dylib 0x0000000103eb1d80 eval + 736
55 libjulia.dylib 0x0000000103ec06cd jl_toplevel_eval_flex + 1245
56 libjulia.dylib 0x0000000103e6c327 jl_f_top_eval + 439
57 ??? 0x0000000110bb888b 0x0 + 4575692939
58 ??? 0x0000000110bb8455 0x0 + 4575691861
59 libjulia.dylib 0x0000000103e66e28 jl_apply_generic + 136
60 ??? 0x0000000110bb31c2 0x0 + 4575670722
61 ??? 0x0000000110bb2db3 0x0 + 4575669683
62 libjulia.dylib 0x0000000103e66e28 jl_apply_generic + 136
63 libjulia.dylib 0x0000000103ec1738 eval_import_path
+ 504
64 libjulia.dylib 0x0000000103ec043a jl_toplevel_eval_flex + 586
65 libjulia.dylib 0x0000000103e6c327 jl_f_top_eval + 439
66 ??? 0x00000001109b4a1a 0x0 + 4573579802
67 ??? 0x00000001109b4467 0x0 + 4573578343
68 libjulia.dylib 0x0000000103e66e28 jl_apply_generic + 136
69 ??? 0x000000011099d5a3 0x0 + 4573484451
70 libjulia.dylib 0x0000000103eb991e start_task + 158
71 libjulia.dylib 0x0000000103eb83e9 julia_trampoline + 121
72 julia 0x0000000103e51a34 start + 52
)
libc++abi.dylib: terminating with uncaught exception of type NSException

signal (6): Abort trap: 6
__pthread_kill at /usr/lib/system/libsystem_kernel.dylib (unknown line)
Abort trap: 6

Update/close display window

An option to give the display an instance would be nice. Would be great to be able to close/update the display from within Julia.

Will there be something like that in future?

Issues with scaling Gray images of various types

Hi Tim,
I'm playing around in here again, and now I'm hitting a problem inside uint32color! in algorithms.jl. I was getting an InexactError using a Float32 image. I can get a bit further if I convert my image to Uint16 (the native format stores images as Float32, but they're actually Uint16 anyway). However, then I hit a new problem with rgb24(): ERROR: no method rgb24(Uint64,Uint64,Uint64)

I can work around this by changing algorithms.jl:316 to this:

gr = uint8(scale(scalei, A[k+i]))
buf[l] = rgb24(gr, gr, gr)

Which displays a nice black image (progress!). But the real issue seems to be that this line (algorithms.jl:143)

scale(scalei::ScaleNone{Uint8}, val::Uint16) = (val>>>8) & 0xff

Returns a Uint64, which rgb24() doesn't like. I find that bitwise And type a bit surprising.

At this point, I didn't want to mess around any further, figuring you have a more complete view of how this should all work...

Growing memory usage on redraw

As reported on julia-users. I'm debugging this on the Gtk branch to take advantage of precompilation for fast reloading.

Here's a test script:

using Gtk.ShortNames, Base.Graphics, Cairo
using Images, TestImages

img = testimage("mandrill")
buf0 = Images.uint32color(img)

type MyObj
    surface::CairoSurface
end
mycanvas = MyObj(CairoImageSurface(buf0, Cairo.FORMAT_RGB24, flipxy = false))

c = @Canvas(size(buf0,1), size(buf0,2))
win = @Window(c, "Canvas")
draw(c) do widget
    ctx = getgc(c)
    buf = copy(buf0)
    rectangle(ctx, 0, 0, size(buf, 1), size(buf, 2))
    mycanvas.surface = CairoImageSurface(buf, Cairo.FORMAT_RGB24, flipxy = false)
    set_source(ctx, mycanvas.surface)
    fill(ctx)
    reveal(c, false)
end
showall(win)

# for i = 1:20; draw(c); end

If you call the draw loop at the end, memory grows, but gets freed by gc(). That doesn't seem to happen if instead you use ImageView:

imgc, imsl = view(img)
for i = 1:20; view(canvas(imgc), img); end

Not sure why or what's going wrong.

Add Display subtype for multimedia display

As we discussed, it would be nice to integrate ImageView with the new multimedia-I/O functionality in Julia.

Basically, this would entail defining a new ImageViewDisplay <: Display type, and then adding some methods to Base.display (and possibly Base.redisplay to modify an existing window):

import Base: display

function display(d::ImageViewDisplay, x)
    if mimewritable("image/png", x)
        return display(d, "image/png", x)
    elseif mimewritable("image/jpeg", x)
        return display(d, "image/jpeg", x)
    elseif ....display other supported MIME types....
    end
    throw(MethodError(display, (d,x))) # x not displayable
end

function display(d::ImageViewDisplay, m::@MIME("image/png"), x)
     png_data = reprmime(m, x) # returns Vector{Uint8} of PNG data
     .... display png_data ...
end

or however you want to implement it.

ERROR: `width` has no method matching width(::GtkCanvas)

I've been using the gtk branch of ImageView in order to avoid a different Tk bug that I was experiencing on Ubuntu 12.04 (it was suggested to try the gtk branch and also suggested that the gtk branch would become the main branch soon.)

Today, I did a Pkg.update() (which probably wasn't a very good idea as I'm using this special gtk branch of ImageView) and after that I had some problems. I went and completely reinstalled the gtk branch of ImageView and this is what I'm getting now:

julia> using ImageView, Images

julia> using TestImages

julia> img = testimage("mandrill")
RGB Image with:
data: 512x512 Array{RGB{UfixedBase{Uint8,8}},2}
properties:
IMcs: RGB
spatialorder: x y
pixelspacing: 1 1

julia> view(img)
(ImageCanvas,ImageSlice2d: zoom = BoundingBox(0.0,512.0,0.0,512.0))

julia> ERROR: width has no method matching width(::GtkCanvas)
in setbb! at /home/phil/.julia/v0.3/ImageView/src/display.jl:80
in resize at /home/phil/.julia/v0.3/ImageView/src/display.jl:582
in anonymous at /home/phil/.julia/v0.3/ImageView/src/display.jl:420
in draw at /home/phil/.julia/v0.3/Gtk/src/cairo.jl:72
in notify_resize at /home/phil/.julia/v0.3/Gtk/src/cairo.jl:52

Is there some version mismatch now between Cairo, GTK and ImageView?

[PkgEval] ImageView may have a testing issue on Julia 0.3 (2014-07-08)

PackageEvaluator.jl is a script that runs nightly. It attempts to load all Julia packages and run their tests (if available) on both the stable version of Julia (0.2) and the nightly build of the unstable version (0.3). The results of this script are used to generate a package listing enhanced with testing results.

On Julia 0.3

  • On 2014-07-07 the testing status was Tests pass.
  • On 2014-07-08 the testing status changed to Package doesn't load.

Tests pass. means that PackageEvaluator found the tests for your package, executed them, and they all passed.

Package doesn't load. means that PackageEvaluator did not find tests for your package. Additionally, trying to load your package with using failed.

This issue was filed because your testing status became worse. No additional issues will be filed if your package remains in this state, and no issue will be filed if it improves. If you'd like to opt-out of these status-change messages, reply to this message saying you'd like to and @IainNZ will add an exception. If you'd like to discuss PackageEvaluator.jl please file an issue at the repository. For example, your package may be untestable on the test machine due to a dependency - an exception can be added.

Test log:

INFO: Installing BinDeps v0.2.14
INFO: Installing Cartesian v0.2.0
INFO: Installing Color v0.2.10
INFO: Installing Images v0.2.45
INFO: Installing SIUnits v0.0.1
INFO: Installing TestImages v0.0.5
INFO: Installing TexExtensions v0.0.1
INFO: Installing URIParser v0.0.2
INFO: Installing ZipFile v0.2.1
INFO: Installing Zlib v0.1.7
INFO: Building Images
INFO: Building TestImages
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed

  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
  3 4222k    3  135k    0     0   324k      0  0:00:13 --:--:--  0:00:13  324k
 57 4222k   57 2427k    0     0  1748k      0  0:00:02  0:00:01  0:00:01 1747k
100 4222k  100 4222k    0     0  2553k      0  0:00:01  0:00:01 --:--:-- 2552k
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed

  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
  2  622k    2 17187    0     0  38680      0  0:00:16 --:--:--  0:00:16 38622
100  622k  100  622k    0     0   665k      0 --:--:-- --:--:-- --:--:--  665k
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed

  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
  9  803k    9 78003    0     0   169k      0  0:00:04 --:--:--  0:00:04  168k
100  803k  100  803k    0     0   958k      0 --:--:-- --:--:-- --:--:--  957k
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed

  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
100 14154    0 14154    0     0  21439      0 --:--:-- --:--:-- --:--:-- 21413
100 65670    0 65670    0     0  79788      0 --:--:-- --:--:-- --:--:-- 79793
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed

  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
100  293k    0  293k    0     0   377k      0 --:--:-- --:--:-- --:--:--  377k
100  768k    0  768k    0     0   720k      0 --:--:--  0:00:01 --:--:--  720k
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed

  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
100 56562  100 56562    0     0   102k      0 --:--:-- --:--:-- --:--:--  102k
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed

  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
  3 6358k    3  201k    0     0  1343k      0  0:00:04 --:--:--  0:00:04 1344k
100 6358k  100 6358k    0     0  11.9M      0 --:--:-- --:--:-- --:--:-- 11.9M
INFO: Package database updated
INFO: Installing Cairo v0.2.13
INFO: Installing ImageView v0.0.19
INFO: Installing IniFile v0.2.2
INFO: Installing Tk v0.2.13
INFO: Installing Winston v0.11.0
INFO: Building Cairo
INFO: Building Images
INFO: Building Tk
INFO: Package database updated
INFO: Package database updated
INFO: Package database updated

[PkgEval] ImageView may have a testing issue on Julia 0.4 (2014-10-23)

PackageEvaluator.jl is a script that runs nightly. It attempts to load all Julia packages and run their tests (if available) on both the stable version of Julia (0.3) and the nightly build of the unstable version (0.4). The results of this script are used to generate a package listing enhanced with testing results.

On Julia 0.4

  • On 2014-10-22 the testing status was Tests pass.
  • On 2014-10-23 the testing status changed to Package doesn't load.

Tests pass. means that PackageEvaluator found the tests for your package, executed them, and they all passed.

Package doesn't load. means that PackageEvaluator did not find tests for your package. Additionally, trying to load your package with using failed.

Special message from @IainNZ: This change may be due to JuliaLang/julia#8712.

This issue was filed because your testing status became worse. No additional issues will be filed if your package remains in this state, and no issue will be filed if it improves. If you'd like to opt-out of these status-change messages, reply to this message saying you'd like to and @IainNZ will add an exception. If you'd like to discuss PackageEvaluator.jl please file an issue at the repository. For example, your package may be untestable on the test machine due to a dependency - an exception can be added.

Test log:

>>> 'Pkg.add("ImageView")' log

WARNING: deprecated syntax "{}" at /home/idunning/pkgtest/.julia/v0.4/BinDeps/src/BinDeps.jl:103.
Use "[]" instead.

WARNING: deprecated syntax "{}" at /home/idunning/pkgtest/.julia/v0.4/BinDeps/src/BinDeps.jl:104.
Use "[]" instead.

WARNING: deprecated syntax "(String=>String)[]" at /home/idunning/pkgtest/.julia/v0.4/BinDeps/src/BinDeps.jl:146.
Use "Dict{String,String}()" instead.

WARNING: deprecated syntax "(String=>String)[]" at /home/idunning/pkgtest/.julia/v0.4/BinDeps/src/BinDeps.jl:147.
Use "Dict{String,String}()" instead.

WARNING: deprecated syntax "(String=>String)[]" at /home/idunning/pkgtest/.julia/v0.4/BinDeps/src/BinDeps.jl:148.
Use "Dict{String,String}()" instead.

WARNING: deprecated syntax "(String=>String)[]" at /home/idunning/pkgtest/.julia/v0.4/BinDeps/src/BinDeps.jl:149.
Use "Dict{String,String}()" instead.

WARNING: deprecated syntax "{}" at /home/idunning/pkgtest/.julia/v0.4/BinDeps/src/dependencies.jl:87.
Use "[]" instead.

WARNING: deprecated syntax "(Symbol=>Any)[]" at /home/idunning/pkgtest/.julia/v0.4/BinDeps/src/dependencies.jl:224.
Use "Dict{Symbol,Any}()" instead.

WARNING: deprecated syntax "{a=>b for (a,b) in c}" at /home/idunning/pkgtest/.julia/v0.4/BinDeps/src/dependencies.jl:256.
Use "Dict{Any,Any}([a=>b for (a,b) in c])" instead.

WARNING: deprecated syntax "{}" at /home/idunning/pkgtest/.julia/v0.4/BinDeps/src/dependencies.jl:352.
Use "[]" instead.

WARNING: deprecated syntax "(Symbol=>Any)[]" at /home/idunning/pkgtest/.julia/v0.4/BinDeps/src/dependencies.jl:383.
Use "Dict{Symbol,Any}()" instead.

WARNING: deprecated syntax "{a=>b, ...}" at /home/idunning/pkgtest/.julia/v0.4/BinDeps/src/dependencies.jl:387.
Use "Dict{Any,Any}(a=>b, ...)" instead.

WARNING: deprecated syntax "(Any=>Any)[]" at /home/idunning/pkgtest/.julia/v0.4/BinDeps/src/dependencies.jl:494.
Use "Dict{Any,Any}()" instead.

WARNING: deprecated syntax "(Any=>Any)[]" at /home/idunning/pkgtest/.julia/v0.4/BinDeps/src/dependencies.jl:555.
Use "Dict{Any,Any}()" instead.

WARNING: deprecated syntax "(Any=>Any)[]" at /home/idunning/pkgtest/.julia/v0.4/BinDeps/src/dependencies.jl:660.
Use "Dict{Any,Any}()" instead.

WARNING: deprecated syntax "{}" at /home/idunning/pkgtest/.julia/v0.4/BinDeps/src/dependencies.jl:889.
Use "[]" instead.

WARNING: deprecated syntax "{}" at /home/idunning/pkgtest/.julia/v0.4/BinDeps/src/dependencies.jl:959.
Use "[]" instead.

WARNING: deprecated syntax "{}" at /home/idunning/pkgtest/.julia/v0.4/BinDeps/src/debug.jl:51.
Use "[]" instead.
INFO: Installing BinDeps v0.3.6
INFO: Installing Cairo v0.2.20
INFO: Installing Color v0.3.10
INFO: Installing Compat v0.1.0
INFO: Installing FixedPointNumbers v0.0.4
INFO: Installing ImageView v0.1.7
INFO: Installing Images v0.4.21
INFO: Installing IniFile v0.2.3
INFO: Installing SHA v0.0.3
INFO: Installing SIUnits v0.0.2
INFO: Installing TexExtensions v0.0.2
INFO: Installing Tk v0.2.15
INFO: Installing URIParser v0.0.3
INFO: Installing Winston v0.11.5
INFO: Installing Zlib v0.1.7
INFO: Building Cairo
INFO: Building Images
INFO: Building Tk
INFO: Package database updated

>>> 'using ImageView' log
Warning: New definition 
    convert at /home/idunning/pkgtest/.julia/v0.4/Color/src/conversions.jl:692
is ambiguous with: 
    convert at base.jl:36.
To fix, define 
    convert
before the new definition.

WARNING: deprecated syntax "{a,b, ...}" at /home/idunning/pkgtest/.julia/v0.4/Cairo/src/Cairo.jl:378.
Use "Any[a,b, ...]" instead.

WARNING: deprecated syntax "{a,b, ...}" at /home/idunning/pkgtest/.julia/v0.4/Cairo/src/Cairo.jl:409.
Use "Any[a,b, ...]" instead.

WARNING: deprecated syntax "{a,b, ...}" at /home/idunning/pkgtest/.julia/v0.4/Cairo/src/Cairo.jl:419.
Use "Any[a,b, ...]" instead.

WARNING: deprecated syntax "{a,b, ...}" at /home/idunning/pkgtest/.julia/v0.4/Cairo/src/Cairo.jl:432.
Use "Any[a,b, ...]" instead.

... truncated ...
WARNING: deprecated syntax "{a=>b, ...}" at /home/idunning/pkgtest/.julia/v0.4/Tk/src/core.jl:83.
Use "Dict{Any,Any}(a=>b, ...)" instead.

WARNING: deprecated syntax "{a=>b, ...}" at /home/idunning/pkgtest/.julia/v0.4/Tk/src/core.jl:204.
Use "Dict{Any,Any}(a=>b, ...)" instead.

WARNING: deprecated syntax "{a=>b, ...}" at /home/idunning/pkgtest/.julia/v0.4/Tk/src/containers.jl:70.
Use "Dict{Any,Any}(a=>b, ...)" instead.
Warning: New definition 
    convert at /home/idunning/pkgtest/.julia/v0.4/Images/src/core.jl:226
is ambiguous with: 
    convert at /home/idunning/pkgtest/.julia/v0.4/Images/src/core.jl:200.
To fix, define 
    convert
before the new definition.
Warning: New definition 
    convert at /home/idunning/pkgtest/.julia/v0.4/Images/src/map.jl:486
is ambiguous with: 
    convert at /home/idunning/pkgtest/.julia/v0.4/Images/src/core.jl:200.
To fix, define 
    convert
before the new definition.
(TypeConstructor,AbstractAlphaColorValue{D,T})(Type{T},T)(Type{_<:AbstractAlphaColorValue{D,T}},_<:AbstractAlphaColorValue{D,T})(Type{Image{Cdest<:Union(AbstractAlphaColorValue{C<:ColorValue{T},T<:Real},ColorValue{T}),N,A<:AbstractArray{T,N}}},AbstractImageDirect{Csrc<:Union(AbstractAlphaColorValue{C<:ColorValue{T},T<:Real},ColorValue{T}),N})(Type{Image{T,N,A<:AbstractArray{T,N}}},Image{T,N,A<:AbstractArray{T,N}})(Type{Image{_<:Union(AbstractAlphaColorValue{C<:ColorValue{T},T<:Real},ColorValue{T}),N,A<:AbstractArray{T,N}}},Image{_<:Union(AbstractAlphaColorValue{C<:ColorValue{T},T<:Real},ColorValue{T}),N,A<:AbstractArray{T,N}})(Type{Image{T<:Real,N,A<:AbstractArray{T,N}}},AbstractImageDirect{S<:Real,N})(Type{Image{T,N,A<:AbstractArray{T,N}}},Image{T,N,A<:AbstractArray{T,N}})(Type{Image{_<:Real,N,A<:AbstractArray{T,N}}},Image{_<:Real,N,A<:AbstractArray{T,N}})ERROR: R not defined
 in include at ./boot.jl:242
 in include_from_node1 at ./loading.jl:128
 in include at ./boot.jl:242
 in include_from_node1 at ./loading.jl:128
 in reload_path at ./loading.jl:152
 in _require at ./loading.jl:67
 in require at ./loading.jl:52
 in require_3B_3948 at /home/idunning/julia04/usr/bin/../lib/julia/sys.so
 in include at ./boot.jl:242
 in include_from_node1 at loading.jl:128
 in process_options at ./client.jl:293
 in _start at ./client.jl:362
 in _start_3B_3776 at /home/idunning/julia04/usr/bin/../lib/julia/sys.so
while loading /home/idunning/pkgtest/.julia/v0.4/ImageView/src/annotations.jl, in expression starting on line 70
while loading /home/idunning/pkgtest/.julia/v0.4/ImageView/src/ImageView.jl, in expression starting on line 17
while loading /home/idunning/pkgtest/.julia/v0.4/ImageView/testusing.jl, in expression starting on line 2
Julia Version 0.4.0-dev+1249
Commit 23a9373 (2014-10-23 04:46 UTC)
Platform Info:
  System: Linux (x86_64-unknown-linux-gnu)
  CPU: Intel(R) Xeon(R) CPU E5-2650 0 @ 2.00GHz
  WORD_SIZE: 64
  BLAS: libopenblas (USE64BITINT DYNAMIC_ARCH NO_AFFINITY Sandybridge)
  LAPACK: libopenblas
  LIBM: libopenlibm
  LLVM: libLLVM-3.3


>>> test log
no tests to run
>>> end of log

Nicer way to open and update windows

To display videos in VideoIO, I find that I have to read an image, open a window to display it in order to get a handle the canvas, and then use that handle inside a loop.

It would be nice if either

  1. The window could be opened without supplying an image (is this already possible?)
  2. The user could supply a name/handle for the window, which is opened on the first call, and then used for subsequent updates. (This is what OpenCV does.)

I like option 2, but wanted to get feedback before implementing anything (e.g., if something like this is already possible.)

Error upon resizing

OSX 10.8.3:

           _

_ _ ()_ | A fresh approach to technical computing
() | () () | Documentation: http://docs.julialang.org
_ _ | | __ _ | Type "help()" to list help topics
| | | | | | |/ ` | |
| | |
| | | | (
| | | Version 0.2.0-1689.r72e1ffa8.dirty
/ |_'|||__'| | Commit 72e1ffa844 2013-05-27 07:23:00*
|__/ |

julia> using Images

julia> using ImageView

julia> img=imread("t1.jpg")
RGB Image with:
data: 3x4032x3024 Uint8 Array
properties: ["colordim"=>1,"spatialorder"=>["x", "y"],"colorspace"=>"RGB"]

julia> display(img, pixelspacing=[1,1])
(IOImageCanvas,ImageSlice2d: zoom = BoundingBox(0.0,4032.0,0.0,3024.0))

julia> error during Tk callback: BoundsError()

screen shot 2013-05-28 at 1 19 21 pm

WARNINGS and Tk error when using view() with latest Julia v0.4.0 (OSX 10.9.5)

After pulling julia-v0.4.0 master, rebuilding julia, doing Pkg.update(), I encountered the following with ImageView (OSX 10.9.5):

julia> using Color, FixedPointNumbers
julia> import Images, ImageView
julia> filename = joinpath(Pkg.dir("OpenCV"), "./test/images/lena.jpeg")
"/Users/maximilianosuster/.julia/OpenCV/./test/images/lena.jpeg"

julia> image = Images.imread(filename)  # load with Images.jl
Gray Images.Image with:
  data: 512x512 Array{Images.ColorTypes.Gray{FixedPointNumbers.UfixedBase{UInt8,8}},2}
  properties:
    imagedescription: <suppressed>
    spatialorder:  x y
    pixelspacing:  1 1

julia> ImageView.view(image)
WARNING: sizehint(A,n) is deprecated, use sizehint!(A,n) instead.
 in depwarn at ./deprecated.jl:40
WARNING: iceil(x) is deprecated, use ceil(Integer,x) instead.
 in depwarn at ./deprecated.jl:40
WARNING: ifloor(x) is deprecated, use floor(Integer,x) instead.
 in depwarn at ./deprecated.jl:40
WARNING: iceil(x) is deprecated, use ceil(Integer,x) instead.
 in depwarn at ./deprecated.jl:40
WARNING: ifloor(x) is deprecated, use floor(Integer,x) instead.
 in depwarn at ./deprecated.jl:40
WARNING: iround(x) is deprecated, use round(Integer,x) instead.
 in depwarn at ./deprecated.jl:40
(ImageCanvas,ImageSlice2d: zoom = Base.Graphics.BoundingBox(0.0,512.0,0.0,512.0))

julia> WARNING: ifloor(x) is deprecated, use floor(Integer,x) instead.
 in depwarn at ./deprecated.jl:40
WARNING: ifloor(x) is deprecated, use floor(Integer,x) instead.
 in depwarn at ./deprecated.jl:40
 . . .  

The WARNING goes on forever and the only way to stop it in the REPL is to use ctrl C.
The first time it actually reported a Tk error, but I did not see it the second time I tested.

Rubberband no longer works

Now that Canvas no longer has the field frontcc the redrawing code has problems. Perhaps we should use renderbuf or surface from ImageCanvas?

"RegistryKeyLookupFailed"

On my first attempt to use imread()

               _
   _       _ _(_)_     |  A fresh approach to technical computing
  (_)     | (_) (_)    |  Documentation: http://docs.julialang.org
   _ _   _| |_  __ _   |  Type "help()" for help.
  | | | | | | |/ _` |  |
  | | |_| | | | (_| |  |  Version 0.3.4 (2014-12-26 10:42 UTC)
 _/ |\__'_|_|_|\__'_|  |  Official http://julialang.org/ release
|__/                   |  x86_64-w64-mingw32

julia> using ImageView, Images

julia> img = imread("untooned_jessicarabbit.jpg")
ERROR: RegistryKeyLookupFailed `CoderModulesPath' @ error/module.c/GetMagickModulePath/673
 in error at error.jl:21 (repeats 2 times)

Web-only ImageView

Hi,

I've just put out a call within my organisation for some effort to create a web-based version of ImageView. I wondered if anyone else had thought about how this might work or if it were feasible? Any advice for someone undertaking this task?

Andy

Gtk branch error: type cannot be constructed

I'm having issues using the Gtk branch. For any image, I consistently get:

julia> display(img)
ERROR: type cannot be constructed
 in display at /home/kevin/.julia/v0.3/ImageView/src/display.jl:231

The Gtk.jl tests work, either with the currently tagged version and with master. I have both Gtk 3.0 and 2.x installed; I think Gtk defaults to 3.0 by default, right?

I'm running a recent version of Julia on Ubuntu 13.10:

julia> versioninfo()
Julia Version 0.3.0-prerelease+3609
Commit 664cab5* (2014-06-10 05:18 UTC)
Platform Info:
  System: Linux (x86_64-linux-gnu)
  CPU: Intel(R) Core(TM) i7-4500U CPU @ 1.80GHz
  WORD_SIZE: 64
  BLAS: libopenblas (USE64BITINT DYNAMIC_ARCH NO_AFFINITY)
  LAPACK: libopenblas
  LIBM: libopenlibm

Tk is working okay for me so I'll stick to that for now.

Application Error, BoundsErrors() on TkWindows

In an open image window, I find that I get some annoying errors if I use the mouse wheel and/or press the up arrow when the main window is initially in focus. The BoundsErrors() appear at the Julia terminal and look like

julia> error during Tk callback: 
ERROR: BoundsError()
 in getindex at range.jl:270

Simultaneously, a Tk window pops up with

image

I was debating whether this belonged here or in Tk.jl, but I couldn't reproduce the behavior using Winston (which I think is still using Tk).

update for new timers interface in Julia 0.3

As discussed in JuliaLang/julia#7140, the Timer interface has changed: timer callbacks only take one argument (the timer object), rather than two (the timer object and an integer status).

It looks like playt will need to be updated to something like:

state.timer = TimeoutAsyncWork(VERSION >= v"0.3-" ? timer -> stept(inc, ctrls, state, showframe) : (timer, status) -> stept(inc, ctrls, state, showframe))

view() does not work with uint8 RGB images

The following snippet used to work in the previous version of ImageView:

X = zeros(100,100,3)
view(uint8(X), colordim=3)

It doesn't work anymore, what is the current solution?

P.S.: The new Images API returns matrices of RGB entries. How is it more efficient than the previous raw representation m-n-3? Suppose I will be doing lots of arithmetical operations with slices (e.g. subtraction, n-th power).

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.