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.sequence;
020
021import icy.gui.component.IcyTextField;
022import icy.gui.component.IcyTextField.TextChangeListener;
023import icy.gui.component.NumberTextField;
024import icy.gui.util.ComponentUtil;
025import icy.math.UnitUtil;
026import icy.math.UnitUtil.UnitPrefix;
027import icy.sequence.Sequence;
028import icy.util.StringUtil;
029
030import java.awt.BorderLayout;
031import java.awt.Dimension;
032import java.awt.GridBagConstraints;
033import java.awt.GridBagLayout;
034import java.awt.Insets;
035import java.awt.event.ActionEvent;
036import java.awt.event.ActionListener;
037import java.util.concurrent.TimeUnit;
038
039import javax.swing.BoxLayout;
040import javax.swing.JCheckBox;
041import javax.swing.JComboBox;
042import javax.swing.JLabel;
043import javax.swing.JPanel;
044import javax.swing.border.EmptyBorder;
045import javax.swing.border.TitledBorder;
046
047public class SequencePropertiesPanel extends JPanel
048{
049    /**
050     * 
051     */
052    private static final long serialVersionUID = -1568878218022361239L;
053
054    private IcyTextField nameField;
055    NumberTextField tfPxSizeX;
056    NumberTextField tfPxSizeY;
057    private NumberTextField tfPxSizeZ;
058    private JComboBox cbPxSizeX;
059    JComboBox cbPxSizeY;
060    private JComboBox cbPxSizeZ;
061    private NumberTextField tfTimeInterval;
062    private JPanel panelChannels;
063    private IcyTextField[] tfsChannels;
064    private JLabel lblX;
065    private JLabel lblY;
066    private JLabel lblZ;
067    JCheckBox checkLinked;
068    private JComboBox cbTimeUnit;
069    private JLabel lblValue;
070    private JPanel panelPosition;
071    private NumberTextField positionXField;
072    private NumberTextField positionYField;
073    private NumberTextField positionZField;
074    private JComboBox posXUnitComboBox;
075    private JComboBox posYUnitComboBox;
076    private JComboBox posZUnitComboBox;
077    private JPanel panelPixelSize;
078    private JPanel panelTimeInterval;
079
080    /**
081     * Create the panel.
082     */
083    public SequencePropertiesPanel()
084    {
085        super();
086
087        // set ComboBox model
088        final UnitPrefix[] upValues = UnitPrefix.values();
089        final String[] cbModel = new String[upValues.length];
090
091        for (int i = 0; i < upValues.length; ++i)
092            cbModel[i] = upValues[i].toString() + "m";
093
094        initialize(cbModel);
095    }
096
097    private void initialize(String[] cbModel)
098    {
099        setLayout(new BorderLayout(0, 0));
100
101        JPanel panelMain = new JPanel();
102        panelMain.setBorder(new EmptyBorder(4, 4, 0, 4));
103        add(panelMain, BorderLayout.NORTH);
104        panelMain.setLayout(new BoxLayout(panelMain, BoxLayout.Y_AXIS));
105
106        JPanel panelName = new JPanel();
107        panelName.setBorder(new TitledBorder(null, "Name", TitledBorder.LEADING, TitledBorder.TOP, null, null));
108        panelMain.add(panelName);
109        panelName.setLayout(new BoxLayout(panelName, BoxLayout.LINE_AXIS));
110
111        nameField = new IcyTextField();
112        nameField.setPreferredSize(new Dimension(200, 20));
113        nameField.setMinimumSize(new Dimension(80, 20));
114        panelName.add(nameField);
115
116        panelPixelSize = new JPanel();
117        panelPixelSize.setBorder(new TitledBorder(null, "Pixel Size", TitledBorder.LEADING, TitledBorder.TOP, null,
118                null));
119        panelMain.add(panelPixelSize);
120        GridBagLayout gbl_panelPixelSize = new GridBagLayout();
121        gbl_panelPixelSize.columnWidths = new int[] {60, 80, 40, 60, 0};
122        gbl_panelPixelSize.rowHeights = new int[] {0, 0, 0, 0};
123        gbl_panelPixelSize.columnWeights = new double[] {0.0, 1.0, 1.0, 1.0, Double.MIN_VALUE};
124        gbl_panelPixelSize.rowWeights = new double[] {0.0, 0.0, 0.0, Double.MIN_VALUE};
125        panelPixelSize.setLayout(gbl_panelPixelSize);
126
127        lblX = new JLabel("X");
128        GridBagConstraints gbc_lblX = new GridBagConstraints();
129        gbc_lblX.anchor = GridBagConstraints.WEST;
130        gbc_lblX.fill = GridBagConstraints.VERTICAL;
131        gbc_lblX.insets = new Insets(0, 0, 5, 5);
132        gbc_lblX.gridx = 0;
133        gbc_lblX.gridy = 0;
134        panelPixelSize.add(lblX, gbc_lblX);
135
136        tfPxSizeX = new NumberTextField();
137        tfPxSizeX.setColumns(4);
138        GridBagConstraints gbc_tfPxSizeX = new GridBagConstraints();
139        gbc_tfPxSizeX.fill = GridBagConstraints.BOTH;
140        gbc_tfPxSizeX.insets = new Insets(0, 0, 5, 5);
141        gbc_tfPxSizeX.gridx = 1;
142        gbc_tfPxSizeX.gridy = 0;
143        panelPixelSize.add(tfPxSizeX, gbc_tfPxSizeX);
144        tfPxSizeX.addTextChangeListener(new TextChangeListener()
145        {
146            @Override
147            public void textChanged(IcyTextField source, boolean validate)
148            {
149                if (checkLinked.isSelected())
150                    tfPxSizeY.setText(tfPxSizeX.getText());
151            }
152        });
153        tfPxSizeX.setToolTipText("X pixel size");
154        cbPxSizeX = new JComboBox(cbModel);
155        GridBagConstraints gbc_cbPxSizeX = new GridBagConstraints();
156        gbc_cbPxSizeX.fill = GridBagConstraints.BOTH;
157        gbc_cbPxSizeX.insets = new Insets(0, 0, 5, 5);
158        gbc_cbPxSizeX.gridx = 2;
159        gbc_cbPxSizeX.gridy = 0;
160        panelPixelSize.add(cbPxSizeX, gbc_cbPxSizeX);
161
162        lblY = new JLabel("Y");
163        GridBagConstraints gbc_lblY = new GridBagConstraints();
164        gbc_lblY.anchor = GridBagConstraints.WEST;
165        gbc_lblY.fill = GridBagConstraints.VERTICAL;
166        gbc_lblY.insets = new Insets(0, 0, 5, 5);
167        gbc_lblY.gridx = 0;
168        gbc_lblY.gridy = 1;
169        panelPixelSize.add(lblY, gbc_lblY);
170
171        tfPxSizeY = new NumberTextField();
172        tfPxSizeY.setColumns(4);
173        GridBagConstraints gbc_tfPxSizeY = new GridBagConstraints();
174        gbc_tfPxSizeY.fill = GridBagConstraints.BOTH;
175        gbc_tfPxSizeY.insets = new Insets(0, 0, 5, 5);
176        gbc_tfPxSizeY.gridx = 1;
177        gbc_tfPxSizeY.gridy = 1;
178        panelPixelSize.add(tfPxSizeY, gbc_tfPxSizeY);
179        tfPxSizeY.setToolTipText("Y pixel size");
180        cbPxSizeY = new JComboBox(cbModel);
181        GridBagConstraints gbc_cbPxSizeY = new GridBagConstraints();
182        gbc_cbPxSizeY.fill = GridBagConstraints.BOTH;
183        gbc_cbPxSizeY.insets = new Insets(0, 0, 5, 5);
184        gbc_cbPxSizeY.gridx = 2;
185        gbc_cbPxSizeY.gridy = 1;
186        panelPixelSize.add(cbPxSizeY, gbc_cbPxSizeY);
187
188        checkLinked = new JCheckBox("link X/Y");
189        GridBagConstraints gbc_checkLinked = new GridBagConstraints();
190        gbc_checkLinked.anchor = GridBagConstraints.WEST;
191        gbc_checkLinked.fill = GridBagConstraints.VERTICAL;
192        gbc_checkLinked.insets = new Insets(0, 0, 5, 0);
193        gbc_checkLinked.gridx = 3;
194        gbc_checkLinked.gridy = 1;
195        panelPixelSize.add(checkLinked, gbc_checkLinked);
196
197        lblZ = new JLabel("Z");
198        GridBagConstraints gbc_lblZ = new GridBagConstraints();
199        gbc_lblZ.anchor = GridBagConstraints.WEST;
200        gbc_lblZ.fill = GridBagConstraints.VERTICAL;
201        gbc_lblZ.insets = new Insets(0, 0, 0, 5);
202        gbc_lblZ.gridx = 0;
203        gbc_lblZ.gridy = 2;
204        panelPixelSize.add(lblZ, gbc_lblZ);
205
206        tfPxSizeZ = new NumberTextField();
207        tfPxSizeZ.setColumns(4);
208        GridBagConstraints gbc_tfPxSizeZ = new GridBagConstraints();
209        gbc_tfPxSizeZ.fill = GridBagConstraints.BOTH;
210        gbc_tfPxSizeZ.insets = new Insets(0, 0, 0, 5);
211        gbc_tfPxSizeZ.gridx = 1;
212        gbc_tfPxSizeZ.gridy = 2;
213        panelPixelSize.add(tfPxSizeZ, gbc_tfPxSizeZ);
214        tfPxSizeZ.setToolTipText("Z pixel size");
215        cbPxSizeZ = new JComboBox(cbModel);
216        GridBagConstraints gbc_cbPxSizeZ = new GridBagConstraints();
217        gbc_cbPxSizeZ.fill = GridBagConstraints.BOTH;
218        gbc_cbPxSizeZ.insets = new Insets(0, 0, 0, 5);
219        gbc_cbPxSizeZ.gridx = 2;
220        gbc_cbPxSizeZ.gridy = 2;
221        panelPixelSize.add(cbPxSizeZ, gbc_cbPxSizeZ);
222        checkLinked.addActionListener(new ActionListener()
223        {
224            @Override
225            public void actionPerformed(ActionEvent arg0)
226            {
227                if (checkLinked.isSelected())
228                {
229                    tfPxSizeY.setEnabled(false);
230                    tfPxSizeY.setText(tfPxSizeX.getText());
231                    cbPxSizeY.setEnabled(false);
232                }
233                else
234                {
235                    tfPxSizeY.setEnabled(true);
236                    cbPxSizeY.setEnabled(true);
237                }
238            }
239        });
240
241        panelTimeInterval = new JPanel();
242        panelTimeInterval.setBorder(new TitledBorder(null, "Time Interval", TitledBorder.LEADING, TitledBorder.TOP,
243                null, null));
244        panelMain.add(panelTimeInterval);
245        GridBagLayout gbl_panelTimeInterval = new GridBagLayout();
246        gbl_panelTimeInterval.columnWidths = new int[] {60, 80, 40, 60, 0};
247        gbl_panelTimeInterval.rowHeights = new int[] {0, 0};
248        gbl_panelTimeInterval.columnWeights = new double[] {0.0, 1.0, 1.0, 1.0, Double.MIN_VALUE};
249        gbl_panelTimeInterval.rowWeights = new double[] {0.0, Double.MIN_VALUE};
250        panelTimeInterval.setLayout(gbl_panelTimeInterval);
251
252        lblValue = new JLabel("Value");
253        GridBagConstraints gbc_lblValue = new GridBagConstraints();
254        gbc_lblValue.anchor = GridBagConstraints.WEST;
255        gbc_lblValue.fill = GridBagConstraints.VERTICAL;
256        gbc_lblValue.insets = new Insets(0, 0, 0, 5);
257        gbc_lblValue.gridx = 0;
258        gbc_lblValue.gridy = 0;
259        panelTimeInterval.add(lblValue, gbc_lblValue);
260
261        tfTimeInterval = new NumberTextField();
262        tfTimeInterval.setColumns(4);
263        GridBagConstraints gbc_tfTimeInterval = new GridBagConstraints();
264        gbc_tfTimeInterval.fill = GridBagConstraints.BOTH;
265        gbc_tfTimeInterval.insets = new Insets(0, 0, 0, 5);
266        gbc_tfTimeInterval.gridx = 1;
267        gbc_tfTimeInterval.gridy = 0;
268        panelTimeInterval.add(tfTimeInterval, gbc_tfTimeInterval);
269        tfTimeInterval.setToolTipText("T time resolution");
270
271        cbTimeUnit = new JComboBox(new String[] {"h", "min", "s", "ms"});
272        GridBagConstraints gbc_cbTimeUnit = new GridBagConstraints();
273        gbc_cbTimeUnit.insets = new Insets(0, 0, 0, 5);
274        gbc_cbTimeUnit.fill = GridBagConstraints.BOTH;
275        gbc_cbTimeUnit.gridx = 2;
276        gbc_cbTimeUnit.gridy = 0;
277        panelTimeInterval.add(cbTimeUnit, gbc_cbTimeUnit);
278        cbTimeUnit.setSelectedIndex(2);
279
280        panelPosition = new JPanel();
281        panelPosition.setBorder(new TitledBorder(null, "Position", TitledBorder.LEADING, TitledBorder.TOP, null, null));
282        panelMain.add(panelPosition);
283        GridBagLayout gbl_panelPosition = new GridBagLayout();
284        gbl_panelPosition.columnWidths = new int[] {60, 80, 40, 60, 0};
285        gbl_panelPosition.rowHeights = new int[] {0, 0, 0, 0};
286        gbl_panelPosition.columnWeights = new double[] {0.0, 1.0, 1.0, 1.0, Double.MIN_VALUE};
287        gbl_panelPosition.rowWeights = new double[] {0.0, 0.0, 0.0, Double.MIN_VALUE};
288        panelPosition.setLayout(gbl_panelPosition);
289
290        JLabel lblX_1 = new JLabel("X");
291        GridBagConstraints gbc_lblX_1 = new GridBagConstraints();
292        gbc_lblX_1.fill = GridBagConstraints.VERTICAL;
293        gbc_lblX_1.insets = new Insets(0, 0, 5, 5);
294        gbc_lblX_1.anchor = GridBagConstraints.WEST;
295        gbc_lblX_1.gridx = 0;
296        gbc_lblX_1.gridy = 0;
297        panelPosition.add(lblX_1, gbc_lblX_1);
298
299        positionXField = new NumberTextField();
300        positionXField.setColumns(4);
301        positionXField.setToolTipText("Image position / offset X");
302        GridBagConstraints gbc_positionXfield = new GridBagConstraints();
303        gbc_positionXfield.insets = new Insets(0, 0, 5, 5);
304        gbc_positionXfield.fill = GridBagConstraints.BOTH;
305        gbc_positionXfield.gridx = 1;
306        gbc_positionXfield.gridy = 0;
307        panelPosition.add(positionXField, gbc_positionXfield);
308
309        posXUnitComboBox = new JComboBox(cbModel);
310        GridBagConstraints gbc_posXUnitComboBox = new GridBagConstraints();
311        gbc_posXUnitComboBox.insets = new Insets(0, 0, 5, 5);
312        gbc_posXUnitComboBox.fill = GridBagConstraints.BOTH;
313        gbc_posXUnitComboBox.gridx = 2;
314        gbc_posXUnitComboBox.gridy = 0;
315        panelPosition.add(posXUnitComboBox, gbc_posXUnitComboBox);
316
317        JLabel lblY_1 = new JLabel("Y");
318        GridBagConstraints gbc_lblY_1 = new GridBagConstraints();
319        gbc_lblY_1.fill = GridBagConstraints.VERTICAL;
320        gbc_lblY_1.anchor = GridBagConstraints.WEST;
321        gbc_lblY_1.insets = new Insets(0, 0, 5, 5);
322        gbc_lblY_1.gridx = 0;
323        gbc_lblY_1.gridy = 1;
324        panelPosition.add(lblY_1, gbc_lblY_1);
325
326        positionYField = new NumberTextField();
327        positionYField.setColumns(4);
328        positionYField.setToolTipText("Image position / offset Y");
329        GridBagConstraints gbc_positionYField = new GridBagConstraints();
330        gbc_positionYField.insets = new Insets(0, 0, 5, 5);
331        gbc_positionYField.fill = GridBagConstraints.BOTH;
332        gbc_positionYField.gridx = 1;
333        gbc_positionYField.gridy = 1;
334        panelPosition.add(positionYField, gbc_positionYField);
335
336        posYUnitComboBox = new JComboBox(cbModel);
337        GridBagConstraints gbc_posYUnitComboBox = new GridBagConstraints();
338        gbc_posYUnitComboBox.insets = new Insets(0, 0, 5, 5);
339        gbc_posYUnitComboBox.fill = GridBagConstraints.BOTH;
340        gbc_posYUnitComboBox.gridx = 2;
341        gbc_posYUnitComboBox.gridy = 1;
342        panelPosition.add(posYUnitComboBox, gbc_posYUnitComboBox);
343
344        JLabel lblZ_1 = new JLabel("Z");
345        GridBagConstraints gbc_lblZ_1 = new GridBagConstraints();
346        gbc_lblZ_1.fill = GridBagConstraints.VERTICAL;
347        gbc_lblZ_1.anchor = GridBagConstraints.WEST;
348        gbc_lblZ_1.insets = new Insets(0, 0, 0, 5);
349        gbc_lblZ_1.gridx = 0;
350        gbc_lblZ_1.gridy = 2;
351        panelPosition.add(lblZ_1, gbc_lblZ_1);
352
353        positionZField = new NumberTextField();
354        positionZField.setColumns(4);
355        positionZField.setToolTipText("Image position / offset Z");
356        GridBagConstraints gbc_positionZField = new GridBagConstraints();
357        gbc_positionZField.insets = new Insets(0, 0, 0, 5);
358        gbc_positionZField.fill = GridBagConstraints.BOTH;
359        gbc_positionZField.gridx = 1;
360        gbc_positionZField.gridy = 2;
361        panelPosition.add(positionZField, gbc_positionZField);
362
363        posZUnitComboBox = new JComboBox(cbModel);
364        GridBagConstraints gbc_posZUnitComboBox = new GridBagConstraints();
365        gbc_posZUnitComboBox.insets = new Insets(0, 0, 0, 5);
366        gbc_posZUnitComboBox.fill = GridBagConstraints.BOTH;
367        gbc_posZUnitComboBox.gridx = 2;
368        gbc_posZUnitComboBox.gridy = 2;
369        panelPosition.add(posZUnitComboBox, gbc_posZUnitComboBox);
370
371        panelChannels = new JPanel();
372        panelChannels.setBorder(new TitledBorder(null, "Channels", TitledBorder.LEADING, TitledBorder.TOP, null, null));
373        panelMain.add(panelChannels);
374        panelChannels.setLayout(new BoxLayout(panelChannels, BoxLayout.Y_AXIS));
375    }
376
377    public void setSequence(Sequence sequence)
378    {
379        // name
380        nameField.setText(sequence.getName());
381
382        // pixel size
383        final double pxSizeX = sequence.getPixelSizeX();
384        final double pxSizeY = sequence.getPixelSizeY();
385        final double pxSizeZ = sequence.getPixelSizeZ();
386
387        final UnitPrefix pxSizeXUnit = UnitUtil.getBestUnit(pxSizeX, UnitPrefix.MICRO);
388        final UnitPrefix pxSizeYUnit = UnitUtil.getBestUnit(pxSizeX, UnitPrefix.MICRO);
389        final UnitPrefix pxSizeZUnit = UnitUtil.getBestUnit(pxSizeX, UnitPrefix.MICRO);
390
391        cbPxSizeX.setSelectedItem(pxSizeXUnit.toString() + "m");
392        cbPxSizeY.setSelectedItem(pxSizeYUnit.toString() + "m");
393        cbPxSizeZ.setSelectedItem(pxSizeZUnit.toString() + "m");
394
395        tfPxSizeX.setText(StringUtil.toString(UnitUtil.getValueInUnit(pxSizeX, UnitPrefix.MICRO, pxSizeXUnit)));
396        tfPxSizeY.setText(StringUtil.toString(UnitUtil.getValueInUnit(pxSizeY, UnitPrefix.MICRO, pxSizeYUnit)));
397        tfPxSizeZ.setText(StringUtil.toString(UnitUtil.getValueInUnit(pxSizeZ, UnitPrefix.MICRO, pxSizeZUnit)));
398
399        if (tfPxSizeX.getText().equals(tfPxSizeY.getText())
400                && cbPxSizeX.getSelectedIndex() == cbPxSizeY.getSelectedIndex())
401        {
402            checkLinked.doClick();
403        }
404
405        // get timeInterval in ms
406        double timeInterval = sequence.getTimeInterval() * 1000d;
407        TimeUnit unit = UnitUtil.getBestTimeUnit(timeInterval);
408
409        switch (unit)
410        {
411            case MILLISECONDS:
412                tfTimeInterval.setText(StringUtil.toString(timeInterval));
413                cbTimeUnit.setSelectedIndex(3);
414                break;
415
416            case SECONDS:
417                tfTimeInterval.setText(StringUtil.toString(timeInterval / 1000));
418                cbTimeUnit.setSelectedIndex(2);
419                break;
420
421            case MINUTES:
422                tfTimeInterval.setText(StringUtil.toString(timeInterval / 60000));
423                cbTimeUnit.setSelectedIndex(1);
424                break;
425
426            case HOURS:
427                tfTimeInterval.setText(StringUtil.toString(timeInterval / 3600000));
428                cbTimeUnit.setSelectedIndex(0);
429                break;
430        }
431
432        // position
433        final double posX = sequence.getPositionX();
434        final double posY = sequence.getPositionY();
435        final double posZ = sequence.getPositionZ();
436
437        final UnitPrefix posXUnit = UnitUtil.getBestUnit(posX, UnitPrefix.MICRO);
438        final UnitPrefix posYUnit = UnitUtil.getBestUnit(posY, UnitPrefix.MICRO);
439        final UnitPrefix posZUnit = UnitUtil.getBestUnit(posZ, UnitPrefix.MICRO);
440
441        posXUnitComboBox.setSelectedItem(posXUnit.toString() + "m");
442        posYUnitComboBox.setSelectedItem(posYUnit.toString() + "m");
443        posZUnitComboBox.setSelectedItem(posZUnit.toString() + "m");
444
445        positionXField.setText(StringUtil.toString(UnitUtil.getValueInUnit(posX, UnitPrefix.MICRO, posXUnit)));
446        positionYField.setText(StringUtil.toString(UnitUtil.getValueInUnit(posY, UnitPrefix.MICRO, posYUnit)));
447        positionZField.setText(StringUtil.toString(UnitUtil.getValueInUnit(posZ, UnitPrefix.MICRO, posZUnit)));
448
449        // channel name
450        final int sizeC = sequence.getSizeC();
451
452        panelChannels.removeAll();
453
454        tfsChannels = new IcyTextField[sizeC];
455
456        for (int c = 0; c < sizeC; c++)
457        {
458            final JPanel panel = new JPanel();
459            panel.setLayout(new BoxLayout(panel, BoxLayout.LINE_AXIS));
460
461            final JLabel label = new JLabel("Channel " + c + " name");
462            label.setToolTipText("Channel " + c + " name");
463            ComponentUtil.setFixedWidth(label, 100);
464
465            final IcyTextField field = new IcyTextField();
466            field.setText(sequence.getChannelName(c));
467
468            panel.add(label);
469            panel.add(field);
470
471            tfsChannels[c] = field;
472            panelChannels.add(panel);
473        }
474
475        panelChannels.revalidate();
476    }
477
478    public String getNameFieldValue()
479    {
480        return nameField.getText();
481    }
482
483    public double getPixelSizeXFieldValue()
484    {
485        return tfPxSizeX.getNumericValue();
486    }
487
488    public UnitPrefix getPixelSizeXUnit()
489    {
490        return UnitPrefix.values()[cbPxSizeX.getSelectedIndex()];
491    }
492
493    public double getPixelSizeYFieldValue()
494    {
495        if (checkLinked.isSelected())
496            return tfPxSizeX.getNumericValue();
497
498        return tfPxSizeY.getNumericValue();
499    }
500
501    public UnitPrefix getPixelSizeYUnit()
502    {
503        if (checkLinked.isSelected())
504            return UnitPrefix.values()[cbPxSizeX.getSelectedIndex()];
505
506        return UnitPrefix.values()[cbPxSizeY.getSelectedIndex()];
507    }
508
509    public double getPixelSizeZFieldValue()
510    {
511        return tfPxSizeZ.getNumericValue();
512    }
513
514    public UnitPrefix getPixelSizeZUnit()
515    {
516        return UnitPrefix.values()[cbPxSizeZ.getSelectedIndex()];
517    }
518
519    public double getTimeIntervalFieldValue()
520    {
521        return tfTimeInterval.getNumericValue();
522    }
523
524    public int getTimeIntervalUnit()
525    {
526        return cbTimeUnit.getSelectedIndex();
527    }
528
529    public double getPositionXValue()
530    {
531        return positionXField.getNumericValue();
532    }
533
534    public UnitPrefix getPositionXUnit()
535    {
536        return UnitPrefix.values()[posXUnitComboBox.getSelectedIndex()];
537    }
538
539    public double getPositionYValue()
540    {
541        return positionYField.getNumericValue();
542    }
543
544    public UnitPrefix getPositionYUnit()
545    {
546        return UnitPrefix.values()[posYUnitComboBox.getSelectedIndex()];
547    }
548
549    public double getPositionZValue()
550    {
551        return positionZField.getNumericValue();
552    }
553
554    public UnitPrefix getPositionZUnit()
555    {
556        return UnitPrefix.values()[posZUnitComboBox.getSelectedIndex()];
557    }
558
559    public String getChannelNameFieldValue(int index)
560    {
561        return tfsChannels[index].getText();
562    }
563}