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.canvas;
020
021import icy.gui.viewer.Viewer;
022import icy.vtk.IcyVtkPanel;
023
024import java.awt.image.BufferedImage;
025
026import plugins.kernel.canvas.VtkCanvas;
027import vtk.vtkRenderer;
028
029/**
030 * @deprecated Use {@link VtkCanvas} instead.
031 * @author Stephane
032 */
033@Deprecated
034public abstract class Canvas3D extends IcyCanvas3D
035{
036    private static final long serialVersionUID = -2677870897470280726L;
037
038    public Canvas3D(Viewer viewer)
039    {
040        super(viewer);
041    }
042
043    /**
044     * Adjust the volume image resolution rendering.<br>
045     * <ul>
046     * <li>0 = auto selection</li>
047     * <li>1 = highest resolution (slow)</li>
048     * <li>10 = lowest resolution (fast)</li>
049     * </ul>
050     * 
051     * @param value
052     */
053    public abstract void setVolumeDistanceSample(int value);
054
055    public abstract IcyVtkPanel getPanel3D();
056
057    public abstract vtkRenderer getRenderer();
058
059    /**
060     * Get scaling for image volume rendering
061     */
062    public abstract double[] getVolumeScale();
063
064    /**
065     * @deprecated Use {@link #getVolumeScale()} instead.
066     */
067    @Deprecated
068    public double getVolumeScaleX()
069    {
070        return getVolumeScale()[0];
071    }
072
073    /**
074     * @deprecated Use {@link #getVolumeScale()} instead.
075     */
076    @Deprecated
077    public double getVolumeScaleY()
078    {
079        return getVolumeScale()[1];
080    }
081
082    /**
083     * @deprecated Use {@link #getVolumeScale()} instead.
084     */
085    @Deprecated
086    public double getVolumeScaleZ()
087    {
088        return getVolumeScale()[2];
089    }
090
091    /**
092     * @deprecated
093     */
094    @Deprecated
095    public double getXScaling()
096    {
097        return getVolumeScaleX();
098    }
099
100    /**
101     * @deprecated
102     */
103    @Deprecated
104    public double getYScaling()
105    {
106        return getVolumeScaleY();
107    }
108
109    /**
110     * @deprecated
111     */
112    @Deprecated
113    public double getZScaling()
114    {
115        return getVolumeScaleZ();
116    }
117
118    /**
119     * Set scaling for image volume rendering
120     */
121    public abstract void setVolumeScale(double x, double y, double z);
122
123    /**
124     * @deprecated Use {@link #setVolumeScale(double, double, double)} instead
125     */
126    @Deprecated
127    public void setVolumeScaleX(double value)
128    {
129        final double[] scale = getVolumeScale();
130
131        if (scale[0] != value)
132        {
133            scale[0] = value;
134            setVolumeScale(scale[0], scale[1], scale[2]);
135        }
136    }
137
138    /**
139     * @deprecated Use {@link #setVolumeScale(double, double, double)} instead
140     */
141    @Deprecated
142    public void setVolumeScaleY(double value)
143    {
144        final double[] scale = getVolumeScale();
145
146        if (scale[1] != value)
147        {
148            scale[1] = value;
149            setVolumeScale(scale[0], scale[1], scale[2]);
150        }
151    }
152
153    /**
154     * @deprecated Use {@link #setVolumeScale(double, double, double)} instead
155     */
156    @Deprecated
157    public void setVolumeScaleZ(double value)
158    {
159        final double[] scale = getVolumeScale();
160
161        if (scale[2] != value)
162        {
163            scale[2] = value;
164            setVolumeScale(scale[0], scale[1], scale[2]);
165        }
166    }
167
168    /**
169     * @deprecated
170     */
171    @Deprecated
172    public void setXScaling(double value)
173    {
174        setVolumeScaleX(value);
175    }
176
177    /**
178     * @deprecated
179     */
180    @Deprecated
181    public void setYScaling(double value)
182    {
183        setVolumeScaleY(value);
184    }
185
186    /**
187     * @deprecated
188     */
189    @Deprecated
190    public void setZScaling(double value)
191    {
192        setVolumeScaleZ(value);
193    }
194
195    /**
196     * Returns a RGB or ARGB (depending support) BufferedImage representing the canvas view for
197     * image at position (t, c).<br>
198     * 
199     * @param t
200     *        T position of wanted image (-1 for complete sequence)
201     * @param c
202     *        C position of wanted image (-1 for all channels)
203     */
204    public abstract BufferedImage getRenderedImage(int t, int c);
205}