/**
  * Returns an ImageProcessor for the specified slice, were 1<=n<=nslices. Returns null if the
  * stack is empty.
  */
 public ImageProcessor getProcessor(int n) {
   ImageProcessor ip;
   if (n < 1 || n > nSlices) throw new IllegalArgumentException(outOfRange + n);
   if (nSlices == 0) return null;
   if (stack[0] == null) throw new IllegalArgumentException("Pixel array is null");
   if (stack[0] instanceof byte[]) ip = new ByteProcessor(width, height, null, cm);
   else if (stack[0] instanceof short[]) ip = new ShortProcessor(width, height, null, cm);
   else if (stack[0] instanceof int[]) ip = new ColorProcessor(width, height, null);
   else if (stack[0] instanceof float[]) ip = new FloatProcessor(width, height, null, cm);
   else throw new IllegalArgumentException("Unknown stack type");
   ip.setPixels(stack[n - 1]);
   if (min != Double.MAX_VALUE && ip != null && !(ip instanceof ColorProcessor))
     ip.setMinAndMax(min, max);
   if (cTable != null) ip.setCalibrationTable(cTable);
   return ip;
 }