There are currently several codes to generate dendrograms – we are working on unifying these packages. For now, we will look at the original IDL code written by Erik Rosolowsky, available here
Make sure this is in your IDL path
Also download this file, which is used in this tutorial.
First, read in the image:
im = mrdfits('demo.fits')
The code expects a binary mask – an array that has the same shape as the image, where each entry is 1 if that pixel is to be included in the output, and 0 otherwise. For now, lets just use the entire image, and create a mask of all 1s:
mask = byte(im * 0) + 1B
There are a few other important parameters:
We will use these values for now:
friends = 3
delta = 1.0
minpix = 10
minpeak = 5.0
We create the dendrogram with the Topologize procedure:
topologize, im, mask, friends = friends, delta = delta, minpix = minpix, minpeak = minpeak, /fast, pointer = ptr
This puts the output of the into a pointer variable ptr. For convenience, lets dereference that and store in a normal variable:
dendro = *ptr
The cloud-viz package provides some ability to view dendrograms. Simply invoke with:
dendroviz, ptr
to play around. More coming soon.
Lets examine the contents of the pointer output from topologize. The original code represents the dendrogram in a slightly cumbersome way, but there are at least several programs which save you from having to understand too much of what’s going on here:
IDL> help, *ptr, /struct
** Structure <192e208>, 21 tags, length=3610048, data length=3610041, refs=1:
MERGER DOUBLE Array[49, 49]
CLUSTER_LABEL INT Array[150801]
CLUSTER_LABEL_H LONG Array[98]
CLUSTER_LABEL_RI
LONG Array[60217]
LEVELS DOUBLE Array[96]
CLUSTERS LONG Array[2, 48]
HEIGHT DOUBLE Array[97]
KERNELS LONG Array[49]
ORDER LONG Array[49]
NEWMERGER DOUBLE Array[49, 49]
X LONG Array[150801]
Y LONG Array[150801]
V LONG Array[150801]
T FLOAT Array[150801]
SZ LONG Array[5]
CUBEINDEX LONG Array[150801]
SZDATA LONG Array[5]
ALL_NEIGHBORS BYTE 0
XLOCATION DOUBLE Array[97]
NPIX LONG Array[49, 49]
FAST INT 1
Here’s what some of these fields describe: