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
The optional `pixelspacing` input tells `display` that this image has a fixed aspect ratio, and that this needs to be honored when displaying the image. (Alternatively, you could set `img["pixelspacing"] = [1,1]` and then you wouldn't have to tell this to the `display` function.)
39
39
40
+
**Note:** If you are running Julia from a script file, the julia process will terminate towards the end of the program. This will cause any windows opened with `display()` to terminate (Which is probably not what you intend). Refer to [calling display from a script file](#calling-display-from-a-script-file) section for more information on how to avoid this behavior.
41
+
40
42
You should get a window with your image:
41
43
42
44

@@ -105,6 +107,7 @@ You can change the playback speed by right-clicking in an empty space within the
If you call Julia from a script file, the julia process will terminate towards the end of the program. This will cause any windows opened with `display()` to terminate (Which is probably not what you intend). We want to make it only terminate the process when the image window changes. Bellow is some example code to do this:
177
+
178
+
```
179
+
using Tk
180
+
using Images
181
+
using ImageView
182
+
183
+
img = imread()
184
+
imgc, imgslice = display(img);
185
+
186
+
#If we are not in a REPL
187
+
if (!isinteractive())
188
+
189
+
# Create a condition object
190
+
c = Condition()
191
+
192
+
# Get the main window (A Tk toplevel object)
193
+
win = toplevel(imgc)
194
+
195
+
# Notify the condition object when the window closes
196
+
bind(win, "<Destroy>", e->notify(c))
197
+
198
+
# Wait for the notification before proceeding ...
199
+
wait(c)
200
+
end
201
+
```
202
+
203
+
This will stop the julia process from terminating immediately. Note that if we did not add the `bind` function, the process will keep waiting even after the image window has closed, and you will have to manually close it with `CTRL + C`.
204
+
205
+
If you are opening more than one window you may need to create more than one `Condition` object.
0 commit comments