• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java Duplicator类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中ij.plugin.Duplicator的典型用法代码示例。如果您正苦于以下问题:Java Duplicator类的具体用法?Java Duplicator怎么用?Java Duplicator使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



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

示例1: loadSurfaceColorsFromImage

import ij.plugin.Duplicator; //导入依赖的package包/类
@Override
public void loadSurfaceColorsFromImage(ImagePlus imp) {
	if (imp.getType() != ImagePlus.COLOR_RGB) {
		imp = new Duplicator().run(imp);
		new StackConverter(imp).convertToRGB();
	}
	final InterpolatedImage ii = new InterpolatedImage(imp);

	final Calibration cal = imp.getCalibration();
	final double pw = cal.pixelWidth;
	final double ph = cal.pixelHeight;
	final double pd = cal.pixelDepth;
	for (int i = 0; i < nVertices; i++) {
		final Point3f coord = vertices[i];
		final int v =
			(int) Math.round(ii.interpol.get(coord.x / pw, coord.y / ph, coord.z /
				pd));
		colors[i] =
			new Color3f(((v & 0xff0000) >> 16) / 255f, ((v & 0xff00) >> 8) / 255f,
				(v & 0xff) / 255f);
	}
	final GeometryArray ga = (GeometryArray) getGeometry();
	if (ga == null) return;
	ga.setColors(0, colors);
	changed = true;
}
 
开发者ID:fiji,项目名称:3D_Viewer,代码行数:27,代码来源:CustomIndexedTriangleMesh.java


示例2: showDialog

import ij.plugin.Duplicator; //导入依赖的package包/类
@Override
public int showDialog(final ImagePlus imp, final String command,
	final PlugInFilterRunner pfr)
{
	if (imp.getStackSize() != 2 & imp.getStackSize() != 3) {
		IJ.error("Wrong Image", "The stack has not a size of 2 or 3.\n" +
			"Image 1: The detected borders.\n" +
			"(Image 2: The unprocessed borders.)\n" +
			"Image 2(3): The original SR-EELS data.");
		return DONE;
	}
	input = imp;
	calibration = imp.getCalibration();
	if (showParameterDialog(command) == OK) {
		if (rotate) {
			final ImagePlus temp = input;
			input = new Duplicator().run(input, 1, input.getStackSize(), 1, 1, 1,
				1);
			temp.unlock();
			IJ.run(input, "Rotate 90 Degrees Right", "");
		}
		return FLAGS;
	}
	return DONE;
}
 
开发者ID:EFTEMj,项目名称:EFTEMj,代码行数:26,代码来源:SR_EELS_CorrectionOnlyPlugin.java


示例3: processExposureArray

import ij.plugin.Duplicator; //导入依赖的package包/类
private ImagePlus processExposureArray(final ImagePlus stack,
	final float[] exposureArray)
{
	final float[] exposureArrayNorm = new float[exposureArray.length];
	final float[] exposureArraySorted = Arrays.copyOf(exposureArray,
		exposureArray.length);
	Arrays.sort(exposureArraySorted);
	final float max = exposureArraySorted[exposureArraySorted.length - 1];
	for (int i = 0; i < exposureArray.length; i++) {
		exposureArrayNorm[i] = exposureArray[i] / max;
	}
	final ImagePlus imp = new Duplicator().run(stack, 1, stack.getStackSize());
	for (int i = 0; i < exposureArray.length; i++) {
		final float[] pixels = (float[]) imp.getStack().getPixels(i + 1);
		for (int j = 0; j < pixels.length; j++) {
			pixels[j] /= exposureArrayNorm[i];
		}
	}
	return imp;
}
 
开发者ID:EFTEMj,项目名称:EFTEMj,代码行数:21,代码来源:ElementalMapping.java


示例4: run

import ij.plugin.Duplicator; //导入依赖的package包/类
/**
 * @see ij.plugin.filter.PlugInFilter#run(ij.process.ImageProcessor)
 */
@Override
public void run(ImageProcessor ip)
{

	
	if (showDialog()){
		if (this.blackBackground) this.value = 0;
		if (this.useNew){
			/*ImageProcessor ip2 = ip.duplicate();
			new ImagePlus("Colored", ip2).show();
			ImagePlus tempImp = IJ.getImage();
			this.old = this.image;
			this.image = tempImp;
			this.roi = this.image.getRoi();
			process(ip2);
			coloredImp.updateAndDraw();*/
			this.image = new Duplicator().run(this.image);
			this.image.show();
		}
		this.roi = this.image.getRoi();

		// Convert to a color image.
		if (this.image.getType() != ImagePlus.COLOR_RGB){
			ImageConverter convert = new ImageConverter(this.image);
			convert.convertToRGB();
			IJ.log("Image type after conversion: " + this.image.getType());
		}

		// Get image properties.
		width = ip.getWidth();
		height = ip.getHeight();
		
		if (this.stack) process(this.image);
		else process(image.getStack().getProcessor(this.image.getCurrentSlice()));

		this.image.updateAndDraw();
	}
}
 
开发者ID:KevinWhalen,项目名称:neuron-processing,代码行数:42,代码来源:Color_Roi.java


示例5: run

import ij.plugin.Duplicator; //导入依赖的package包/类
public void run(ImageProcessor arg0)
{
	if (runCount < 1){
		IJ.log("Jeff: Start run Canny edge detector...");
		IJ.log("slice: " + this.imp.getSlice());

		if (this.imp.getStackSize() > 1){
			ImagePlus originalImage  = (ImagePlus) this.imp.clone();
			
			IJ.log("Copying slice: " + originalImage.getSlice());
			this.imp = new Duplicator().run(originalImage, originalImage.getSlice(), originalImage.getSlice());
			originalImage.hide();
			this.imp.show();
			
			sourceImage = imp;
			ProcessFindEdge(sourceImage);
			
			IJ.log("Overwriting slice: " + originalImage.getSlice());
			sourceImage.copy();
			originalImage.show();
			originalImage.paste();
			originalImage.close();
			sourceImage.close();
		} else {
			sourceImage = imp;
			ProcessFindEdge(sourceImage);
		}
		++runCount;
	}
}
 
开发者ID:KevinWhalen,项目名称:neuron-processing,代码行数:31,代码来源:Canny_Edge_Detector.java


示例6: loadSurfaceColorsFromImage

import ij.plugin.Duplicator; //导入依赖的package包/类
public void loadSurfaceColorsFromImage(ImagePlus imp) {
	final GeometryArray ga = (GeometryArray) getGeometry();
	if (ga == null) return;

	if (imp.getType() != ImagePlus.COLOR_RGB) {
		imp = new Duplicator().run(imp);
		new StackConverter(imp).convertToRGB();
	}
	final InterpolatedImage ii = new InterpolatedImage(imp);

	final int N = ga.getValidVertexCount();
	final Color3f[] colors = new Color3f[N];
	final Calibration cal = imp.getCalibration();
	final double pw = cal.pixelWidth;
	final double ph = cal.pixelHeight;
	final double pd = cal.pixelDepth;
	final Point3f coord = new Point3f();
	for (int i = 0; i < N; i++) {
		ga.getCoordinate(i, coord);
		final int v =
			(int) Math.round(ii.interpol.get(coord.x / pw, coord.y / ph, coord.z /
				pd));
		colors[i] =
			new Color3f(((v & 0xff0000) >> 16) / 255f, ((v & 0xff00) >> 8) / 255f,
				(v & 0xff) / 255f);
	}
	ga.setColors(0, colors);
	changed = true;
}
 
开发者ID:fiji,项目名称:3D_Viewer,代码行数:30,代码来源:CustomMesh.java


示例7: shiftImages

import ij.plugin.Duplicator; //导入依赖的package包/类
/**
 * All images of an {@link ImagePlus} stack are shifted by the given shift
 * values.
 *
 * @param initialStack {@link ImagePlus} containing a stack to be shifted
 * @param shift array of {@link Point}s that represent the shift of each
 *          image. This array will be modified if optimise is set
 *          <code>true</code>
 * @param mode The mode used for handling the borders that are created by
 *          translating the image
 * @param optimise true to optimise the given shift values
 * @param createNew true to create a new {@link ImagePlus} and keep the
 *          initial one untouched
 * @return a new {@link ImagePlus} that contains the shifted images
 */
public static ImagePlus shiftImages(final ImagePlus initialStack,
	final Point[] shift, final MODES mode, final boolean optimise,
	final boolean createNew)
{
	Point[] appliedShift;
	if (optimise == true) {
		appliedShift = optimizedImageShift(shift);
	}
	appliedShift = shift;
	ImagePlus correctedStack;
	if (createNew == true) {
		// you have to delete the roi otherwise only the roi is duplicated
		initialStack.deleteRoi();
		correctedStack = new Duplicator().run(initialStack);
		initialStack.restoreRoi();
	}
	else {
		correctedStack = initialStack;
	}
	correctedStack.setTitle(prefix.concat(initialStack.getTitle()));
	for (int i = 0; i < appliedShift.length; i++) {
		correctedStack.getStack().getProcessor(i + 1).translate(appliedShift[i].x,
			appliedShift[i].y);
		final String sliceLabel = correctedStack.getStack().getSliceLabel(i + 1);
		if (sliceLabel != null) {
			correctedStack.getStack().setSliceLabel(prefix.concat(sliceLabel), i +
				1);
		}

	}
	processBorder(correctedStack, appliedShift, mode);
	return correctedStack;
}
 
开发者ID:EFTEMj,项目名称:EFTEMj,代码行数:49,代码来源:OptimisedStackShifter.java


示例8: duplicate

import ij.plugin.Duplicator; //导入依赖的package包/类
private static ImagePlus duplicate(final ImagePlus imp) {
    final Duplicator duplicator = new Duplicator();
    return duplicator.run(imp);
}
 
开发者ID:ij-plugins,项目名称:ijp-toolkit,代码行数:5,代码来源:VectorProcessor.java


示例9: preprocess

import ij.plugin.Duplicator; //导入依赖的package包/类
/** 
 * Third'ish attempt.
 * Image preprocessing for cell segmentation.
 * Steps:
 *   Duplicate the image (twice, keep one as original and other as histo).
 *   Canny Edge detection on the duplicate image.
 *   Subtract background from duplicate.
 *   Add duplicate to the one to be histogrammed.
 *   Run histogram equalization (maybe via CLAHE or Enhance Contrast, or separate Equalize Histogram plugin?).
 *     http://svg.dmi.unict.it/iplab/imagej/Plugins/Forensics/Histogram%20Equalization/HistogramEqualization.html
 *
 *   blur and edge detect again.
*/
public void preprocess()
{
	this.impOriginal = IJ.getImage();
	this.stackSize = this.impOriginal.getStackSize();
	
	// Create a duplicate image, to be processed.
	this.imp = new Duplicator().run(this.impOriginal);
	//this.impHisto = new Duplicator().run(this.impOriginal);
	this.imp.show();
	this.impOriginal.hide();
	this.ip = this.imp.getProcessor();
	//this.is = this.imp.getImageStack();

	for (int i = 1; i <= this.stackSize; ++i){
		this.imp.setSlice(i);
		this.ip.setSliceNumber(i);
		//this.ip.findEdges();
		IJ.run(imp, "CED", "gaussian=2 low=2.5 high=7.5"); // Canny_Edge_Detector
	}

	IJ.run(this.imp, "Subtract Background...", "rolling=50 stack");
	
	ImageCalculator ic = new ImageCalculator();
	this.impOriginal.show();
	this.impHisto = ic.run("Add create stack", this.impOriginal, this.imp);
	this.impOriginal.hide();
	this.imp.hide();
	this.impHisto.show();
	this.ip = this.impHisto.getProcessor();

	String parameters = "blocksize=127 histogram=256 maximum=3 mask=*None* fast_(less_accurate)";
	for (int i = 1; i <= this.stackSize; ++i){
		this.impHisto.setSlice(i);
		this.ip.setSliceNumber(i);
		IJ.log("    current slice: " + this.impHisto.getCurrentSlice());
		
		// http://fiji.sc/Enhance_Local_Contrast_(CLAHE)
		IJ.run(this.impHisto, "Enhance Local Contrast (CLAHE)", parameters);
	}
	
	IJ.run(this.imp, "Bilateral Filter", "spatial=3 range=50");
	this.impSmooth = IJ.getImage();
	IJ.run(this.impSmooth, "Invert LUT", "");
	IJ.run(this.impSmooth, "Despeckle", "stack");
	IJ.run(this.impSmooth, "Invert", "stack");
	
	this.impOriginal.show();
	this.imp.show();
	this.impHisto.show();
	this.impSmooth.show();
	
	//IJ.showMessage("At the next prompt; select [Average Intensity], and remove the leading and trailing slices that do not include the neuron cells.");
	//IJ.run(imp, "Z Project...", "projection=[Average Intensity]");
	//IJ.run(imp, "Enhance Local Contrast (CLAHE)", "blocksize=127 histogram=256 maximum=3 mask=*None*");
	
	// http://homepages.inf.ed.ac.uk/rbf/HIPR2/pixmult.htm
}
 
开发者ID:KevinWhalen,项目名称:neuron-processing,代码行数:71,代码来源:Segmentation.java


示例10: showDialog

import ij.plugin.Duplicator; //导入依赖的package包/类
@Override
public int showDialog(final ImagePlus imp, final String command,
	final PlugInFilterRunner pfr)
{
	// I assume that the axis of the energy loss is the longer one.
	kernelRadius = (float) (0.5 * Math.ceil(2.0 * Math.min(imp.getWidth(), imp
		.getHeight()) / 200));
	maxCount = (int) Math.ceil(1.0 * Math.min(imp.getWidth(), imp.getHeight()) /
		75);
	localMaxRadius = (int) Math.floor(kernelRadius);
	linearFitIntervals = (int) Math.ceil(1.0 * Math.max(imp.getWidth(), imp
		.getHeight()) / 100);
	titlePrefix = command;
	logTool = new EFTEMjLogTool(command);
	input = imp;
	calibration = imp.getCalibration();
	inputTitle = imp.getTitle();
	String message;
	switch (showModeDialog(command)) {
		case AUTOMATIC:
			message = "Automatic SR-EELS correction has been selected.";
			logTool.println(message);
			IJ.showStatus(message);
			if (showParameterDialog(command) == CANCEL) {
				cancel();
				return DONE;
			}
			mode = AUTOMATIC;
			break;
		case MANUAL:
			message = "Manual SR-EELS correction has been selected.";
			logTool.println(message);
			IJ.showStatus(message);
			mode = MANUAL;
			break;
		default:
			cancel();
			return DONE;
	}
	if (rotate == true) {
		final ImagePlus temp = input;
		input = new Duplicator().run(input);
		temp.unlock();
		IJ.run(input, "Rotate 90 Degrees Right", "");
	}
	return FLAGS;
}
 
开发者ID:EFTEMj,项目名称:EFTEMj,代码行数:48,代码来源:SR_EELS_CorrectionPlugin.java


示例11: duplicate

import ij.plugin.Duplicator; //导入依赖的package包/类
/***
 * Since the object.clone for ImageJ only copies bare data (doesnt copy the
 * image properties as calibration, info, etc), one needs to use the
 * Duplicator method for this.
 * 
 * Reference:http://imagej.1557.x6.nabble.com/Copying-an-8-bit-image-
 * td3686474.html
 * 
 * @param sourceImage
 * @return ImagePlus a copy of the image
 */
protected ImagePlus duplicate(ImagePlus sourceImage) {
	return new Duplicator().run(sourceImage);
}
 
开发者ID:MarcoLotz,项目名称:HadoopLung,代码行数:15,代码来源:ImageProcessingClass.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java JFXDialogLayout类代码示例发布时间:2022-05-23
下一篇:
Java BatchOutputCollectorImpl类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap