当前位置: 首页>>代码示例>>Java>>正文


Java FileSaver.saveAsTiffStack方法代码示例

本文整理汇总了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());
	}
}
 
开发者ID:aherbert,项目名称:GDSC-SMLM,代码行数:30,代码来源:CreateData.java

示例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");
}
 
开发者ID:spatialsimulator,项目名称:XitoSBML,代码行数:15,代码来源:SpatialImage.java

示例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() + "'.");
    }
}
 
开发者ID:ij-plugins,项目名称:ijp-toolkit,代码行数:20,代码来源:IOUtils.java

示例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);
}
 
开发者ID:aherbert,项目名称:GDSC-SMLM,代码行数:8,代码来源:CMOSAnalysis.java

示例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);
}
 
开发者ID:imglib,项目名称:imglib2-script,代码行数:34,代码来源:ImgLib.java

示例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());
    }
}
 
开发者ID:PouletAxel,项目名称:NucleusJ_,代码行数:20,代码来源:RunnableImageSegmentation.java

示例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());
    }
}
 
开发者ID:PouletAxel,项目名称:NucleusJ_,代码行数:19,代码来源:ChromocenterSegmentationBatchPlugin_.java

示例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());
}
 
开发者ID:LEB-EPFL,项目名称:SASS,代码行数:7,代码来源:AbstractGenerator.java


注:本文中的ij.io.FileSaver.saveAsTiffStack方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。