Package org.imagearchive.lsm.toolbox.info

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


  public ImagePlus[] open(String directory, String filename,
      boolean showInfoFrames, boolean verbose, boolean thumb) {
    ImagePlus[] imp = null;
    RandomAccessFile file;
    LsmFileInfo lsm;
    try {
      file = new RandomAccessFile(new File(directory, filename), "r");
      RandomAccessStream stream = new RandomAccessStream(file);
      lsm = new LsmFileInfo(masterModel);
      lsm.fileName = filename;
      lsm.directory = directory;
      if (isLSMfile(stream)) {
        // read first image directory
        ImageDirectory imDir = readImageDirectoy(stream, 8, thumb);
View Full Code Here


    this.serviceMediator = serviceMediator;
  }

  public void initializeModel() {
    serviceMediator = new ServiceMediator();
    lsm = new LsmFileInfo(this);
  }
View Full Code Here

    ImagePlus[] impTab = new Reader(masterModel).open(f.getParent(), f
        .getName(), false, verbose, false);

    if (impTab != null && impTab.length > 0) {
      LsmFileInfo lsm = (LsmFileInfo) impTab[0].getOriginalFileInfo();
      CZ_LSMInfo cz = ((ImageDirectory) lsm.imageDirectories.get(0)).TIF_CZ_LSMINFO;

      for (int i = 0; i < impTab.length; i++) {
        if (sepDir) {
          finalDir = outputDir + System.getProperty("file.separator")
View Full Code Here

              if (imp == null)
                return;
              for (int i = 0; i < imp.length; i++) {
                imp[i].show();
                iwc = imp[i].getWindow();
                final LsmFileInfo lsm = (LsmFileInfo) iwc
                    .getImagePlus().getOriginalFileInfo();
                iwc.addFocusListener(new FocusListener() {
                  final LsmFileInfo lsmfi = lsm;

                  public void focusGained(FocusEvent e) {
View Full Code Here

            for (int j = 0; j < v.size(); j++) {

              ImagePlus imp = WindowManager.getImage(((Integer) v
                  .get(j)).intValue());
              LsmFileInfo openLSM = (LsmFileInfo) imp
                  .getOriginalFileInfo();
              CZ_LSMInfo cz = (CZ_LSMInfo) ((ImageDirectory) openLSM.imageDirectories
                  .get(0)).TIF_CZ_LSMINFO;
              Recording r = (Recording) cz.scanInfo.recordings.get(0);
              double planeSpacing = ((Double) r.records.get("PLANE SPACING")).doubleValue();
View Full Code Here

            for (int j = 0; j < v.size(); j++) {

              ImagePlus imp = WindowManager.getImage(((Integer) v
                  .get(j)).intValue());
              LsmFileInfo openLSM = (LsmFileInfo) imp
                  .getOriginalFileInfo();
              CZ_LSMInfo cz = (CZ_LSMInfo) ((ImageDirectory) openLSM.imageDirectories
                  .get(0)).TIF_CZ_LSMINFO;
              if (choice.equals("Dump to textfile")) {
                String twstr = new String("");
View Full Code Here

            for (int j = 0; j < v.size(); j++) {

              ImagePlus imp = WindowManager.getImage(((Integer) v
                  .get(j)).intValue());
              LsmFileInfo openLSM = (LsmFileInfo) imp
                  .getOriginalFileInfo();
              CZ_LSMInfo cz = (CZ_LSMInfo) ((ImageDirectory) openLSM.imageDirectories
                  .get(0)).TIF_CZ_LSMINFO;

              if (cz.SpectralScan != 1) {
View Full Code Here

          SwingUtilities.invokeLater(new Runnable() {
            public void run() {
              try {
                for (int i = 0; i < imageVals.length; i++) {
                  LsmFileInfo openLSM = (LsmFileInfo) ((ImagePlus) WindowManager
                      .getImage(imageVals[i]))
                      .getOriginalFileInfo();
                  CZ_LSMInfo cz = (CZ_LSMInfo) ((ImageDirectory) openLSM.imageDirectories
                      .get(0)).TIF_CZ_LSMINFO;
                  Reader reader = new Reader(masterModel);
                  ImagePlus[] imp = reader
                      .open(openLSM.directory,
                          openLSM.fileName, true,
                          true, false);
                  Class i5Dc = null;
                  if (imp == null || imp.length == 0) {
                    IJ.error("Could not open file.");
                    return;
                  }
                  try {
                    i5Dc = Class.forName("i5d.Image5D");
                  } catch (ClassNotFoundException e1) {
                    try {
                      i5Dc = Class.forName("Image5D");
                    } catch (ClassNotFoundException e2) {
                      e2.printStackTrace();
                    }
                  }
                  Constructor i5Dcon = null;

                  Object o = null;
                  try {
                    i5Dcon = i5Dc
                        .getConstructor(new Class[] {
                            String.class,
                            int.class, int.class,
                            int.class, int.class,
                            int.class, int.class,
                            boolean.class });
                    o = i5Dcon
                        .newInstance(new Object[] {
                            openLSM.fileName,
                            new Integer(imp[0]
                                .getType()),
                            new Integer(imp[0]
                                .getWidth()),
                            new Integer(imp[0]
                                .getHeight()),
                            new Integer(imp.length),
                            new Integer(
                                (int) cz.DimensionZ),
                            new Integer(
                                (int) cz.DimensionTime),
                            new Boolean(false) });

                    Method i5DsetCurrentPosition = o
                        .getClass().getMethod(
                            "setCurrentPosition",
                            new Class[] {
                                int.class,
                                int.class,
                                int.class,
                                int.class,
                                int.class });
                    Method i5DsetPixels = o
                        .getClass()
                        .getMethod(
                            "setPixels",
                            new Class[] { Object.class });
                    Method i5DsetCalibration = o
                        .getClass()
                        .getMethod(
                            "setCalibration",
                            new Class[] { Calibration.class });
                    Method i5Dshow = o.getClass()
                        .getMethod("show",
                            new Class[] {});
                    Method i5DgetWindow = o.getClass()
                        .getMethod("getWindow",
                            new Class[] {});
                    Method i5DsetChannelColorModel = o
                        .getClass()
                        .getMethod(
                            "setChannelColorModel",
                            new Class[] {
                                int.class,
                                ColorModel.class });
                    for (int c = 0; c < imp.length; c++) {
                      for (int z = 0; z < cz.DimensionZ; z++) {
                        for (int t = 0; t < cz.DimensionTime; t++) {
                          i5DsetCurrentPosition
                              .invoke(
                                  o,
                                  new Object[] {
                                      new Integer(
                                          0),
                                      new Integer(
                                          0),
                                      new Integer(
                                          c),
                                      new Integer(
                                          z),
                                      new Integer(
                                          t) });
                          imp[c]
                              .setSlice(t
                                  * ((int) cz.DimensionZ * 1)
                                  + z * 1 + 1);
                          i5DsetPixels
                              .invoke(
                                  o,
                                  new Object[] { imp[c]
                                      .getProcessor()
                                      .getPixels() });

                        }
                      }
                      i5DsetChannelColorModel
                          .invoke(
                              o,
                              new Object[] {
                                  new Integer(
                                      c + 1),
                                  imp[c]
                                      .getProcessor()
                                      .getColorModel() });
                    }
                    i5DsetCalibration.invoke(o,
                        new Object[] { imp[0]
                            .getCalibration()
                            .copy() });
                    final LsmFileInfo lsm = openLSM;
                    i5Dshow.invoke(o, new Object[] {});
                    ((ImageWindow) i5DgetWindow.invoke(o,
                        new Object[] {}))
                        .addFocusListener(new FocusListener() {
                          final LsmFileInfo lsmfi = lsm;
View Full Code Here

      if (WindowManager.getImage(imagesIDs[i]) != null){
        FileInfo fi = WindowManager.getImage(imagesIDs[i]).getOriginalFileInfo();
        boolean add = false;
        if (fi != null
            && fi instanceof LsmFileInfo) {
          LsmFileInfo lsm = (LsmFileInfo)fi;
          CZ_LSMInfo cz = (CZ_LSMInfo) ((ImageDirectory) lsm.imageDirectories.get(0)).TIF_CZ_LSMINFO;
          if (filter.equals("time")) if (cz.DimensionTime>1) add = true;
          if (filter.equals("z")) if (cz.DimensionZ>1) add = true;
          if (filter.equals("lambda"))
              if ((cz.SpectralScan==1 && cz.channelWavelength != null) && cz.channelWavelength.Channels >= 1) add = true;
View Full Code Here

  }

  public Vector getImageGroupIDs(int idBelongingtoGroup) {
    ImagePlus imp = WindowManager.getImage(idBelongingtoGroup);
    int[] ids = WindowManager.getIDList();
    LsmFileInfo fi = (LsmFileInfo) imp.getOriginalFileInfo();
    Vector v = new Vector();
    for (int i = 0; i < ids.length; i++) {
      if (imp.getOriginalFileInfo() instanceof LsmFileInfo) {
        LsmFileInfo lsmFI = (LsmFileInfo) (WindowManager
            .getImage(ids[i]).getOriginalFileInfo());
        if (fi.equals(lsmFI))
          v.add(new Integer(ids[i]));
      }
    }
View Full Code Here

TOP

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

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.