JuliaImages / ImageView.jl

Interactive display of images and movies
MIT License
134 stars 34 forks source link

Update/close display window #3

Closed riegaz closed 11 years ago

riegaz commented 11 years ago

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?

timholy commented 11 years ago

Closing the window is already possible already through the first output, but it's not as easy as it should be. The pull request referenced above would make it much easier.

What do you mean by "update"? The combination of the first and second outputs lets you call several of the functions in ImageView directly, notably resize and redraw. Need something different?

staticfloat commented 11 years ago

Hey Tim, I'm trying to do the same thing here and don't think I understand the API fully.

I am writing an implementation of Seam Carving for Content-Aware Image Resizing (PDF), and so I want to do things like draw into the same window multiple times, preferably with the ability to output an image of different dimension each time. (Resizing the window frame itself would be nice as well). Can you post an example of the code needed to do that?

timholy commented 11 years ago

Thanks for the explanation. Right now redrawing with an image of different dimensions is not supported. This is fixable, of course.

I'm on vacation right now and about to disappear for a multi-day backpacking trip, so now is not the time to push a possibly-breaking change. I'll try to get to this next week.

timholy commented 11 years ago

@riegaz, @staticfloat this is done now. Sorry it took so darn long.

Here's a demo:

julia> using ImageView

julia> using TestImages

julia> lh = testimage("lighthouse.png")
RGB Image with:
  data: 3x768x512 Uint8 Array
  properties:
    limits: (0x00,0xff)
    colordim: 1
    spatialorder: ["x","y"]
    colorspace: RGB

julia> mand = testimage("mandrill.tiff")
RGB Image with:
  data: 3x512x512 Uint8 Array
  properties:
    limits: (0x00,0xff)
    colordim: 1
    spatialorder: ["x","y"]
    colorspace: RGB

julia> imgc, img2 = display(lh,pixelspacing=[1,1])
(ImageCanvas,ImageSlice2d: zoom = BoundingBox(0.0,768.0,0.0,512.0))

julia> display(imgc, mand)
(ImageCanvas,ImageSlice2d: zoom = BoundingBox(0.0,512.0,0.0,512.0))

Also, running "test/tile.jl" is fun.

staticfloat commented 11 years ago

Awesome, thanks @timholy!

timholy commented 11 years ago

I went back and re-read the issue, and noticed you folks asked a few more questions. So here are some other tidbits:

These features require master; I'll update the sha1 soon, but Ron Rock indicated he may also have some new stuff coming, so I'll wait a bit.

rsrock commented 11 years ago

I'm done now, but see the comment on the latest commit...