Search in sources :

Example 1 with FileSaver

use of ij.io.FileSaver in project GDSC-SMLM by aherbert.

the class CreateData method saveImage.

/**
	 * Save the image to a TIFF file
	 * 
	 * @param imp
	 */
private void saveImage(ImagePlus imp) {
    if (!settings.saveImage)
        return;
    String[] path = Utils.decodePath(settings.imageFilename);
    OpenDialog chooser = new OpenDialog("Image_File", path[0], path[1]);
    if (chooser.getFileName() != null) {
        settings.imageFilename = chooser.getDirectory() + chooser.getFileName();
        settings.imageFilename = Utils.replaceExtension(settings.imageFilename, "tiff");
        FileSaver fs = new FileSaver(imp);
        boolean ok;
        if (imp.getStackSize() > 1)
            ok = fs.saveAsTiffStack(settings.imageFilename);
        else
            ok = fs.saveAsTiff(settings.imageFilename);
        if (!ok)
            IJ.log("Failed to save image to file: " + settings.imageFilename);
    }
}
Also used : FileSaver(ij.io.FileSaver) OpenDialog(ij.io.OpenDialog)

Aggregations

FileSaver (ij.io.FileSaver)1 OpenDialog (ij.io.OpenDialog)1