private void generateStereogram() {
        try {
            if (this.dottedRadioButton.isSelected()) {
                if (batchMode) {
                    //todo
                } else {
                    BufferedImage depthMap = null;
                    if (this.textRadioButton.isSelected()) {
                        depthMap = ImageManipulator.generateTextDepthMap(getMapText(), getFontSize(),
                                getStereogramWidth(), getStereogramHeight());
                    } else {
                        depthMap = getImage(this.mapFileChooser.getSelectedFile());
                    }
                    Color c1 = getColor1();
                    Color c2 = getColor2();
                    Color c3 = getColor3();
                    float intensity = getIntensity();
                    float obsDistance = getObservationDistance();
                    float eyeSep = getEyeSeparation();
                    float maxDepth = getMaxDepth();
                    float minDepth = getMinDepth();
                    int width = getStereogramWidth();
                    int height = getStereogramHeight();
                    int horizPPI = getHorizontalPPI();

                    BufferedImage stereogram = StereogramGenerator.generateSIRD(
                            depthMap,
                            c1, c2, c3, intensity,
                            width, height,
                            obsDistance, eyeSep,
                            maxDepth, minDepth,
                            horizPPI);
                    if (this.stereogramWindow != null) {
                        this.stereogramWindow.dispose();
                    }
                    this.stereogramWindow = new StereogramWindow(stereogram);
                    this.stereogramWindow.setVisible(true);
                }
            } else {
                //Texture pattern selected:
                if (batchMode) {
                    //todo
                } else {
                    BufferedImage depthMap = null;
                    if (this.textRadioButton.isSelected()) {
                        depthMap = ImageManipulator.generateTextDepthMap(getMapText(), getFontSize(), getStereogramWidth(), getStereogramHeight());
                    } else {
                        depthMap = getImage(this.mapFileChooser.getSelectedFile());
                    }
                    BufferedImage texturePattern = getImage(this.patternFileChooser.getSelectedFile());
                    float obsDistance = getObservationDistance();
                    float eyeSep = getEyeSeparation();
                    float maxDepth = getMaxDepth();
                    float minDepth = getMinDepth();
                    int width = getStereogramWidth();
                    int height = getStereogramHeight();
                    int vertPPI = getVerticalPPI();
                    int horizPPI = getHorizontalPPI();

                    BufferedImage stereogram = StereogramGenerator.generateTexturedSIRD(
                            depthMap, texturePattern,
                            width, height,
                            obsDistance, eyeSep,
                            maxDepth, minDepth,
                            horizPPI, vertPPI);
                    if (this.stereogramWindow != null) {
                        this.stereogramWindow.dispose();
                    }
                    this.stereogramWindow = new StereogramWindow(stereogram);
                    this.stereogramWindow.setVisible(true);
                }
            }
        } catch (Exception e) {
            JOptionPane.showMessageDialog(this, "Error generating stereogram."
                    + System.getProperty("line.separator")
                    + "ERROR: " + e.getMessage(), "Error", JOptionPane.ERROR_MESSAGE);
        }
    }