use of net.imglib2.util.Pair in project Shuttle by timusus.
the class LibraryController method pushDetailFragment.
void pushDetailFragment(BaseDetailFragment detailFragment, @Nullable View transitionView) {
List<Pair<View, String>> transitions = new ArrayList<>();
if (transitionView != null) {
String transitionName = ViewCompat.getTransitionName(transitionView);
transitions.add(new Pair<>(transitionView, transitionName));
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.LOLLIPOP) {
Transition moveTransition = TransitionInflater.from(getContext()).inflateTransition(R.transition.image_transition);
detailFragment.setSharedElementEnterTransition(moveTransition);
detailFragment.setSharedElementReturnTransition(moveTransition);
}
}
getNavigationController().pushViewController(detailFragment, "DetailFragment", transitions);
}
use of net.imglib2.util.Pair in project Shuttle by timusus.
the class SearchFragment method pushDetailFragment.
void pushDetailFragment(BaseDetailFragment detailFragment, @Nullable View transitionView) {
List<Pair<View, String>> transitions = new ArrayList<>();
if (transitionView != null) {
String transitionName = ViewCompat.getTransitionName(transitionView);
transitions.add(new Pair<>(transitionView, transitionName));
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.LOLLIPOP) {
Transition moveTransition = TransitionInflater.from(getContext()).inflateTransition(R.transition.image_transition);
detailFragment.setSharedElementEnterTransition(moveTransition);
detailFragment.setSharedElementReturnTransition(moveTransition);
}
}
getNavigationController().pushViewController(detailFragment, "DetailFragment", transitions);
}
use of net.imglib2.util.Pair in project Shuttle by timusus.
the class Aesthetic method resume.
/**
* Should be called in onResume() of each Activity.
*/
public void resume(@NonNull final AppCompatActivity activity) {
if (instance == null) {
return;
}
instance.context = activity;
if (instance.subs != null) {
instance.subs.clear();
}
instance.subs = new CompositeDisposable();
instance.subs.add(instance.colorPrimary().compose(Rx.<Integer>distinctToMainThread()).subscribe(new Consumer<Integer>() {
@Override
public void accept(@io.reactivex.annotations.NonNull Integer color) {
Util.setTaskDescriptionColor(activity, color);
}
}, onErrorLogAndRethrow()));
instance.subs.add(instance.activityTheme().compose(Rx.<Integer>distinctToMainThread()).subscribe(new Consumer<Integer>() {
@Override
public void accept(@io.reactivex.annotations.NonNull Integer themeId) {
if (getLastActivityTheme(activity) == themeId) {
return;
}
instance.lastActivityThemes.put(activity.getClass().getName(), themeId);
activity.recreate();
}
}, onErrorLogAndRethrow()));
instance.subs.add(Observable.combineLatest(instance.colorStatusBar(), instance.lightStatusBarMode(), new BiFunction<Integer, Integer, Pair<Integer, Integer>>() {
@Override
public Pair<Integer, Integer> apply(Integer integer, Integer integer2) {
return Pair.create(integer, integer2);
}
}).compose(Rx.<Pair<Integer, Integer>>distinctToMainThread()).subscribe(new Consumer<Pair<Integer, Integer>>() {
@Override
public void accept(@io.reactivex.annotations.NonNull Pair<Integer, Integer> result) {
instance.invalidateStatusBar(activity);
}
}, onErrorLogAndRethrow()));
instance.subs.add(instance.colorNavigationBar().compose(Rx.<Integer>distinctToMainThread()).subscribe(new Consumer<Integer>() {
@Override
public void accept(@io.reactivex.annotations.NonNull Integer color) {
setNavBarColorCompat(activity, color);
}
}, onErrorLogAndRethrow()));
instance.subs.add(instance.colorWindowBackground().compose(Rx.<Integer>distinctToMainThread()).subscribe(new Consumer<Integer>() {
@Override
public void accept(@io.reactivex.annotations.NonNull Integer color) {
activity.getWindow().setBackgroundDrawable(new ColorDrawable(color));
}
}, onErrorLogAndRethrow()));
if (MaterialDialogsUtil.shouldSupport()) {
instance.subs.add(MaterialDialogsUtil.observe(instance));
}
}
use of net.imglib2.util.Pair in project vcell by virtualcell.
the class PlotROIStats method run.
@Override
public void run() {
Plot plot = new ColorPlot("ROI Mean Intensity", "Time", "Mean Intensity");
StringBuilder legendLabels = new StringBuilder();
for (RandomAccessibleInterval<T> data : datasetROIsMap.keySet()) {
if (data instanceof Dataset) {
legendLabels.append(((Dataset) data).getName());
legendLabels.append(": ");
}
List<Overlay> overlays = datasetROIsMap.get(data);
for (int i = 0; i < overlays.size(); i++) {
Overlay overlay = overlays.get(i);
RandomAccessibleInterval<T> cropped = crop(data, overlay);
Pair<double[], double[]> xyPair = (Pair<double[], double[]>) ops.run("imageStatsForPlotting", ImageStatsForPlotting.MEAN, cropped);
plot.addPoints(xyPair.getA(), xyPair.getB(), Plot.LINE);
legendLabels.append("ROI ");
legendLabels.append(i + 1);
legendLabels.append("\n");
}
}
plot.addLegend(legendLabels.toString());
plot.show();
}
use of net.imglib2.util.Pair in project vcell by virtualcell.
the class PlotImageStats method run.
@Override
public void run() {
Plot plot = new ColorPlot("Frame mean intensity", "Time", "Mean intensity");
StringBuilder legendLabels = new StringBuilder();
for (int i = 0; i < datasets.size(); i++) {
RandomAccessibleInterval<T> data = datasets.get(i);
if (data instanceof Dataset) {
legendLabels.append(((Dataset) data).getName());
legendLabels.append(": ");
}
Pair<double[], double[]> xyPair = (Pair<double[], double[]>) ops.run("imageStatsForPlotting", ImageStatsForPlotting.MEAN, data, mask);
plot.addPoints(xyPair.getA(), xyPair.getB(), Plot.LINE);
legendLabels.append("ROI ");
legendLabels.append(i + 1);
legendLabels.append("\n");
}
plot.addLegend(legendLabels.toString());
plot.show();
}
Aggregations