001/*
002 * Copyright 2010-2015 Institut Pasteur.
003 * 
004 * This file is part of Icy.
005 * 
006 * Icy is free software: you can redistribute it and/or modify
007 * it under the terms of the GNU General Public License as published by
008 * the Free Software Foundation, either version 3 of the License, or
009 * (at your option) any later version.
010 * 
011 * Icy is distributed in the hope that it will be useful,
012 * but WITHOUT ANY WARRANTY; without even the implied warranty of
013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
014 * GNU General Public License for more details.
015 * 
016 * You should have received a copy of the GNU General Public License
017 * along with Icy. If not, see <http://www.gnu.org/licenses/>.
018 */
019package icy.gui.lut;
020
021import icy.gui.viewer.Viewer;
022import icy.image.lut.LUT.LUTChannel;
023import icy.math.Scaler;
024
025import java.awt.BorderLayout;
026
027import javax.swing.JPanel;
028
029/**
030 * @author stephane
031 */
032public class ScalerPanel extends JPanel
033{
034    /**
035     * 
036     */
037    private static final long serialVersionUID = 7681106081280637308L;
038
039    /**
040     * gui
041     */
042    final ScalerViewer scalerViewer;
043
044    /**
045     * associated Viewer & LUTBand
046     */
047    protected final Viewer viewer;
048    protected final LUTChannel lutChannel;
049
050    /**
051     * 
052     */
053    public ScalerPanel(Viewer viewer, LUTChannel lutChannel)
054    {
055        super();
056
057        this.viewer = viewer;
058        this.lutChannel = lutChannel;
059
060        setLayout(new BorderLayout());
061
062        scalerViewer = new ScalerViewer(viewer, lutChannel);
063
064        add(scalerViewer, BorderLayout.CENTER);
065
066        validate();
067    }
068
069    /**
070     * @return the scalerViewer
071     */
072    public ScalerViewer getScalerViewer()
073    {
074        return scalerViewer;
075    }
076
077    /**
078     * @deprecated Use {@link #refreshHistogram()} instead.
079     */
080    @Deprecated
081    public void refreshHistoData()
082    {
083        refreshHistogram();
084    }
085
086    public void refreshHistogram()
087    {
088        // update histogram
089        scalerViewer.requestHistoDataRefresh();
090    }
091
092    /**
093     * 
094     */
095    public Scaler getScaler()
096    {
097        return lutChannel.getScaler();
098    }
099
100}