本文整理汇总了Java中ij.process.FloatProcessor.setPixels方法的典型用法代码示例。如果您正苦于以下问题:Java FloatProcessor.setPixels方法的具体用法?Java FloatProcessor.setPixels怎么用?Java FloatProcessor.setPixels使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ij.process.FloatProcessor
的用法示例。
在下文中一共展示了FloatProcessor.setPixels方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: applyToolToImage
import ij.process.FloatProcessor; //导入方法依赖的package包/类
@Override
public Grid2D applyToolToImage(Grid2D imageProcessor) throws Exception {
FloatProcessor imp = new FloatProcessor(imageProcessor.getWidth(),imageProcessor.getHeight());
imp.setPixels(imageProcessor.getBuffer());
ImageProcessor imp1 = imp.duplicate(); // original
SimpleMatrix mat = config.getGeometry().getProjectionMatrix(imageIndex).computeP();
double [][] KinectDots3D = {{10, 10, 10}, {50, 50, 50}, {-20, -20, -20}}; // [beadNo][x,y,z]
double [] uv = new double[1];
for (int i=0; i< KinectDots3D.length; i++){
if (KinectDots3D[i][0] != 0 || KinectDots3D[i][1] != 0 || KinectDots3D[i][2] != 0){
uv = compute2DCoordinates(KinectDots3D[i], mat);
if (isDisplay) {
imp1.setValue(2);
imp1.drawLine((int) Math.round(uv[0]-10), (int) Math.round(uv[1]-10), (int) Math.round(uv[0]+10), (int) Math.round(uv[1]+10));
imp1.drawLine((int) Math.round(uv[0]-10), (int) Math.round(uv[1]+10), (int) Math.round(uv[0]+10), (int) Math.round(uv[1]-10));
}
}
}
if (isDisplay) {
for (int x=0; x< config.getGeometry().getDetectorWidth(); x+=100)
imp1.drawLine(x, 0, x, config.getGeometry().getDetectorHeight());
for (int y=0; y< config.getGeometry().getDetectorHeight(); y+=100)
imp1.drawLine(0, y, config.getGeometry().getDetectorWidth(), y);
}
Grid2D result = new Grid2D((float[]) imp1.getPixels(), imp1.getWidth(), imp1.getHeight());
return result;
}
示例2: applyToolToImage
import ij.process.FloatProcessor; //导入方法依赖的package包/类
@Override
public Grid2D applyToolToImage(Grid2D imageProcessor) {
FloatProcessor in = new FloatProcessor(imageProcessor.getWidth(), imageProcessor.getHeight());
in.setPixels(imageProcessor.getBuffer());
FloatProcessor left = (FloatProcessor) in.rotateLeft();
Grid2D out = new Grid2D((float[])left.getPixels(), left.getWidth(), left.getHeight());
return out;
}
示例3: applyToolToImage
import ij.process.FloatProcessor; //导入方法依赖的package包/类
@Override
public Grid2D applyToolToImage(Grid2D image)
throws Exception {
FloatProcessor imageProcessor = new FloatProcessor(image.getWidth(), image.getHeight());
imageProcessor.setPixels(image.getBuffer());
ImageProcessor currentOperand = null;
if(operand == null){
open();
}
if (operand.getStackSize() > 1) {
currentOperand = operand.getStack().getProcessor(imageIndex + 1);
} else {
currentOperand = operand.getChannelProcessor();
}
ImageProcessor revan = null;
if (operation.equals(MULTIPLY)) {
revan = ImageUtil.multiplyImages(imageProcessor, currentOperand);
}
if (operation.equals(DIVIDE)) {
revan = ImageUtil.divideImages(imageProcessor, currentOperand);
}
if (operation.equals(SUBTRACT)) {
currentOperand = currentOperand.duplicate();
currentOperand.multiply(-1);
ImageUtil.addProcessors(currentOperand, imageProcessor);
revan = currentOperand;
}
if (operation.equals(ADD)) {
currentOperand = currentOperand.duplicate();
ImageUtil.addProcessors(currentOperand, imageProcessor);
revan = currentOperand;
}
Grid2D result = new Grid2D((float[])revan.getPixels(), image.getWidth(), image.getHeight());
return result;
}
示例4: applyToolToImage
import ij.process.FloatProcessor; //导入方法依赖的package包/类
@Override
public Grid2D applyToolToImage(Grid2D imageProcessor) {
FloatProcessor fl = new FloatProcessor(imageProcessor.getWidth(), imageProcessor.getHeight());
fl.setPixels(imageProcessor.getBuffer());
fl.snapshot();
sharpenFloat(fl, sigma, (float) weight);
return imageProcessor;
}
示例5: applyToolToImage
import ij.process.FloatProcessor; //导入方法依赖的package包/类
@Override
public Grid2D applyToolToImage(Grid2D imageProcessor)
throws Exception {
FloatProcessor revan = new FloatProcessor(imageProcessor.getWidth(), imageProcessor.getHeight());
revan.setPixels(imageProcessor.getBuffer());
if (operation.equals(MULTIPLY)) {
revan.multiply(operand);
}
if (operation.equals(DIVIDE)) {
revan.multiply(1.0 / operand);
}
if (operation.equals(SUBTRACT)) {
revan.add(-operand);
}
if (operation.equals(ADD)) {
revan.add(operand);
}
if (operation.equals(LOGARITHM)) {
revan.log();
}
if (operation.equals(SQUARE)) {
revan.sqr();
}
if (operation.equals(SQUAREROOT)) {
revan.sqrt();
}
return imageProcessor;
}
示例6: applyToolToImage
import ij.process.FloatProcessor; //导入方法依赖的package包/类
@Override
public Grid2D applyToolToImage(Grid2D imageProcessor) {
FloatProcessor revan = new FloatProcessor(imageProcessor.getWidth(), imageProcessor.getHeight());
revan.setPixels(imageProcessor.getBuffer());
if (!twoD){
float [] kernel = designKernel(nTimes);
if (horizontal)
revan.convolve(kernel, kernel.length, 1);
else
revan.convolve(kernel, 1, kernel.length);
revan.multiply(0.5/Configuration.getGlobalConfiguration().getGeometry().getPixelDimensionX());
} else {
FloatProcessor xDerivative = (FloatProcessor) revan.duplicate();
xDerivative.convolve(designKernelX(), nTimes, nTimes);
xDerivative.multiply(0.5/Configuration.getGlobalConfiguration().getGeometry().getPixelDimensionX());
xDerivative.sqr();
FloatProcessor yDerivative = (FloatProcessor) revan.duplicate();
yDerivative.convolve(designKernelY(), nTimes, nTimes);
yDerivative.sqr();
yDerivative.multiply(0.5/Configuration.getGlobalConfiguration().getGeometry().getPixelDimensionY());
ImageUtil.addProcessors(xDerivative, yDerivative);
xDerivative.sqrt();
revan = xDerivative;
}
Grid2D result = new Grid2D((float[]) revan.getPixels(), revan.getWidth(), revan.getHeight());
return result;
}