This documents the steps taken to process, inspect, and visualize the initial confocal data that Jeong-Soo Lee has given me: As such, this is not so much a normal "Methods" section, but a complete record of the steps taken to generate the images shown, so that the same steps could be applied to other datasets. The commands below can be run in any shell (unix, mac, windows) in which the necessary tools have been compiled. A subdirectory called "web" is assumed as the location in which final images are saved. The important images and usual "Methods" material are at the end.

Getting data into NRRD format

The NRRD format (described at http://www.cs.utah.edu/~gk/teem/nrrd/) is a simple format for raster data of arbitrary type and dimension. A utility called "unu" (http://www.cs.utah.edu/~gk/teem/unrrdu/) is used to perform basic operations on the data in NRRD format, and to save it to another format (VTK) for isosurface visualization. To get the data out of TIF format, I used a utility called "tiffsplit" distributed with an open implementation of a TIFF library (http://www.libtiff.org/tools.html).

mkdir dorDiI; (cd dorDiI; tiffsplit ../picMt1DX40DiI.tif)
mkdir dorDiO; (cd dorDiO; tiffsplit ../picMt1DX40DiO.tif)
mkdir latDiI; (cd latDiI; tiffsplit ../picMt1LX40DiI.tif)
mkdir latDiO; (cd latDiO; tiffsplit ../picMt1LX40DiO.tif)
tiffsplit formats the TIF with the image data first (after an 8-byte header), followed by the full "header" meta-information. "unu make" is used to extract the raw data and stitch the images into a 3-D volume.

foreach data ( dorDiI dorDiO latDiI latDiO )
  echo ${data}
  unu make -i ${data}/x??.tif -s 512 512 `echo ${data}/x??.tif | wc -w` \
    -t ushort -e raw -en little -bs 8 \
   | unu save -f nrrd -e gzip -o ${data}.nhdr
  rm -rf ${data}
end
This tells unu that all the images are 512 by 512 pixels, pixels are unsigned short (16-bit) values, and the endianness is little, and we should skip 8 bytes in each image. Each dataset is written as two files: a detached header (".nhdr) which can be read or modified in any text editor, and a gzip-compressed raw data file (".raw.gz"). Gzip is an open-source lossless compression method, which in this case compressed the data by a factor of about 10. Once in NRRD format, the individual constituent TIF slices are erased.

Inspecting by projection

Maximum intensity projections along Z are done for each dataset, and then the DiI and DiO projections are stitched together (with "unu join") to create RGB images. The images here are the exact output of the commands shown.

foreach data ( dorDiI dorDiO latDiI latDiO )
  echo ${data}
  unu project -i ${data}.nhdr -a 2 -m max \
   | unu quantize -b 8 -o ${data}-zmax.png
end
unu 2op x 0 ${data}-zmax.png -o black.png
unu join -i dorDiI-zmax.png dorDiO-zmax.png black.png \
  -a 0 -incr -o web/dor-zmax.png
unu join -i latDiI-zmax.png latDiO-zmax.png black.png \
  -a 0 -incr -o web/lat-zmax.png
rm -rf *.png
dor-zmax.png: dorsal projection lat-zmax.png: lateral projection

Creating VTK volume datasets

Unu can save output in VTK format, but first the sample spacing along each axis needs to be determined: the relationship between within-slice pixel spacing and inter-slice spacing. One way to estimate this is to project the dorsal dataset laterally, and project the lateral dataset dorsally. Having done that, the amount of stretching needed between Z slices was estimated by visual comparison to Z projections of the other dataset. A slice spacing of 10 times ("x10.0") the pixel spacing was used, with a box filter for interpolation. These images below allow for qualitative comparison of what features were best imaged in which view.

unu project -i latDiI.nhdr -a 1 -m max \
  | unu resample -s = x10.0 -k box \
  | unu quantize -b 8 -o latDiI-ymax.png
unu project -i latDiO.nhdr -a 1 -m max \
  | unu resample -s = x10.0 -k box \
  | unu quantize -b 8 -o latDiO-ymax.png
unu 2op x 0 latDiO-ymax.png -o black.png
unu join -i latDiI-ymax.png latDiO-ymax.png black.png -a 0 -incr \
  | unu flip -a 2 -o web/lat-ymax.png
unu project -i dorDiI.nhdr -a 1 -m max \
  | unu resample -s = x10.0 -k box \
  | unu quantize -b 8 -o dorDiI-ymax.png
unu project -i dorDiO.nhdr -a 1 -m max \
  | unu resample -s = x10.0 -k box \
  | unu quantize -b 8 -o dorDiO-ymax.png
unu 2op x 0 dorDiO-ymax.png -o black.png
unu join -i dorDiI-ymax.png dorDiO-ymax.png black.png \
    -a 0 -incr -o web/dor-ymax.png
rm -rf *.png
lat-zmax.png:
Dorsal projection of lateral dataset
dor-ymax.png:
Lateral projection of dorsal dataset
Having determined the Z spacing, the header files (".nhdr") files are edited (by hand) to reflect this, for instance here is dorDiI.nhdr:

NRRD0001
type: unsigned short
dimension: 3
sizes: 512 512 43
spacings: 1 1 10
data file: ./dorDiI.raw.gz
endian: big
encoding: gz
And then the files are saved in VTK format (after converting to signed short, which makes no difference for 12-bit data):

foreach data ( dorDiI dorDiO latDiI latDiO )
  echo ${data}
  unu convert -t short -i ${data}.nhdr \
   | unu save -f vtk -e raw -o ${data}.vtk
end



dor-0.4.tcl dualiso.tcl lat-0.4.tcl dorDiI-0.4.vtk dorDiO-0.4.vtk latDiI-0.4.vtk latDiO-0.4.vtk