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


Java OpenDialog.getDirectory方法代码示例

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


在下文中一共展示了OpenDialog.getDirectory方法的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: 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

示例7: 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

示例8: 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

示例9: 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

示例10: 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

示例11: 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

示例12: loadHomographyMatrixFromFile

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

		OpenDialog od = new OpenDialog("SURF: Choose the file containing 3x3 Homography Matrix", null);
		String dir = od.getDirectory();
		String fileName = od.getFileName();
		if (fileName == null)
			return null;
		String fullName = dir + fileName;

		return loadHomographyMatrixFromFile(fullName);
	}
 
开发者ID:remipassmoilesel,项目名称:imagej-surf,代码行数:12,代码来源:Test_on_Mikolajczyk_Image_Set.java

示例13: run

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

    // Get file name
    final OpenDialog openDialog = new OpenDialog("Open as MetaImage...", arg);
    if (openDialog.getFileName() == null) {
        return;
    }

    // Get options (only virtual stack at the moment)
    final GenericDialog optionsDialog = new GenericDialog(TITLE);
    optionsDialog.addCheckbox("Use_virtual_stack", virtual);
    optionsDialog.showDialog();
    if (optionsDialog.wasCanceled()) {
        return;
    }
    virtual = optionsDialog.getNextBoolean();

    final File file = new File(openDialog.getDirectory(), openDialog.getFileName());
    try {
        IJ.showStatus("Opening MetaImage: " + file.getName());
        final long tStart = System.currentTimeMillis();
        final ImagePlus[] imps = MiDecoder.open(file, virtual);
        final long tStop = System.currentTimeMillis();
        for (final ImagePlus imp : imps) {
            imp.show();
        }
        IJ.showStatus("MetaImage loaded in " + (tStop - tStart) + " ms.");
    } catch (final MiException ex) {
        ex.printStackTrace();
        IJ.error(TITLE, "Error opening image: '"
                + file.getAbsolutePath() + "'\n" + ex.getMessage());
    }
}
 
开发者ID:ij-plugins,项目名称:ijp-toolkit,代码行数:35,代码来源:MetaImageReaderPlugin.java

示例14: openAsString

import ij.io.OpenDialog; //导入方法依赖的package包/类
/** Opens a text file as a string. Displays a file open dialog
	if path is null or blank. Returns null if the user cancels
	the file open dialog. If there is an error, returns a 
	 message in the form "Error: message". */
public static String openAsString(String path) {
	if (path==null || path.equals("")) {
		OpenDialog od = new OpenDialog("Open Text File", "");
		String directory = od.getDirectory();
		String name = od.getFileName();
		if (name==null) return null;
		path = directory + name;
	}
	String str = "";
	File file = new File(path);
	if (!file.exists())
		return "Error: file not found";
	try {
		StringBuffer sb = new StringBuffer(5000);
		BufferedReader r = new BufferedReader(new FileReader(file));
		while (true) {
			String s=r.readLine();
			if (s==null)
				break;
			else
				sb.append(s+"\n");
		}
		r.close();
		str = new String(sb);
	}
	catch (Exception e) {
		str = "Error: "+e.getMessage();
	}
	return str;
}
 
开发者ID:darciopacifico,项目名称:omr,代码行数:35,代码来源:IJJazzOMR.java

示例15: loadSourceMask

import ij.io.OpenDialog; //导入方法依赖的package包/类
/**
 * Load a source mask image from a file.
 */
private void loadSourceMask ()
{
	final OpenDialog od = new OpenDialog("Load Source Mask", "");
	final String path = od.getDirectory();
	final String filename = od.getFileName();

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

	String fnSourceMask = path+filename;
	dialog.setSourceMask(fnSourceMask);
	dialog.grayImage(sourcePh);

}
 
开发者ID:akmaier,项目名称:CONRAD,代码行数:18,代码来源:IODialog.java


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