本文整理汇总了Java中ij.process.FloatProcessor.putPixelValue方法的典型用法代码示例。如果您正苦于以下问题:Java FloatProcessor.putPixelValue方法的具体用法?Java FloatProcessor.putPixelValue怎么用?Java FloatProcessor.putPixelValue使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ij.process.FloatProcessor
的用法示例。
在下文中一共展示了FloatProcessor.putPixelValue方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: copyResultToImage
import ij.process.FloatProcessor; //导入方法依赖的package包/类
private void copyResultToImage(float[][] imgData, ImageProcessor ip) {
if (ip instanceof FloatProcessor) {
FloatProcessor cp = (FloatProcessor) ip;
for (int v = 0; v < N; v++) {
for (int u = 0; u < M; u++) {
cp.putPixelValue(u, v, imgData[u][v]);
}
}
}
else {
for (int v = 0; v < N; v++) {
for (int u = 0; u < M; u++) {
ip.putPixel(u, v, (int) Math.round(imgData[u][v]));
}
}
}
}
示例2: run
import ij.process.FloatProcessor; //导入方法依赖的package包/类
public static FloatProcessor run(final VectorProcessor vp) {
final int width = vp.getWidth();
final int height = vp.getHeight();
final FloatProcessor dest = new FloatProcessor(width, height);
final Rectangle roi = new Rectangle(1, 1, width - 2, height - 2);
vp.setRoi(roi);
final VectorProcessor.Iterator iterator = vp.iterator();
while (iterator.hasNext()) {
final VectorProcessor.Neighborhood3x3 vn = iterator.next();
double d = VectorMath.distance(vn.p1, vn.p6);
d = Math.max(d, VectorMath.distance(vn.p2, vn.p7));
d = Math.max(d, VectorMath.distance(vn.p3, vn.p8));
d = Math.max(d, VectorMath.distance(vn.p4, vn.p9));
dest.putPixelValue(vn.x, vn.y, d);
}
return dest;
}
示例3: showImage
import ij.process.FloatProcessor; //导入方法依赖的package包/类
public static void showImage(
final String title,
final double [] array,
final int Ydim,
final int Xdim
) {
final FloatProcessor fp=new FloatProcessor(Xdim,Ydim);
int ij=0;
for (int i=0; i<Ydim; i++)
for (int j=0; j<Xdim; j++, ij++)
fp.putPixelValue(j,i,array[ij]);
fp.resetMinAndMax();
final ImagePlus ip=new ImagePlus(title, fp);
final ImageWindow iw=new ImageWindow(ip);
ip.updateImage();
}
示例4: visualizeBufferedArrays
import ij.process.FloatProcessor; //导入方法依赖的package包/类
/**
* Displays the arrays stored with "saveForVisualization" as ImagePlus.
* @param title the title of the ImagePlus
* @return the reference to the ImagePlus
*
* @see #saveForVisualization(int imageNumber, float [] array)
*/
public static ImagePlus visualizeBufferedArrays(String title){
if (max >= 0) {
int height = max+1;
int width = arrayBuffer.get(new Integer(0)).length;
FloatProcessor flo = new FloatProcessor(width, height);
for (int j = 0; j <= max; j++){
float [] array = arrayBuffer.get(new Integer(j));
for (int i = 0; i < array.length; i++){
flo.putPixelValue(i, max - j, array[i]);
}
}
return VisualizationUtil.showImageProcessor(flo, title);
} else {
return null;
}
}
示例5: showImage
import ij.process.FloatProcessor; //导入方法依赖的package包/类
/**
* Show an image in a new bUnwarpJ window.
*
* @param title image title
* @param array image in a double array
* @param Ydim image height
* @param Xdim image width
*/
public static void showImage(
final String title,
final double [] array,
final int Ydim,
final int Xdim)
{
final FloatProcessor fp=new FloatProcessor(Xdim,Ydim);
int ij=0;
for (int i=0; i<Ydim; i++)
for (int j=0; j<Xdim; j++, ij++)
fp.putPixelValue(j,i,array[ij]);
fp.resetMinAndMax();
final ImagePlus ip=new ImagePlus(title, fp);
ip.updateImage();
ip.show();
}
示例6: applyToolToImage
import ij.process.FloatProcessor; //导入方法依赖的package包/类
@Override
public Grid2D applyToolToImage(Grid2D imageProcessor)
throws Exception {
FloatProcessor revan = new FloatProcessor(imageProcessor.getWidth(), imageProcessor.getHeight(), imageProcessor.getBuffer());
revan.setInterpolationMethod(ImageProcessor.BICUBIC);
for(int y = 0; y < revan.getHeight(); y++){
for(int x = 0; x < revan.getWidth();x++){
if(Double.isNaN(revan.getPixelValue(x, y))){
revan.putPixelValue(x, y, 0);
revan.putPixelValue(x, y, revan.getInterpolatedPixel(x, y));
}
if (operation.equals(MIN) && revan.getPixelValue(x, y)< threshold) {
revan.putPixelValue(x, y, threshold);
}
else if (operation.equals(MAX) && revan.getPixelValue(x, y)>threshold) {
revan.putPixelValue(x, y, threshold);
}
}
}
Grid2D out = new Grid2D((float[])revan.getPixels(), revan.getWidth(), revan.getHeight());
out.setOrigin(imageProcessor.getOrigin());
out.setSpacing(imageProcessor.getSpacing());
return out;
}
示例7: workOnSlice
import ij.process.FloatProcessor; //导入方法依赖的package包/类
@Override
public void workOnSlice(int k) {
Trajectory traj = Configuration.getGlobalConfiguration().getGeometry();
int dimx = traj.getReconDimensionX();
int dimy = traj.getReconDimensionY();
int dimz = traj.getReconDimensionZ();
FloatProcessor current = new FloatProcessor(dimx, dimy);
double offsetX = (dimx /2) * geometry.getVoxelSpacingX();
double offsetY = (dimy /2) * geometry.getVoxelSpacingY();
double offsetZ = (dimz /2) * geometry.getVoxelSpacingZ();
for (int i=0; i< dimx; i++) {
for (int j = 0; j< dimy; j++){
double value = 0;
if (voi.contains((this.geometry.getVoxelSpacingX() * i) - offsetX, (this.geometry.getVoxelSpacingY() * j) - offsetY, (this.geometry.getVoxelSpacingZ() * k) - offsetZ)) value = 1;
current.putPixelValue(i, j, value);
}
}
Grid2D grid = new Grid2D((float[])current.getPixels(), current.getWidth(), current.getHeight());
this.imageBuffer.add(grid, k);
}
示例8: upsampleProjection
import ij.process.FloatProcessor; //导入方法依赖的package包/类
/**
*
* @param ip the downsampled projection image
* @return the upsampled image
*/
private ImageProcessor upsampleProjection(ImageProcessor ip)
{
//int nOrigW = ip.getWidth();
//int nOrigH = ip.getHeight();
int nDestW = modulationFunction.getWidth();
int nDestH = modulationFunction.getHeight();
float x=0;
float y=0;
FloatProcessor fP = new FloatProcessor(nDestW,nDestH);
for(int i=0;i<nDestH;i++){
for(int j=0;j<nDestW;j++){
x = upsampIdxX.getPixelValue(j, i);
y = upsampIdxY.getPixelValue(j, i);
fP.putPixelValue(j, i, ip.getInterpolatedValue(x, y));
}
}
return fP;
}
示例9: workOnSlice
import ij.process.FloatProcessor; //导入方法依赖的package包/类
@Override
public void workOnSlice(int k){
Trajectory traj = Configuration.getGlobalConfiguration().getGeometry();
int dimx = traj.getReconDimensionX();
int dimy = traj.getReconDimensionY();
FloatProcessor fl = new FloatProcessor(dimx, dimy);
int width = fl.getWidth();
int height = fl.getHeight();
for (int j = 0; j < height; j++){
for (int i = 0; i < width; i++) {
fl.putPixelValue(i, j, (1.0 - (Math.abs((0.0 + height / 2) - j) / (height / 2))) * diracFunction(i - (width/2) - k, alpha));
}
}
Grid2D grid = new Grid2D((float[])fl.getPixels(), fl.getWidth(), fl.getHeight());
this.imageBuffer.add(grid, k);
}
示例10: downsampleProjection
import ij.process.FloatProcessor; //导入方法依赖的package包/类
/**
*
* @param ip the original projection image
* @return the downsampled image
*/
private ImageProcessor downsampleProjection(ImageProcessor ip)
{
if(blkIdxX==null) return null;
int nW = blkIdxX.getWidth();
int nH = blkIdxX.getHeight();
FloatProcessor dsIp = new FloatProcessor(nW, nH);
double val = 0;
for (int i=0;i<nW;i++)
{
for(int j=0;j<nH;j++)
{
val = ip.getInterpolatedValue(blkIdxX.getPixelValue(i, j), blkIdxY.getPixelValue(i, j));
dsIp.putPixelValue(i, j, val);
}
}
return dsIp;
}
示例11: visualizeBufferedArrays
import ij.process.FloatProcessor; //导入方法依赖的package包/类
/**
* Displays the arrays stored with "saveForVisualization" as ImagePlus.
* @param title the title of the ImagePlus
* @return the reference to the ImagePlus
*
* @see #saveForVisualization(int imageNumber, double [] array)
*/
public static ImagePlus visualizeBufferedArrays(String title){
if (max >= 0) {
int height = max+1;
int width = arrayBuffer.get(new Integer(0)).length;
FloatProcessor flo = new FloatProcessor(width, height);
for (int j = 0; j <= max; j++){
double [] array = arrayBuffer.get(new Integer(j));
for (int i = 0; i < array.length; i++){
flo.putPixelValue(i, max - j, array[i]);
}
}
return VisualizationUtil.showImageProcessor(flo, title);
} else {
return null;
}
}
示例12: reconstructOffline
import ij.process.FloatProcessor; //导入方法依赖的package包/类
public void reconstructOffline(ImagePlus imagePlus) throws Exception {
ImagePlusDataSink sink = new ImagePlusDataSink();
configure();
init();
for (int i = 0; i < imagePlus.getStackSize(); i++){
backproject(ImageUtil.wrapImageProcessor(imagePlus.getStack().getProcessor(i+1)), i);
}
waitForResult();
if (Configuration.getGlobalConfiguration().getUseHounsfieldScaling()) applyHounsfieldScaling();
//int [] size = projectionVolume.getSize();
//System.out.println(size [0] + " " + size [1] + " " + size[2]);
for (int k = 0; k < projectionVolume.getSize()[2]; k++){
FloatProcessor fl = new FloatProcessor(projectionVolume.getSize()[0], projectionVolume.getSize()[1]);
for (int j = 0; j< projectionVolume.getSize()[1]; j++){
for (int i = 0; i< projectionVolume.getSize()[0]; i++){
fl.putPixelValue(i, j, projectionVolume.getAtIndex(i, j, k));
}
}
sink.process(projectionVolume.getSubGrid(k), k);
}
sink.close();
ImagePlus revan = ImageUtil.wrapGrid3D(sink.getResult(), "Reconstruction of " + imagePlus.getTitle());
revan.setTitle(imagePlus.getTitle() + " reconstructed");
revan.show();
}
示例13: run
import ij.process.FloatProcessor; //导入方法依赖的package包/类
public static FloatProcessor run(final VectorProcessor vp) {
final int width = vp.getWidth();
final int height = vp.getHeight();
final FloatProcessor dest = new FloatProcessor(width, height);
final Rectangle roi = new Rectangle(1, 1, width - 2, height - 2);
vp.setRoi(roi);
final VectorProcessor.Iterator iterator = vp.iterator();
while (iterator.hasNext()) {
final VectorProcessor.Neighborhood3x3 vn = iterator.next();
double d = VectorMath.distance(vn.p1, vn.p5);
d = Math.max(d, VectorMath.distance(vn.p2, vn.p5));
d = Math.max(d, VectorMath.distance(vn.p3, vn.p5));
d = Math.max(d, VectorMath.distance(vn.p4, vn.p5));
d = Math.max(d, VectorMath.distance(vn.p6, vn.p5));
d = Math.max(d, VectorMath.distance(vn.p7, vn.p5));
d = Math.max(d, VectorMath.distance(vn.p8, vn.p5));
d = Math.max(d, VectorMath.distance(vn.p9, vn.p5));
dest.putPixelValue(vn.x, vn.y, d);
}
return dest;
}
示例14: convertToFloatProcessor
import ij.process.FloatProcessor; //导入方法依赖的package包/类
public static FloatProcessor convertToFloatProcessor(GrayScaleImage img) {
FloatProcessor fp = new FloatProcessor(img.getWidth(), img.getHeight());
for (int r = 0; r < fp.getHeight(); r++) {
for (int c = 0; c < fp.getWidth(); c++) {
fp.putPixelValue(c, r, img.getValue(r, c));
}
}
return fp;
}
示例15: run
import ij.process.FloatProcessor; //导入方法依赖的package包/类
/*********************************************************************
* Perform the registration
********************************************************************/
public void run (
) {
// Create output image
int Ydimt=target.getHeight();
int Xdimt=target.getWidth();
int Xdims=source.getWidth();
final FloatProcessor fp=new FloatProcessor(Xdimt,Ydimt);
for (int i=0; i<Ydimt; i++)
for (int j=0; j<Xdimt; j++)
if (sourceMsk.getValue(j,i) && targetMsk.getValue(j,i))
fp.putPixelValue(j,i,(target.getImage())[i*Xdimt+j]-
(source.getImage())[i*Xdims+j]);
else fp.putPixelValue(j,i,0);
fp.resetMinAndMax();
final ImagePlus ip=new ImagePlus("Output", fp);
final ImageWindow iw=new ImageWindow(ip);
ip.updateImage();
// Perform the registration
final unwarpJTransformation warp = new unwarpJTransformation(
sourceImp, targetImp, source, target, sourcePh, targetPh,
sourceMsk, targetMsk, min_scale_deformation, max_scale_deformation,
min_scale_image, divWeight, curlWeight, landmarkWeight, imageWeight,
stopThreshold, outputLevel, showMarquardtOptim, accurate_mode,
dialog.isSaveTransformationSet(), "", ip, dialog);
warp.doRegistration();
dialog.ungrayImage(sourcePh.getPointAction());
dialog.ungrayImage(targetPh.getPointAction());
dialog.restoreAll();
dialog.freeMemory();
}