private void mathConversion() throws Exception {
        if (isReadOnly) {
            return;
        }

        int cols = table.getSelectedColumnCount();
        // if (!(dataset instanceof ScalarDS)) return;
        if ((dataset instanceof CompoundDS) && (cols > 1)) {
            toolkit.beep();
            JOptionPane.showMessageDialog(this,
                    "Please select one colunm a time for math conversion for compound dataset.", getTitle(),
                    JOptionPane.ERROR_MESSAGE);
            return;
        }

        Object theData = getSelectedData();
        if (theData == null) {
            toolkit.beep();
            JOptionPane.showMessageDialog(this, "No data is selected.", getTitle(), JOptionPane.ERROR_MESSAGE);
            return;
        }

        MathConversionDialog dialog = new MathConversionDialog((JFrame) viewer, theData);
        dialog.setVisible(true);

        if (dialog.isConverted()) {
            if (dataset instanceof CompoundDS) {
                Object colData = null;
                try {
                    colData = ((List) dataset.getData()).get(table.getSelectedColumn());
                }
                catch (Exception ex) {}

                if (colData != null) {
                    int size = Array.getLength(theData);
                    System.arraycopy(theData, 0, colData, 0, size);
                }
            }
            else {
                int rows = table.getSelectedRowCount();
                int r0 = table.getSelectedRow();
                int c0 = table.getSelectedColumn();
                int w = table.getColumnCount();
                int idx_src = 0;
                int idx_dst = 0;
                for (int i = 0; i < rows; i++) {
                    idx_dst = (r0 + i) * w + c0;
                    System.arraycopy(theData, idx_src, dataValue, idx_dst, cols);
                    idx_src += cols;
                }
            }

            theData = null;
            System.gc();
            table.updateUI();
            isValueChanged = true;
        }

    }