return imps;
}
private ImagePlus[] readStack(RandomAccessStream stream, LsmFileInfo lsmFi,
CZ_LSMInfo cz, boolean thumb) {
ImageDirectory firstImDir = (ImageDirectory) lsmFi.imageDirectories
.get(0);
lsmFi.url = "";
lsmFi.fileFormat = FileInfo.TIFF;
lsmFi.pixelDepth = cz.VoxelSizeZ * 1000000;
lsmFi.pixelHeight = cz.VoxelSizeY * 1000000;
lsmFi.pixelWidth = cz.VoxelSizeX * 1000000;
lsmFi.unit = MasterModel.micrometer;
lsmFi.valueUnit = MasterModel.micrometer;
lsmFi.nImages = 1;
lsmFi.intelByteOrder = true;
ImageStack[] stacks = new ImageStack[(int) cz.DimensionChannels];
for (int channelCount = 0; channelCount < (int) (cz.DimensionChannels); channelCount++) {
int datatype = (int) cz.IntensityDataType;
if (datatype == 0)
datatype = cz.OffsetChannelDataTypesValues[channelCount];
switch (datatype) {
case 1:
lsmFi.fileType = FileInfo.GRAY8;
break;
case 2:
lsmFi.fileType = FileInfo.GRAY16_UNSIGNED;
break;
case 5:
lsmFi.fileType = FileInfo.GRAY32_FLOAT;
break;
default:
lsmFi.fileType = FileInfo.GRAY8;
break;
}
ColorModel cm = null;
if (lsmFi.fileType == FileInfo.COLOR8 && lsmFi.lutSize > 0)
cm = new IndexColorModel(8, lsmFi.lutSize, lsmFi.reds,
lsmFi.greens, lsmFi.blues);
else
cm = LookUpTable.createGrayscaleColorModel(lsmFi.whiteIsZero);
if (!thumb)
stacks[channelCount] = new ImageStack(
(int) firstImDir.TIF_IMAGEWIDTH,
(int) firstImDir.TIF_IMAGELENGTH, cm);
else
stacks[channelCount] = new ImageStack((int) cz.ThumbnailX,
(int) cz.ThumbnailY, cm);
}
firstImDir = null;
ImageReader reader = null;
int flength = 0;
lsmFi.stripOffsets = new int[1];
lsmFi.stripLengths = new int[1];
for (int imageCounter = 0; imageCounter < lsmFi.imageDirectories.size(); imageCounter++) {
ImageDirectory imDir = (ImageDirectory) lsmFi.imageDirectories
.get(imageCounter);
for (int i = 0; i < imDir.TIF_STRIPBYTECOUNTS.length; i++)
if (imDir.TIF_COMPRESSION == 5) {
lsmFi.compression = FileInfo.LZW;