You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: README.md
+60-5
Original file line number
Diff line number
Diff line change
@@ -10,16 +10,27 @@ You'll need the `ImageView` package:
10
10
Pkg.add("ImageView")
11
11
```
12
12
13
-
## Demonstration
13
+
## Preparation
14
14
15
15
First let's try it with a photograph. Load one this way:
16
16
```
17
-
using Images
18
-
using ImageView
17
+
using ImageView, Images
19
18
img = imread("my_photo.jpg")
20
19
```
21
-
Any typical image format should be fine, it doesn't have to be a jpg.
22
-
Now display the image this way:
20
+
Any typical image format should be fine, it doesn't have to be a jpg. You can also use a GUI file-picker if you omit the filename:
21
+
```
22
+
img = imread()
23
+
```
24
+
Finally, ImageView comes with the ability to retrieve some standard test images:
25
+
```
26
+
using TestImages
27
+
img = testimage("mandrill")
28
+
```
29
+
Currently, `mandrill`, `lighthouse`, `moonsurface`, and `mountainstream` are defined. It's easy to add more.
30
+
31
+
## Demonstration of the GUI
32
+
33
+
Now display the image:
23
34
```
24
35
display(img, pixelspacing = [1,1])
25
36
```
@@ -109,3 +120,47 @@ Type 151 into the `y:` entry box (note its name has changed) and hit enter, or m
109
120
110
121
This GUI is also useful for "plain movies" (2d images with time), in which case the `z` controls will be omitted and it will behave largely as a typical movie-player.
111
122
Likewise, the `t` controls will be omitted for 3d images lacking a temporal component, making this a nice viewer for MRI scans.
123
+
124
+
125
+
Finally, for grayscale images, right-clicking on the image yields a brightness/contrast GUI:
`imgc` is an `ImageCanvas`, and holds information and settings about the display. `imgslice` is useful if you're supplying multidimensional images; from it, you can infer the currently-selected frame in the GUI.
137
+
138
+
Using these outputs, you can display a new image in place of the old one:
139
+
```
140
+
display(imgc, newimg)
141
+
```
142
+
This preserves settings (like `pixelspacing`); should you want to forget everything and start fresh, do it this way:
143
+
```
144
+
display(canvas(imgc), newimg)
145
+
```
146
+
`canvas(imgc)` just returns a [Tk Canvas](https://github.com/JuliaLang/Tk.jl/tree/master/examples), so this shows you can view images inside any pre-defined `Canvas`.
0 commit comments