e.printStackTrace();
ImViewerAgent.getRegistry().getLogger().error(this, e.getMessage());
    private void writeImage(BufferedImage image, String n)    {        UserNotifier un = ImViewerAgent.getRegistry().getUserNotifier();        n += "."+format;        File f = new File(n);        try {            if (format.equals(TIFFFilter.TIF)) {                Encoder encoder = new TIFFEncoder(Factory.createImage(image),                         new DataOutputStream(new FileOutputStream(f)));                WriterImage.saveImage(encoder);            } else WriterImage.saveImage(f, image, format);            un.notifyInfo("Image Saved", saveMessage);            setClosed(true);        } catch (Exception e) {            e.printStackTrace();            f.delete();            un.notifyError("Save image failure", "Unable to save the image", e);        }    }