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));
    }
  }
  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));
    }
  }