本文整理汇总了Java中ij.io.Opener.openTiff方法的典型用法代码示例。如果您正苦于以下问题:Java Opener.openTiff方法的具体用法?Java Opener.openTiff怎么用?Java Opener.openTiff使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ij.io.Opener
的用法示例。
在下文中一共展示了Opener.openTiff方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: main
import ij.io.Opener; //导入方法依赖的package包/类
/** Main methods for test runs from comamnd line. */
public static void main( String [] args ) throws Exception {
if (args.length != 1) {
System.out.println("Provide a TIFF file");
System.exit(-1);
}
// open a tiff stack
InputStream img = new FileInputStream(args[0]);
Opener op = new Opener();
ImagePlus ip = op.openTiff( img, args[0] );
if (ip == null) {
System.out.println("Failed to open: "+args[0]);
System.exit(-1);
}
ip.show();
// run an ESI analysis on it
ESI_Analysis es = new ESI_Analysis();
//TraceStack ptr = new TraceStack( ip.getStack());
es.run("");
}
示例2: loadFile
import ij.io.Opener; //导入方法依赖的package包/类
/**
* Load the selected tif stack
* @param file tif stack file
*/
private void loadFile(File file) {
Opener o = new Opener();
ImagePlus win = o.openTiff(file.getParent().concat(File.separator),file.getName());
ImageStack stack = win.getImageStack();
ImageProcessor ip = stack.getProcessor(1);
FloatProcessor fp = ip.convertToFloatProcessor();
this.pixels = fp.getFloatArray();
}
示例3: loadFile
import ij.io.Opener; //导入方法依赖的package包/类
/**
* Load selected tif stack
* @param file tif stack file
*/
private void loadFile(File file) {
Opener o = new Opener();
ImagePlus win = o.openTiff(file.getParent().concat(File.separator),file.getName());
ImageStack stack = win.getImageStack();
ImageProcessor ip = stack.getProcessor(1);
FloatProcessor fp = ip.convertToFloatProcessor();
pixels = fp.getFloatArray();
}
示例4: loadGeneralTiff
import ij.io.Opener; //导入方法依赖的package包/类
/**
* Loads a tiff stack from a file on disk into RAM
* @param file tiff file to be loaded
* @return loaded image stack
*/
public final ImageStack loadGeneralTiff(File file) {
// Open the tiff via ImageJ
Logger.getLogger(TiffParser.class.getName()).log(Level.INFO, "Trying to open general tiff.");
Opener o = new Opener();
ImagePlus win = o.openTiff(file.getParent().concat("\\"),file.getName());
ImageStack stack = win.getImageStack();
// load dimensions and check bit depth
int width = stack.getWidth();
int height = stack.getHeight();
int bytesPerPixel;
if(stack.getPixels(win.getSlice()) instanceof short[]) {
Logger.getLogger(TiffParser.class.getName()).log(Level.INFO, "Array is instance of short[]");
bytesPerPixel = 2;
} else {
throw new ArrayStoreException("Wrong image bit depth.");
}
// initialize ImageStack in RAM
ram_stack = new ImageStack(width, height);
// load slices into new stack
for (int i=1; i<=stack.getSize(); i++) {
ram_stack.addSlice(String.valueOf(i), stack.getPixels(i));
// Log the process
if (i%100==0) {
System.out.format("Loaded %d images from general tiff stack.\n",i);
}
}
return ram_stack;
}
示例5: loadImage
import ij.io.Opener; //导入方法依赖的package包/类
/**
* Load image.
*
* @return the image plus
*/
public ImagePlus loadImage()
{
if (!hasImage())
return null;
Opener opener = new Opener();
opener.setSilentMode(true);
// The tifPath may be a system resource or it may be a file
File file = new File(tifPath);
if (file.exists())
{
// Load directly from a file path
return opener.openImage(tifPath);
}
// IJ has support for loading TIFs from an InputStream
Class<ConfigurationTemplate> resourceClass = ConfigurationTemplate.class;
InputStream inputStream = resourceClass.getResourceAsStream(tifPath);
if (inputStream != null)
{
return opener.openTiff(inputStream, Utils.removeExtension(file.getName()));
}
return null;
}
示例6: run
import ij.io.Opener; //导入方法依赖的package包/类
@Override
public void run(final String arg) {
// Open a tiff-file that is inside the jar-file (taken from
// http://imagej.nih.gov/ij/plugins/download/JAR_Resources_Demo.java)
final InputStream is = getClass().getResourceAsStream(path + stack_tif);
if (is != null) {
final Opener opener = new Opener();
final ImagePlus imp = opener.openTiff(is, stack_tif);
if (imp != null) {
imp.show();
}
}
// TODO Create the tutorial.
}