Saving Crystal Centering Images and Video
Making still images and videos with the MacCHESS Crystal Centering Interface
David J. Schuller
Updated 2010-01-07
The MacCHESS Crystal Centering Interface can save still images or a video
stream. A menu "Save Photos" appears along the top of the window. This
menu offers three options:
- Single Snap
- This option is for saving one image at the current settings.
- The image should be saved just as you see it, complete with crosshairs and
scale bar, if those are turned on.
- Clicking on the menu option brings up a file chooser. Select the
appropriate directory in which to save your image. The default is specuser's
home directory, so be sure to specify something on the data collection disk
instead (e.g. /A1a, /F1a, /F2a)
- Specify a file name. If you end your filename with a standard file type for
images (e.g. .jpg, .png, .gif), in upper or lower case, that image file type
will be used for your image file. Otherwise, it will be saved in a default
format (PNG or JPEG? I can't remember.) The Linux file command can tell
you the format of an image file.
- Click "Save" and its done. A "Success" dialog box should pop up, and you
can dismiss it. If you get a failure message instead, there is probably a
problem with the choice of directory, or with write privilege to the directory.
Image courtesy of Matt Warkentin of the Thorne lab.
- Multi Snap
- This option is for saving a series of still images of your crystal,
separated by PHI motor rotations.
- The images should be saved just as you see them, complete with crosshairs
and scale bar, if those are turned on.
- A dialog box should appear. Enter the appropriate values for the number of
images, the PHI increment between images, and the PHI starting value.
- Next enter a filename prefix and select a directory in which to save the
images.
- Click "Snap!" and you should see the PHI rotations being carried out,
followed by a "success" dialog box. Your image files will be saved with names
prefix###.jpg, where ### indicates the PHI rotation value for each image.
- A failure could be due to a problem moving the PHI motor, but is more
likely to be a problem in choice of the directory, or in write privilege to that
directory.
- The images are saved in full 1024x768 resolution.
This array of images was
scaled down and combined for convenience. Images courtesy of Matt Warkentin of
the Thorne lab.
- Video
- The video option is for saving a video stream. In order to keep up with the
frame rate , video is saved in a raw format which needs processing afterwards.
- The default frame rate at MacCHESS is set for 7.5 frames per second (fps).
The hardware limit of the cameras is 15 fps. (See me if you need this.) The
frame rate may be slowed down by fiddling with the camera settings in the "Cam"
panel at the lower right corner of the crystal centering interface, so if timing
is important, be sure to check the actual frame rate on the "FPS" panel before
recording your video.
-
- The images should be saved just as you see them, complete with crosshairs
and scale bar, if those are turned on; except that a time stamp is added
to the lower left corner. (Technical note: Not really. In order to keep up the frame
rate, the raw video stream is actually saved without the crosshairs, scale bar
and time stamp, but sufficient data is saved to the file to recreate these
during unpacking.)
- When you select the "Video" option a dialog box will appear. You should
select the number of frames of video to save and the frame interval. E.g. you
could save one frame of every 100 if you want a time lapse of a slow process.
- Select the file prefix and the directory in which you want the file saved.
The file will be saved as prefix.uyvy.
- Click "Snap!" and it will start working. The success dialog box will only
appear after all the frames of video have been saved.
After the raw video file is saved, additional steps are required to end up with
a useful video:
- Run my java application to unpack the individual images from the raw video
file with script uyvydecode.csh. (This may not be installed on every
MacCHESS computer. It requires Sun Java, which also may not be installed on
every MacCHESS computer.) A dialog box should appear. Click on the "Open
UYVY Video File" button and select the raw video file with the FileChooser.
Click "Open" and it should go to work. It should write a line to the text window
for each image file decoded, then write an ERROR message indicating that there
are no more files to decode. The individual images will be saved as JPEG files.
Once you verify that the JPEG files are OK, you should delete the original .uyvy
file. It takes up about 20 times more space than all of the JPEG files put
together.
- Once you have the individual images, you can manipulate them with any image
handling software, such as ImageMagick, theGimp or PhotoShop. For example, you
might want to select which images to include in a video, or scale the images to
a different size, or change background color, or crop a portion of the image. In
the file listings below is a sample script for shrinking a set of images using
ImageMagick.
- Assemble the frames into a video using any relevant software you prefer. On
Linux this can be done with mencoder. A couple example scripts are linked
below.
Crystal of cytochrome bc1 courtesy of Ed Berry.
Source code and scripts
Files for compiling and running the Java application which unpacks individual
images from the raw video file
uyvydecode.csh - the script which you
would execute to perform the unpacking.
UYVYDecode.java - the main Java source
file
CrossHairPluginFeatures.java -
Java source file
SnapshotPluginFeatures.java -
Java source file
VideoDialog.java -
Java source file
VideoFilter.java -
Java source file
ZoomPluginFeatures.java -
Java source file
Scripts for image manipulation and video creation
shrink.csh - script for scaling a set of
images with ImageMagick
mencoder_gif.csh - script for creating an
animated GIF file using mencoder
mencoder_mpeg4.csh - script for
creating an MPEG4 video using mencoder (Conveniently, MPEG4 will support a frame
rate of 7.5 fps)
Back to Schuller staff
page
MacCHESS home page