ArrayList imps = new ArrayList();
IJ.showProgress(1.0);
for (int stackCount = 0; stackCount < (int) stacks.length; stackCount++) {
if (stacks[stackCount].getSize() > 0) {
ImagePlus imp = new ImagePlus(lsmFi.fileName,
stacks[stackCount]);
imp.setFileInfo(lsmFi);
Calibration cal = new Calibration();
cal.setUnit(lsmFi.unit);
cal.pixelDepth = lsmFi.pixelDepth;
cal.pixelHeight = lsmFi.pixelHeight;
cal.pixelWidth = lsmFi.pixelWidth;
imp.setCalibration(cal);
imp.setTitle(lsmFi.fileName + " Channel : "
+ cz.channelNamesAndColors.ChannelNames[stackCount]);
Color[] color = new Color[2];
color[0] = new Color(0, 0, 0);
int r = (int) (cz.channelNamesAndColors.Colors[stackCount] & 255);
int g = (int) ((cz.channelNamesAndColors.Colors[stackCount] >> 8) & 255);
int b = (int) ((cz.channelNamesAndColors.Colors[stackCount] >> 16) & 255);
color[1] = new Color(r, g, b);
if (r == 0 && g == 0 && b == 0)
color[1] = Color.white;
ReaderToolkit.apply_colors(imp, color, 2);
if (imp.getOriginalFileInfo().fileType == FileInfo.GRAY16_UNSIGNED) {
double min = imp.getProcessor().getMin();
double max = imp.getProcessor().getMax();
imp.getProcessor().setMinAndMax(min, max);
}
imps.add(imp);
}
}