// Blanket Transform
// Implements K. Rodenacker's blanquet tranform
// where each pixel in the result represents the
// maximum slice number in which the pixel is set.
// Assumes a binary stack where image=255 and 
// the background is 0.
// G. Landini 17/1/2007

  run("Divide...", "stack value=255");
  n = nSlices;
  if (n>255)
     run("32-bit");
  for (i=2; i<=nSlices; i++) {
     setSlice(i);
     run("Multiply...", "slice value="+i);
  }
  run("Z Project...", "projection=[Max Intensity]");
  rename("blanket");
 setMinAndMax(0, n);
  run("Fire");
  run("Enhance Contrast", "saturated=0");
