For these types of image sequences, there's a need to be able to very easily animate ranges within the sequence, going forward or back, looping (skip back to start) or 'ping-pong' shuttling back and forth in the selected range. In the minimal case of two images, it's called blink comparison.
This Gallery Player is intended for use where all the image files exist in local storage. It does no prefetching of images. For one thing, because often in medical image stacks there are hundreds of fairly large images, and prefetching just isn't going to help. This utility absolutely will not work over an Internet connection. It also is unlikely to work acceptably with images stored on a CD/DVD disk.
PONG/LOOP This sets the repeat mode. In LOOP the display jumps back to the other end of the series when it reaches either end. In PONG it shuttles back and forth between the selected end points.
REVR is 'Reverse direction'. This only makes sense in LOOP mode, so it's grayed out in PONG mode. It allows the image stack to be displayed in forward or reverse order.
STEP allows manual incrementing of the image number when stopped. It works in PONG and LOOP, and goes in the direction set via REVR. Note that RUN-PONG mode has its own direction flag, and doesn't alter the 'manual' one. STEP doesn't make sense in RUN mode, so it's grayed out.
FIRST and LAST are available while in STOP, allow resetting of the selection endpoints to the lower and upper bounds of the image set, as displayed in the left and right numeric fields. They also set the current image index to the low or high bound, and the scan direction away from the set end.
SLOW and FAST are present during RUN mode. Mouse clicks on these alter the rate of image incrementing, by about 20% with each click. There's no precise speed control, you just click them enough to get about the speed you want. The speed setting is retained during STOP.
1 | 23 | 50 |
If you make the endoints equal, obviously there's nothing to animate, and RUN will drop back to STOP.
If there are only two images selected, it serves as a blink comparator. The rate is variable too.
The code sets hard limits on the image shuffling rate of 10 mSec to 1 Sec between image changes. If you set the rate faster than your PC can redraw large images, you'll see stuttering. Slow down the refresh rate to avoid this.
Yes, I know the Javascript coding style is primitive, no need to tell me this. It's been a long, long time since I wrote any code.
The files PongGal reads must all be in one folder, and have names containing a sequential numeric field. Like "file024.png" for instance. The numbers can have leading zeros with a fixed number of digits, or be normal (no leading zeros.) I always number such files with a fixed number of digits and leading zeros, so they sort sensibly in directory listings.
All config values are in the Javascript constants code section.
The name comes from the early computer game Pong (an abbreviation of Ping Pong.) I needed a four letter word that conveyed the 'shuttle' back and forth action. Ping Pong Gallery. Hence PongGal. Perhaps I'll think of a less stinky name later. 'Pongle' is completely out. Google it.