本文整理汇总了Java中ij.io.FileSaver.saveAsTiffStack方法的典型用法代码示例。如果您正苦于以下问题:Java FileSaver.saveAsTiffStack方法的具体用法?Java FileSaver.saveAsTiffStack怎么用?Java FileSaver.saveAsTiffStack使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ij.io.FileSaver
的用法示例。
在下文中一共展示了FileSaver.saveAsTiffStack方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: saveImage
import ij.io.FileSaver; //导入方法依赖的package包/类
/**
* Save the image to a TIFF file
*
* @param imp
*/
private void saveImage(ImagePlus imp)
{
if (!settings.getSaveImage())
return;
String[] path = Utils.decodePath(settings.getImageFilename());
OpenDialog chooser = new OpenDialog("Image_File", path[0], path[1]);
if (chooser.getFileName() != null)
{
settings.setImageFilename(chooser.getDirectory() + chooser.getFileName());
settings.setImageFilename(Utils.replaceExtension(settings.getImageFilename(), "tiff"));
FileSaver fs = new FileSaver(imp);
boolean ok;
if (imp.getStackSize() > 1)
ok = fs.saveAsTiffStack(settings.getImageFilename());
else
ok = fs.saveAsTiff(settings.getImageFilename());
// The following call throws a NoSuchMethodError.
// ok = IJ.saveAsTiff(imp, settings.imageFilename);
if (!ok)
IJ.log("Failed to save image to file: " + settings.getImageFilename());
}
}
示例2: saveAsImage
import ij.io.FileSaver; //导入方法依赖的package包/类
/**
* Save as image.
*
* @param path the path
* @param name the name
*/
public void saveAsImage(String path, String name){
FileSaver fs = new FileSaver(img);
if(name == null) return;
if(depth > 1)
fs.saveAsTiffStack(path + "/" + name + ".tiff");
else
fs.saveAsTiff(path + "/" + name + ".tiff");
}
示例3: saveAsTiff
import ij.io.FileSaver; //导入方法依赖的package包/类
/**
* Save image to a file using image TIFF encoder.
*
* @param imp image.
* @param file destination file.
* @throws IOException when image cannot be saved.
*/
public static void saveAsTiff(final ImagePlus imp, final File file) throws IOException {
final FileSaver fileSaver = new FileSaver(imp);
final boolean ok;
if (imp.getStackSize() > 1) {
ok = fileSaver.saveAsTiffStack(file.getAbsolutePath());
} else {
ok = fileSaver.saveAsTiff(file.getAbsolutePath());
}
if (!ok) {
throw new IOException("Error saving image to file: '" + file.getAbsolutePath() + "'.");
}
}
示例4: save
import ij.io.FileSaver; //导入方法依赖的package包/类
private void save(ImageStack stack, int start)
{
ImagePlus imp = new ImagePlus("", stack);
String path = new File(out, String.format("image%06d.tif", start)).getPath();
FileSaver fs = new FileSaver(imp);
fs.saveAsTiffStack(path);
}
示例5: save
import ij.io.FileSaver; //导入方法依赖的package包/类
/** Save an image in the format specified by {@param fileType}, which can be any of:
* "tif", "tiff", "zip", "gif", "jpg", "jpeg", "bmp", "pgm", "png", "raw".
*
* When saving as TIFF, if the image has more than 2 dimensions, it will be saved
* as a stack.
* @throws ImgLibException */
public static<T extends RealType<T> & NativeType<T>> boolean save(final Img<T> image, String fileType, final String path) throws ImgLibException {
// TODO: use LOCI for this
final ImagePlus imp = wrap(image);
final FileSaver saver = new FileSaver(imp);
fileType = fileType.toLowerCase();
if (fileType.equals("tif") || fileType.equals("tiff")) {
if (image.numDimensions() > 2) {
return saver.saveAsTiffStack(path);
}
return saver.saveAsTiff(path);
} else if (fileType.equals("zip"))
return saver.saveAsZip(path);
else if (fileType.equals("gif"))
return saver.saveAsGif(path);
else if (fileType.equals("jpg") || fileType.equals("jpeg"))
return saver.saveAsJpeg(path);
else if (fileType.equals("bmp"))
return saver.saveAsBmp(path);
else if (fileType.equals("pgm"))
return saver.saveAsPgm(path);
else if (fileType.equals("png"))
return saver.saveAsPng(path);
else if (fileType.equals("raw"))
return saver.saveAsRaw(path);
else
throw new RuntimeException("Unknown fileformat: " + fileType);
}
示例6: saveFile
import ij.io.FileSaver; //导入方法依赖的package包/类
/**
*
* Method which save the image in the directory.
*
* @param imagePlusInput Image to be save
* @param pathFile path of directory
*/
public void saveFile ( ImagePlus imagePlusInput, String pathFile)
{
FileSaver fileSaver = new FileSaver(imagePlusInput);
File file = new File(pathFile);
if (file.exists())
fileSaver.saveAsTiffStack( pathFile+File.separator+imagePlusInput.getTitle());
else
{
file.mkdir();
fileSaver.saveAsTiffStack( pathFile+File.separator+imagePlusInput.getTitle());
}
}
示例7: saveFile
import ij.io.FileSaver; //导入方法依赖的package包/类
/**
* saving file method
*
* @param imagePlus imagePus to save
* @param pathFile the path where save the image
*/
public void saveFile ( ImagePlus imagePlus, String pathFile)
{
FileSaver fileSaver = new FileSaver(imagePlus);
File file = new File(pathFile);
if (file.exists())
fileSaver.saveAsTiffStack( pathFile+File.separator+imagePlus.getTitle());
else
{
file.mkdir();
fileSaver.saveAsTiffStack( pathFile+File.separator+imagePlus.getTitle());
}
}
示例8: saveStack
import ij.io.FileSaver; //导入方法依赖的package包/类
@Override
public void saveStack(File file) {
ImagePlus imp = new ImagePlus("stack", stack);
FileSaver fs = new FileSaver(imp);
fs.saveAsTiffStack(file.getAbsolutePath());
}