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


Java FloatProcessor.getPixels方法代码示例

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


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

示例1: isLocalMax

import ij.process.FloatProcessor; //导入方法依赖的package包/类
private boolean isLocalMax (FloatProcessor Q, int u, int v) {
	if (u <= 0 || u >= M - 1 || v <= 0 || v >= N - 1) {
		return false;
	} 
	else {
		final float[] q = (float[]) Q.getPixels();
		final int i0 = (v - 1) * M + u;
		final int i1 = v * M + u;
		final int i2 = (v + 1) * M + u;
		final float q0 = q[i1];
		return	// check 8 neighbors of q0
			q0 >= q[i0 - 1] && q0 >= q[i0] && q0 >= q[i0 + 1] &&
			q0 >= q[i1 - 1] &&                q0 >= q[i1 + 1] && 
			q0 >= q[i2 - 1] && q0 >= q[i2] && q0 >= q[i2 + 1] ;
	}
}
 
开发者ID:imagingbook,项目名称:imagingbook-common,代码行数:17,代码来源:HarrisCornerDetector.java

示例2: rgbToFloatChannels

import ij.process.FloatProcessor; //导入方法依赖的package包/类
private FloatProcessor[] rgbToFloatChannels(ColorProcessor cp) {
	int w = cp.getWidth();
	int h = cp.getHeight();
	FloatProcessor rp = new FloatProcessor(w, h);
	FloatProcessor gp = new FloatProcessor(w, h);
	FloatProcessor bp = new FloatProcessor(w, h);
	int[] pixels = (int[]) cp.getPixels(); 
	float[] rpix = (float[]) rp.getPixels();
	float[] gpix = (float[]) gp.getPixels();
	float[] bpix = (float[]) bp.getPixels();
   	for (int i=0; i<pixels.length; i++) {
           int c = pixels[i];
           rpix[i] = (c&0xff0000)>>16;
   		gpix[i] = (c&0xff00)>>8;
		bpix[i] =  c&0xff;
   	}
   	return new FloatProcessor[] {rp, gp, bp};
}
 
开发者ID:imagingbook,项目名称:imagingbook-common,代码行数:19,代码来源:CannyEdgeDetector.java

示例3: normalize

import ij.process.FloatProcessor; //导入方法依赖的package包/类
/** normalize the pixels of a FloatProcessor to a given range. */
   static void normalize( FloatProcessor fp, 
double low, double high ) {

float [] data = (float [])fp.getPixels();

// find min and max
float min = Float.MAX_VALUE;
float max = Float.MIN_VALUE;
for ( float i : data ) {
	if (i<min) min = i;
	if (i>max) max = i;
    }

// scale
for (int i=0; i<data.length; i++) 
    data[i] = (float)
	((( data[i]-min )/( max-min )) * (high-low) + low);

// tell it to recalculate its display scaling
fp.resetMinAndMax();
   }
 
开发者ID:biophotonics-bielefeld,项目名称:ESI,代码行数:23,代码来源:ESI_Analysis.java

示例4: 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);
}
 
开发者ID:akmaier,项目名称:CONRAD,代码行数:21,代码来源:VolumeOfInterestPhantom.java

示例5: 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);
	for (int i=0; i< dimx; i++) {
		for (int j = 0; j< dimy; j++){
			double value = shepplogan.ImageDomainSignal(((float)((dimx/2) - i))/(dimx/2), 
					((float)((dimy/2) - j))/(dimy/2), 
					((float)((dimz/2) - k))/(dimz/2));
			current.putPixelValue(i, j, value);
		}
	}
	Grid2D grid = new Grid2D((float[])current.getPixels(), current.getWidth(), current.getHeight());
	this.imageBuffer.add(grid, k);
}
 
开发者ID:akmaier,项目名称:CONRAD,代码行数:19,代码来源:SheppLoganPhantomWorker.java

示例6: 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);
}
 
开发者ID:akmaier,项目名称:CONRAD,代码行数:17,代码来源:DiracProjectionPhantom.java

示例7: 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;
}
 
开发者ID:akmaier,项目名称:CONRAD,代码行数:27,代码来源:ExtremeValueTruncationFilter.java

示例8: makeCrf

import ij.process.FloatProcessor; //导入方法依赖的package包/类
private FloatProcessor makeCrf(float alpha) { //corner response function (CRF)
	FloatProcessor Q = new FloatProcessor(M, N);
	final float[] pA = (float[]) A.getPixels();
	final float[] pB = (float[]) B.getPixels();
	final float[] pC = (float[]) C.getPixels();
	final float[] pQ = (float[]) Q.getPixels();
	for (int i = 0; i < M * N; i++) {
		float a = pA[i], b = pB[i], c = pC[i];
		float det = a * b - c * c;
		float trace = a + b;
		pQ[i] = det - alpha * (trace * trace);
	}
	return Q;
}
 
开发者ID:imagingbook,项目名称:imagingbook-common,代码行数:15,代码来源:HarrisCornerDetector.java

示例9: createFrom

import ij.process.FloatProcessor; //导入方法依赖的package包/类
/**
 *This static method creates a 3-slice float-stack from a RGB image
 * @param imp the source (RGB) image.
 * @return an image stack consisting of 3 slices of type float.
 */
public static ImagePlus createFrom(ImagePlus imp) {
	if (imp.getType() != ImagePlus.COLOR_RGB)
		return null;
	ColorProcessor cp = (ColorProcessor) imp.getProcessor();
	int width = cp.getWidth();
	int height = cp.getHeight();
	ImageStack stack = new ImageStack(width, height);

	FloatProcessor rp = new FloatProcessor(width, height);
	FloatProcessor gp = new FloatProcessor(width, height);
	FloatProcessor bp = new FloatProcessor(width, height);
		
	int[] pixels = (int[]) cp.getPixels(); 
	float[] rf = (float[]) rp.getPixels();
	float[] gf = (float[]) gp.getPixels();
	float[] bf = (float[]) bp.getPixels();
   	for (int i=0; i<pixels.length; i++) {
           int c = pixels[i];
           int r = (c&0xff0000)>>16;
   		int g = (c&0xff00)>>8;
   		int b = c&0xff;
   		rf[i] = r / 255f;
   		gf[i] = g / 255f;
   		bf[i] = b / 255f;
   	}
	stack.addSlice(rp);
	stack.addSlice(gp);
	stack.addSlice(bp);
   	ImagePlus cimp = new ImagePlus(imp.getTitle(), stack);
   	//cimp.setProperty(ColorStackType.class.getSimpleName(), ColorStackType.sRGB);
   	setType(cimp, ColorStackType.sRGB);
	return cimp;
}
 
开发者ID:imagingbook,项目名称:imagingbook-common,代码行数:39,代码来源:ColorStack.java

示例10: subtract

import ij.process.FloatProcessor; //导入方法依赖的package包/类
public ScaleLevel subtract(FloatProcessor B) {
	// A <-- A-B
	ScaleLevel A = this.duplicate();
	float[] pixelsA = (float[]) A.getPixels();
	float[] pixelsB = (float[]) B.getPixels();
	for (int i=0; i<pixelsA.length; i++) {
		pixelsA[i] = pixelsA[i] - pixelsB[i];
	}
	A.setAbsoluteScale(0);
	return A;
}
 
开发者ID:imagingbook,项目名称:imagingbook-common,代码行数:12,代码来源:ScaleLevel.java

示例11: SME_ENS_Projection_Min_Intensity

import ij.process.FloatProcessor; //导入方法依赖的package包/类
/** Simple constructor since no preprocessing is necessary. */
public SME_ENS_Projection_Min_Intensity(FloatProcessor fp) {
    fpixels = (float[])fp.getPixels();
    len = fpixels.length;
    for (int i=0; i<len; i++)
        fpixels[i] = Float.MAX_VALUE;
}
 
开发者ID:biocompibens,项目名称:SME,代码行数:8,代码来源:SME_ENS_Projection_Min_Intensity.java

示例12: SME_ENS_Projection_Max_Intensity

import ij.process.FloatProcessor; //导入方法依赖的package包/类
/** Simple constructor since no preprocessing is necessary. */
public SME_ENS_Projection_Max_Intensity(FloatProcessor fp) {
    fpixels = (float[])fp.getPixels();
    len = fpixels.length;
    for (int i=0; i<len; i++)
        fpixels[i] = -Float.MAX_VALUE;
}
 
开发者ID:biocompibens,项目名称:SME,代码行数:8,代码来源:SME_ENS_Projection_Max_Intensity.java

示例13: SME_ENS_Projection_Sum_Intensity

import ij.process.FloatProcessor; //导入方法依赖的package包/类
/** Simple constructor since no preprocessing is necessary. */
public SME_ENS_Projection_Sum_Intensity(FloatProcessor fp) {
    fpixels = (float[])fp.getPixels();
    len = fpixels.length;
    for (int i=0; i<len; i++)
        fpixels[i] = -Float.MAX_VALUE;
}
 
开发者ID:biocompibens,项目名称:SME,代码行数:8,代码来源:SME_ENS_Projection_Sum_Intensity.java

示例14: MaxIntensity

import ij.process.FloatProcessor; //导入方法依赖的package包/类
/** Simple constructor since no preprocessing is necessary. */
public MaxIntensity(FloatProcessor fp) {
	fpixels = (float[])fp.getPixels();
	len = fpixels.length;
	for (int i=0; i<len; i++)
		fpixels[i] = -Float.MAX_VALUE;
}
 
开发者ID:biocompibens,项目名称:SME,代码行数:8,代码来源:ZProjector.java

示例15: MinIntensity

import ij.process.FloatProcessor; //导入方法依赖的package包/类
/** Simple constructor since no preprocessing is necessary. */
public MinIntensity(FloatProcessor fp) {
	fpixels = (float[])fp.getPixels();
	len = fpixels.length;
	for (int i=0; i<len; i++)
		fpixels[i] = Float.MAX_VALUE;
}
 
开发者ID:biocompibens,项目名称:SME,代码行数:8,代码来源:ZProjector.java


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