private ForDeprecatedConstructors(
        final AbstractSpimData<?> spimData,
        final String windowTitle,
        final ProgressWriter progressWriter) {
      this.windowTitle = windowTitle;
      this.progressWriter = progressWriter;
      this.spimData = spimData;

      windowWidth = 800;
      windowHeight = 600;

      if (WrapBasicImgLoader.wrapImgLoaderIfNecessary(spimData)) {
        System.err.println(
            "WARNING:\nOpening <SpimData> dataset that is not suited for interactive browsing.\nConsider resaving as HDF5 for better performance.");
      }

      converterSetups = new ArrayList<ConverterSetup>();
      sources = new ArrayList<SourceAndConverter<?>>();
      initSetups(spimData, converterSetups, sources);

      final AbstractSequenceDescription<?, ?, ?> seq = spimData.getSequenceDescription();
      numTimepoints = seq.getTimePoints().size();
      cache = ((ViewerImgLoader<?, ?>) seq.getImgLoader()).getCache();

      WrapBasicImgLoader.removeWrapperIfPresent(spimData);
    }
  private static void initSetupsARGBType(
      final AbstractSpimData<?> spimData,
      final ARGBType type,
      final List<ConverterSetup> converterSetups,
      final List<SourceAndConverter<?>> sources) {
    if (spimData.getSequenceDescription().getImgLoader() instanceof WrapBasicImgLoader) {
      initSetupsARGBTypeNonVolatile(spimData, type, converterSetups, sources);
      return;
    }
    final AbstractSequenceDescription<?, ?, ?> seq = spimData.getSequenceDescription();
    for (final BasicViewSetup setup : seq.getViewSetupsOrdered()) {
      final ScaledARGBConverter.VolatileARGB vconverter =
          new ScaledARGBConverter.VolatileARGB(0, 255);
      final ScaledARGBConverter.ARGB converter = new ScaledARGBConverter.ARGB(0, 255);

      final int setupId = setup.getId();
      final String setupName = createSetupName(setup);
      final VolatileSpimSource<ARGBType, VolatileARGBType> vs =
          new VolatileSpimSource<ARGBType, VolatileARGBType>(spimData, setupId, setupName);
      final SpimSource<ARGBType> s = vs.nonVolatile();

      // Decorate each source with an extra transformation, that can be
      // edited manually in this viewer.
      final TransformedSource<VolatileARGBType> tvs = new TransformedSource<VolatileARGBType>(vs);
      final TransformedSource<ARGBType> ts = new TransformedSource<ARGBType>(s, tvs);

      final SourceAndConverter<VolatileARGBType> vsoc =
          new SourceAndConverter<VolatileARGBType>(tvs, vconverter);
      final SourceAndConverter<ARGBType> soc =
          new SourceAndConverter<ARGBType>(ts, converter, vsoc);

      sources.add(soc);
      converterSetups.add(new RealARGBColorConverterSetup(setupId, converter, vconverter));
    }
  }
  private static <T extends RealType<T>> void initSetupsRealTypeNonVolatile(
      final AbstractSpimData<?> spimData,
      final T type,
      final List<ConverterSetup> converterSetups,
      final List<SourceAndConverter<?>> sources) {
    final double typeMin = type.getMinValue();
    final double typeMax = type.getMaxValue();
    final AbstractSequenceDescription<?, ?, ?> seq = spimData.getSequenceDescription();
    for (final BasicViewSetup setup : seq.getViewSetupsOrdered()) {
      final RealARGBColorConverter<T> converter =
          new RealARGBColorConverter.Imp1<T>(typeMin, typeMax);
      converter.setColor(new ARGBType(0xffffffff));

      final int setupId = setup.getId();
      final String setupName = createSetupName(setup);
      final SpimSource<T> s = new SpimSource<T>(spimData, setupId, setupName);

      // Decorate each source with an extra transformation, that can be
      // edited manually in this viewer.
      final TransformedSource<T> ts = new TransformedSource<T>(s);
      final SourceAndConverter<T> soc = new SourceAndConverter<T>(ts, converter);

      sources.add(soc);
      converterSetups.add(new RealARGBColorConverterSetup(setupId, converter));
    }
  }
Esempio n. 4
0
 @SuppressWarnings("unchecked")
 public SpimSource(final AbstractSpimData<?> spimData, final int setup, final String name) {
   super(spimData, setup, name);
   final AbstractSequenceDescription<?, ?, ?> seq = spimData.getSequenceDescription();
   imgLoader = (ViewerImgLoader<T, ?>) seq.getImgLoader();
   loadTimepoint(0);
 }
  private static <T extends RealType<T>, V extends Volatile<T> & RealType<V>>
      void initSetupsRealType(
          final AbstractSpimData<?> spimData,
          final T type,
          final List<ConverterSetup> converterSetups,
          final List<SourceAndConverter<?>> sources) {
    if (spimData.getSequenceDescription().getImgLoader() instanceof WrapBasicImgLoader) {
      initSetupsRealTypeNonVolatile(spimData, type, converterSetups, sources);
      return;
    }
    final double typeMin = Math.max(0, Math.min(type.getMinValue(), 65535));
    final double typeMax = Math.max(0, Math.min(type.getMaxValue(), 65535));
    final AbstractSequenceDescription<?, ?, ?> seq = spimData.getSequenceDescription();
    for (final BasicViewSetup setup : seq.getViewSetupsOrdered()) {
      final RealARGBColorConverter<V> vconverter =
          new RealARGBColorConverter.Imp0<V>(typeMin, typeMax);
      vconverter.setColor(new ARGBType(0xffffffff));
      final RealARGBColorConverter<T> converter =
          new RealARGBColorConverter.Imp1<T>(typeMin, typeMax);
      converter.setColor(new ARGBType(0xffffffff));

      final int setupId = setup.getId();
      final String setupName = createSetupName(setup);
      final VolatileSpimSource<T, V> vs =
          new VolatileSpimSource<T, V>(spimData, setupId, setupName);
      final SpimSource<T> s = vs.nonVolatile();

      // Decorate each source with an extra transformation, that can be
      // edited manually in this viewer.
      final TransformedSource<V> tvs = new TransformedSource<V>(vs);
      final TransformedSource<T> ts = new TransformedSource<T>(s, tvs);

      final SourceAndConverter<V> vsoc = new SourceAndConverter<V>(tvs, vconverter);
      final SourceAndConverter<T> soc = new SourceAndConverter<T>(ts, converter, vsoc);

      sources.add(soc);
      converterSetups.add(new RealARGBColorConverterSetup(setupId, converter, vconverter));
    }
  }
  public static BigDataViewer open(
      final AbstractSpimData<?> spimData,
      final String windowTitle,
      final ProgressWriter progressWriter) {
    final int width = 800;
    final int height = 600;

    if (WrapBasicImgLoader.wrapImgLoaderIfNecessary(spimData)) {
      System.err.println(
          "WARNING:\nOpening <SpimData> dataset that is not suited for interactive browsing.\nConsider resaving as HDF5 for better performance.");
    }

    final ArrayList<ConverterSetup> converterSetups = new ArrayList<ConverterSetup>();
    final ArrayList<SourceAndConverter<?>> sources = new ArrayList<SourceAndConverter<?>>();
    initSetups(spimData, converterSetups, sources);

    final AbstractSequenceDescription<?, ?, ?> seq = spimData.getSequenceDescription();
    final int numTimepoints = seq.getTimePoints().size();
    final Cache cache = ((ViewerImgLoader<?, ?>) seq.getImgLoader()).getCache();

    final BigDataViewer bdv =
        new BigDataViewer(
            converterSetups,
            sources,
            spimData,
            numTimepoints,
            cache,
            windowTitle,
            width,
            height,
            progressWriter);

    WrapBasicImgLoader.removeWrapperIfPresent(spimData);

    bdv.viewerFrame.setVisible(true);
    InitializeViewerState.initTransform(bdv.viewer);
    return bdv;
  }