Compress files using SmallTime

From Center for Cognitive Neuroscience
Jump to navigation Jump to search

Compress Files using SmallTime

This utility cuts the file sizes of time seires files down by a factor of approximately two and operates extremely fast. The theory can be found at www.brainmapping.org/SmallTime and is in press in Human Brain Mapping. This "HowTo" note explains its use.

SmallTime exists in two forms: as a command line tool under unix and as a standalone Macintosh program. The files they create are mutually compatible.

SmallTime is available as both source and executable at the Small Time web site.

unix

compressing files

To compress a file called, e.g., filename, type:

SmallTime -c filename The file can be any of the standard types recognized at UCLA, but compression will only occur for a file having multiple time points, such as a bshort, bfloat, buchar, APD or Analyze4D file. For more on file types, see the File Format HowTo.

The compressed file will be named as the input, followed by '.ST'. In the above example, the output file would be filename.ST. SmallTime will append the header to the compressed file, so this does not have to be saved separately.

uncompressing files

To ucompress a file called, e.g., filename.ST, type:

SmallTime -u filename.ST The resulting output will be the same as the original compressed file and will include a corresponding header, if appropriate.

options:

Option

Meaning

-z Base compression on changes from the first image in the time series. By default, compression is basedon sequential changes in the images.
-f

Do not compress names of APD images (otherwise, the long APD names will be shortened, according to the same rules as "FixAPDName")

-p Preserve the file path with the file name. When files are uncompressed, they will be returned to their origiunal directories. Dangerous and not recommended.
-d Delete the original file after compression.
-P Create a processing record file with a name of the form "filename.SmallTime.proc"
-v Print somewhat tedious statistics concerning file compressions efficiency
-o followed by the selected name for the output file. Over-ride SmallTime's naming convention and choose a name for the output file. Since SmallTime does not look at the name of the file for decompression, this can be any name you like. Files ending in '.ST' are only a convenience.

Macintosh

The Macintosh version of SmallTime can be found at this link: File:SmallTimeLogo.gif [http://www.brainmapping.org/SmallTime/]

You may compress and decompress files by 'dragging and dropping' them onto the program icon (if they are of recognized formats) or you may start SmallTime by double-clicking it and using the menus.

After opening SmallTime, you must press return or enter to dismiss the startup screen.

compression

To compress a file, go to the File menu and select, "Compress..."

File:SmallTimeFileMenu.gif

You will be presented with a standard Macintosh file selection dialog. Find the file you wish to compress and select "Open". SmallTime will then ask you to confirm that you wish to save the file to its default name and location. Change these as you wish.

uncompression

From the File menu, select "Expand..." You will be presented with a standard Macintosh file selection dialog. Find the file you wish to uncompress and select "Open". SmallTime will then ask you to confirm that you wish to save the file (and its header) to its default name and location. Change these as you wish.

options

Options in the Macintosh version are accessed through the Preferences... option in the File menu, which opens a dialog box as shown below:

File:SmallTimePrefs.gif

The options are as described above for the unix version. Sequential vs. Based on First Image refers to which image in the time series is used as a reference for the compression process. Checking Delete original after compression forces SmallTime to automatically delete the original file when compression is completed. Delete compressed file after expansion will cause SmallTime to remoce the compressed file after the expansion is completed. The grayed out menu will someday allow you to use SmallTime for data format conversion as well. Stay tuned. The Batch Options control what SmallTime does when multiple files are dropped onto the program icon. If Automatically name (with *.ST) is selected, the compression process will proceed through all files without stopping. Otherwise, you will be asked to confirm the name for each file before it is saved. The preferences are not stored across SmallTime sessions (they return to the defaults shown when you restart the program.

verifying

The Macintosh version of SmallTime allows you to compare two files. This may be useful if your suddenly fantasize that SmallTime has damaged your original file (it hasn't happened yet...). To compare two files, select "Compare..." from the File menu.