Package org.imagearchive.lsm.toolbox.info

Examples of org.imagearchive.lsm.toolbox.info.ImageDirectory


    return imp;
  }

  private void showEventList(LsmFileInfo info) {
    ArrayList imDirs = info.imageDirectories;
    ImageDirectory imDir = (ImageDirectory) imDirs.get(0);
    CZ_LSMInfo cz = imDir.TIF_CZ_LSMINFO;
    EventList events = cz.eventList;
    if (events != null) {
      String header = new String(
          "Time (sec) \tEvent Type \tEvent Description");
View Full Code Here


      lsm = new LsmFileInfo(masterModel);
      lsm.fileName = filename;
      lsm.directory = directory;
      if (isLSMfile(stream)) {
        // read first image directory
        ImageDirectory imDir = readImageDirectoy(stream, 8, thumb);
        lsm.imageDirectories.add(imDir);
        while (imDir.OFFSET_NEXT_DIRECTORY != 0) {
          imDir = readImageDirectoy(stream,
              imDir.OFFSET_NEXT_DIRECTORY, thumb);
          lsm.imageDirectories.add(imDir);
View Full Code Here

  private void printImDirData(LsmFileInfo lsmFi) {
    for (int i = 0; i < lsmFi.imageDirectories.size(); i++) {
      System.err.println("Imdir " + i);
      System.err.println("=============\n");
      ImageDirectory imDir = (ImageDirectory) lsmFi.imageDirectories
          .get(i);
      System.err.println("ImDir data:\n" + imDir.toString());
      if (imDir.TIF_CZ_LSMINFO != null)
        System.err.println("CZ-Info data:\n"
            + imDir.TIF_CZ_LSMINFO.toString());
      else
        System.err.println("CZ-Info data is null (not set)");
View Full Code Here

    return tags;
  }

  private ImageDirectory readImageDirectoy(RandomAccessStream stream,
      long startPosition, boolean thumb) {
    ImageDirectory imDir = new ImageDirectory();
    long tags = getTagCount(stream, startPosition);
    byte[] tag;

    int tagtype = 0;
    int MASK = 0x00ff;
View Full Code Here

    return sit;
  }

  public ImagePlus[] open(RandomAccessStream stream, LsmFileInfo lsmFi,
      boolean verbose, boolean thumb) {
    ImageDirectory firstImDir = (ImageDirectory) lsmFi.imageDirectories
        .get(0);
    if (firstImDir == null) {
      if (verbose)
        IJ.error("LSM ImageDir null.");
      return null;
View Full Code Here

    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;
View Full Code Here

      RandomAccessStream stream = new RandomAccessStream(file);
      lsm = new LsmFileInfo();
      lsm.fileName = filename;
      lsm.directory = directory;
      if (isLSMfile(stream)) {
        ImageDirectory imDir = readImageDirectoy(stream, 8, thumb);
        lsm.imageDirectories.add(imDir);
        while (imDir.OFFSET_NEXT_DIRECTORY != 0) {
          imDir = readImageDirectoy(stream,
              imDir.OFFSET_NEXT_DIRECTORY, thumb);
          lsm.imageDirectories.add(imDir);
View Full Code Here

    return tags;
  }

  private ImageDirectory readImageDirectoy(RandomAccessStream stream,
      long startPosition, boolean thumb) {
    ImageDirectory imDir = new ImageDirectory();
    long tags = getTagCount(stream, startPosition);
    byte[] tag;

    int tagtype = 0;
    int MASK = 0x00ff;
View Full Code Here

    }
  }

  public ImagePlus[] open(RandomAccessStream stream, LsmFileInfo lsmFi,
      boolean verbose, boolean thumb) {
    ImageDirectory firstImDir = (ImageDirectory) lsmFi.imageDirectories
        .get(0);
    if (firstImDir == null) {
      if (verbose)
        IJ.error("LSM ImageDir null.");
      return null;
View Full Code Here

    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 = micrometer;
    lsmFi.valueUnit = 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;
View Full Code Here

TOP

Related Classes of org.imagearchive.lsm.toolbox.info.ImageDirectory

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.