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


Java OpenDialog.getFileName方法代码示例

本文整理汇总了Java中ij.io.OpenDialog.getFileName方法的典型用法代码示例。如果您正苦于以下问题:Java OpenDialog.getFileName方法的具体用法?Java OpenDialog.getFileName怎么用?Java OpenDialog.getFileName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ij.io.OpenDialog的用法示例。


在下文中一共展示了OpenDialog.getFileName方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: loadHomographyMatrixFromFile

import ij.io.OpenDialog; //导入方法依赖的package包/类
float[][] loadHomographyMatrixFromFile() {

		OpenDialog od = new OpenDialog("Choose a file containing 3x3 Homography Matrix" + " (" + title + ")", null);
		String dir = od.getDirectory();
		String fileName = od.getFileName();
		if (fileName == null)
			return null;
		String fullName = dir + fileName;
		float[][] res = new float[3][3];

		try {
			Scanner in = new Scanner(new File(fullName));
			for (int i=0; i<3; i++)
				for (int j=0; j<3; j++)
					res[i][j] = in.nextFloat();
			in.close();
		} catch (FileNotFoundException e) {
			IJ.error("SURF: loadHomographyFromFile", e.getMessage());
			res = null;
		}

		return res;
	}
 
开发者ID:remipassmoilesel,项目名称:imagej-surf,代码行数:24,代码来源:Compare_Images.java

示例2: run

import ij.io.OpenDialog; //导入方法依赖的package包/类
@Override
public void run(final String arg) {
    final OpenDialog openDialog = new OpenDialog("Open as VTK...", arg);
    if (openDialog.getFileName() == null) {
        return;
    }

    final File file = new File(openDialog.getDirectory(), openDialog.getFileName());
    try {
        IJ.showStatus("Opening VTK image: " + file.getName());
        final long tStart = System.currentTimeMillis();
        final ImagePlus imp = VtkDecoder.open(file);
        final long tStop = System.currentTimeMillis();
        imp.show();
        IJ.showStatus("VTK image loaded in " + (tStop - tStart) + " ms.");
    } catch (final VtkImageException ex) {
        IJ.showMessage(DIALOG_CAPTION, "Error opening image: '"
                + file.getAbsolutePath() + "'\n" + ex.getMessage());
    }
}
 
开发者ID:ij-plugins,项目名称:ijp-toolkit,代码行数:21,代码来源:VtkReaderPlugin.java

示例3: loadPoints

import ij.io.OpenDialog; //导入方法依赖的package包/类
/**
 * Load the points from the point handlers.
 */
private void loadPoints ()
{
	final OpenDialog od = new OpenDialog("Load Points", "");
	final String path = od.getDirectory();
	final String filename = od.getFileName();
	if ((path == null) || (filename == null)) return;

	Stack <Point> sourceStack = new Stack <Point> ();
	Stack <Point> targetStack = new Stack <Point> ();
	MiscTools.loadPoints(path+filename,sourceStack,targetStack);

	sourcePh.removePoints();
	targetPh.removePoints();
	while ((!sourceStack.empty()) && (!targetStack.empty())) {
		Point sourcePoint = (Point)sourceStack.pop();
		Point targetPoint = (Point)targetStack.pop();
		sourcePh.addPoint(sourcePoint.x, sourcePoint.y);
		targetPh.addPoint(targetPoint.x, targetPoint.y);
	}
}
 
开发者ID:akmaier,项目名称:CONRAD,代码行数:24,代码来源:IODialog.java

示例4: loadTransformation

import ij.io.OpenDialog; //导入方法依赖的package包/类
/**
 * Load a transformation and apply it to the source image.
 */
private void loadTransformation ()
{
	final OpenDialog od = new OpenDialog("Load Elastic Transformation", "");
	final String path = od.getDirectory();
	final String filename = od.getFileName();

	if ((path == null) || (filename == null))
		return;

	String fn_tnf = path+filename;

	int intervals = MiscTools.numberOfIntervalsOfTransformation(fn_tnf);

	double [][]cx = new double[intervals+3][intervals+3];
	double [][]cy = new double[intervals+3][intervals+3];

	MiscTools.loadTransformation(fn_tnf, cx, cy);

	// Apply transformation
	dialog.applyTransformationToSource(intervals, cx, cy);
}
 
开发者ID:akmaier,项目名称:CONRAD,代码行数:25,代码来源:IODialog.java

示例5: loadRawTransformation

import ij.io.OpenDialog; //导入方法依赖的package包/类
/**
 * Load a raw transformation and apply it to the source image.
 */
private void loadRawTransformation ()
{
	final OpenDialog od = new OpenDialog("Load Raw Transformation", "");
	final String path = od.getDirectory();
	final String filename = od.getFileName();

	if ((path == null) || (filename == null))
		return;

	String fn_tnf = path+filename;

	double [][]transformation_x = new double[this.targetImp.getHeight()][this.targetImp.getWidth()];
	double [][]transformation_y = new double[this.targetImp.getHeight()][this.targetImp.getWidth()];

	MiscTools.loadRawTransformation(fn_tnf, transformation_x, transformation_y);

	// Apply transformation
	dialog.applyRawTransformationToSource(transformation_x, transformation_y);
}
 
开发者ID:akmaier,项目名称:CONRAD,代码行数:23,代码来源:IODialog.java

示例6: importFile

import ij.io.OpenDialog; //导入方法依赖的package包/类
protected void importFile(final String dialogTitle, final String extension,
	final String formatDescription)
{
	final OpenDialog od =
		new OpenDialog(dialogTitle, OpenDialog.getDefaultDirectory(), null);
	final String filename = od.getFileName();
	if (null == filename) return;
	if (!filename.toLowerCase().endsWith(extension)) {
		IJ.showMessage("Must select a " + formatDescription + " file!");
		return;
	}
	final String path =
		new StringBuilder(od.getDirectory()).append(filename).toString();
	IJ.log("path: " + path);
	Object ob;
	try {
		ob = univ.addContentLater(path);
		record(IMPORT, path);
	}
	catch (final Exception e) {
		e.printStackTrace();
		ob = null;
	}
	if (null == ob) IJ.showMessage("Could not load the file:\n" + path);
}
 
开发者ID:fiji,项目名称:3D_Viewer,代码行数:26,代码来源:Executer.java

示例7: loadSession

import ij.io.OpenDialog; //导入方法依赖的package包/类
public void loadSession() {
	final OpenDialog sd =
		new OpenDialog("Open session...", "session", ".scene");
	final String dir = sd.getDirectory();
	final String name = sd.getFileName();
	if (dir == null || name == null) return;
	new Thread() {

		{
			setPriority(Thread.NORM_PRIORITY);
		}

		@Override
		public void run() {
			try {
				univ.loadSession(dir + name);
			}
			catch (final Exception e) {
				IJ.error(e.getMessage());
			}
		}
	}.start();
}
 
开发者ID:fiji,项目名称:3D_Viewer,代码行数:24,代码来源:Executer.java

示例8: run

import ij.io.OpenDialog; //导入方法依赖的package包/类
@Override
public void run(String arg) {
	if (arg.equals("")) {
		final OpenDialog od = new OpenDialog("AmiraFile", null);
		if (od.getDirectory() == null) return; // canceled
		arg = od.getDirectory() + od.getFileName();
	}

	final Image3DUniverse universe = new Image3DUniverse();
	try {
		addMeshes(universe, arg);
	}
	catch (final IOException e) {
		IJ.error("Could not read '" + arg + "': " + e);
		return;
	}
	universe.show();
}
 
开发者ID:fiji,项目名称:3D_Viewer,代码行数:19,代码来源:AmiraSurface.java

示例9: createFilePeakResults

import ij.io.OpenDialog; //导入方法依赖的package包/类
private TextFilePeakResults createFilePeakResults(MemoryPeakResults results2)
{
	if (!saveClassifications)
		return null;
	String[] path = Utils.decodePath(classificationsFile);
	OpenDialog chooser = new OpenDialog("Classifications_File", path[0], path[1]);
	if (chooser.getFileName() != null)
	{
		classificationsFile = chooser.getDirectory() + chooser.getFileName();
		TextFilePeakResults r = new TextFilePeakResults(classificationsFile, false, false);
		r.copySettings(results2);
		r.begin();
		return r;
	}
	return null;
}
 
开发者ID:aherbert,项目名称:GDSC-SMLM,代码行数:17,代码来源:ResultsMatchCalculator.java

示例10: saveImage

import ij.io.OpenDialog; //导入方法依赖的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

示例11: saveImageResults

import ij.io.OpenDialog; //导入方法依赖的package包/类
private void saveImageResults(MemoryPeakResults results)
{
	if (!settings.getSaveImageResults())
		return;
	String[] path = Utils.decodePath(settings.getImageResultsFilename());
	OpenDialog chooser = new OpenDialog("Image_Results_File", path[0], path[1]);
	if (chooser.getFileName() != null)
	{
		settings.setImageResultsFilename(chooser.getDirectory() + chooser.getFileName());
		settings.setImageResultsFilename(Utils.replaceExtension(settings.getImageResultsFilename(), "xls"));

		TextFilePeakResults r = new TextFilePeakResults(settings.getImageResultsFilename(), false);
		r.copySettings(results);
		r.begin();
		r.addAll(results.toArray());
		r.end();
	}
}
 
开发者ID:aherbert,项目名称:GDSC-SMLM,代码行数:19,代码来源:CreateData.java

示例12: mouseClicked

import ij.io.OpenDialog; //导入方法依赖的package包/类
public void mouseClicked(MouseEvent e)
{
	if (e.getClickCount() > 1) // Double-click
	{
		TextField text;
		String title;
		if (e.getSource() == text1)
		{
			text = text1;
			title = "Coordinate_file_1";
		}
		else
		{
			text = text2;
			title = "Coordinate_file_2";
		}
		String[] path = decodePath(text.getText());
		OpenDialog chooser = new OpenDialog(title, path[0], path[1]);
		if (chooser.getFileName() != null)
		{
			text.setText(chooser.getDirectory() + chooser.getFileName());
		}
	}
}
 
开发者ID:aherbert,项目名称:GDSC,代码行数:25,代码来源:FileMatchCalculator.java

示例13: askForOpenPath

import ij.io.OpenDialog; //导入方法依赖的package包/类
/**
 *  Queries the user for an arbitrary file to be opened.
 *  
 * @param title string to be shown in the interaction window.
 * @return path of the selected resource.
 */
public static String askForOpenPath(String title) {
	OpenDialog od = new OpenDialog(title, "");
	String dir = od.getDirectory();
	String name = od.getFileName();
	if (name == null)
		return null;
	return encodeURL(dir + name);
}
 
开发者ID:imagingbook,项目名称:imagingbook-common,代码行数:15,代码来源:IjUtils.java

示例14: run

import ij.io.OpenDialog; //导入方法依赖的package包/类
@Override
public void run(final String arg) {
	String directory;

	if (!arg.isEmpty()) {// Called by HandleExtraFileTypes
		final File theFile = new File(arg);
		directory = theFile.getParent() + "/";
		fileName = theFile.getName();
	} else {// select file manually
		final OpenDialog od = new OpenDialog("Select stratec image (I*.M*)", arg);
		directory = od.getDirectory();
		fileName = od.getFileName();
	}
	if (fileName == null)
		return;
	try {
		read(directory);
		fileInfo();
		if (arg.isEmpty() && this.getHeight() > 0) {
			this.show();
			return;
		}
		if (this.getHeight() < 1)
			return;
	} catch (final Exception err) {
		IJ.error("Stratec file read failed ", err.getMessage());
	}
	UsageReporter.reportEvent(this).send();
}
 
开发者ID:bonej-org,项目名称:BoneJ2,代码行数:30,代码来源:Read_Stratec_File.java

示例15: run

import ij.io.OpenDialog; //导入方法依赖的package包/类
@Override
public void run(String arg) {

	OpenDialog od = new OpenDialog("SURF: TEST Load Interest Points From File", arg);
	String dir = od.getDirectory();
	String fileName = od.getFileName();
	if (fileName == null)
		return;
	String fullName = dir + fileName;
	List<InterestPoint> ipts = InterestPoint.loadFromFile(fullName);
	IJ.showStatus("SURF: Loading Interest Points from File " + fullName);
	IJFacade.setLastResult(ipts);
	
}
 
开发者ID:remipassmoilesel,项目名称:imagej-surf,代码行数:15,代码来源:Load_Interest_Points_From_File.java


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