This directory contains the source for the program mergescan, written April 2011 on Expedition 335 to merge 4 outer-core tiff images from the SHIL to a single simulated unrolled 360-degree image. This was developed and tested on a MacBook Pro (OS 10.6.7; gcc version 4.2.1), but should work on any unix or unix-like system that can support tifflib. Compilation: If gcc, zlib, and tifflib are all installed, compilation should be a simple matter of typing 'make mergescan' in this directory. I found tifflib (v3.9.5) installation to be straightforward once I realized zlib was already installed. Usage: For the sake of easy development, the program only runs in command-line mode, for example in the Mac Terminal utility. The basic usage is mergescan file1.tif file2.tif file3.tif file4.tif where file*.tif are SHIL files of the same core listed in clockwise-downcore order. Output is by default written to the file mergeout.tif in the working directory, which if successful will need to be renamed to something meaningful that won't be overwritten by the next run of the program. Options: There are three options so far, one for the core diameter, one for the decimation factor for file size reduction, and one for the output filename. The core diameter defaults to 58.0 mm and the decimation factor defaults to 4 (reducing 20 pixels per mm to 5 per mm). Option syntax is mergescan f1.tif f2.tif f3.tif f4.tif diameter=55.5 decimate=2 out=myfile.tif with option(s) coming after filenames and no spaces around the equal sign. The program has no trouble writing at decimate=1, but having another application read the file can be a problem. Details: The program assumes cores are perfect cylinders and fills the unrolled image one scan line at a time by stepping uniformly through destination pixels on the circumference, using simple trigonometry to find the appropriate source pixel in the images. If not decimated, some source pixels will be duplicated away from each source image center to achieve the appropriate stretching. Several properties of the source images, such as resolution, image width, and header length, are compiled into the program. There's no reason the program can't be modified to read jpegs instead of tiffs, but I find tifflib much better documented than any jpeg library I've looked at. Due to very poor recovery on Exp 335, the program has only been applied to two real cores. ------- Doug Wilson, May 2011