本文整理汇总了Java中ij.process.FloatProcessor.getHeight方法的典型用法代码示例。如果您正苦于以下问题:Java FloatProcessor.getHeight方法的具体用法?Java FloatProcessor.getHeight怎么用?Java FloatProcessor.getHeight使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ij.process.FloatProcessor
的用法示例。
在下文中一共展示了FloatProcessor.getHeight方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getVariance
import ij.process.FloatProcessor; //导入方法依赖的package包/类
public static double getVariance(FloatProcessor ip) {
final int W = ip.getWidth();
final int H = ip.getHeight();
final int N = W * H;
final double mean = getMean(ip);
double sum = 0;
for (int j = 0; j < H; j++) {
for (int i = 0; i < W; i++) {
double d = ip.getf(i, j) - mean;
sum = sum + d * d;
}
}
return sum / N;
}
示例2: getVariance2
import ij.process.FloatProcessor; //导入方法依赖的package包/类
public static double getVariance2(FloatProcessor ip) {
final int W = ip.getWidth();
final int H = ip.getHeight();
final int N = W * H;
double sumX = 0;
double sumX2 = 0;
for (int j = 0; j < H; j++) {
for (int i = 0; i < W; i++) {
double x = ip.getf(i, j);
sumX = sumX + x;
sumX2 = sumX2 + x * x;
}
}
double var = (sumX2 - sumX * sumX / N) / N ;
return var;
}
示例3: imposeMaxima
import ij.process.FloatProcessor; //导入方法依赖的package包/类
public static void imposeMaxima(final FloatProcessor fp, final ImageProcessor ipMask) {
final ImageProcessor fpOrig = fp.duplicate();
final ImageStatistics stats = fp.getStatistics();
final int w = fp.getWidth();
final int h = fp.getHeight();
for (int i = 0; i < w * h; i++) {
if (ipMask.getf(i) == 0)
fp.setf(i, Float.NEGATIVE_INFINITY);
else
fp.setf(i, Float.POSITIVE_INFINITY);
}
fpOrig.copyBits(fp, 0, 0, Blitter.MAX);
morphologicalReconstruction(fp, fpOrig);
for (int i = 0; i < w * h; i++) {
if (ipMask.getf(i) != 0)
fp.setf(i, (float)stats.max);
}
}
示例4: 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;
}
示例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();
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);
}
示例6: GetMeanofDownSampledModFun
import ij.process.FloatProcessor; //导入方法依赖的package包/类
/**
*
* @param fp the downsampled modulation function
* @return the mean value of the modulation function
*/
private double GetMeanofDownSampledModFun(FloatProcessor fp){
if(dsModFunMean!=0)
return dsModFunMean;
if(fp==null) {
dsModFunMean = 0;
return 0;
}
int nDsW = fp.getWidth();
int nDsH = fp.getHeight();
double dMean = 0;
for (int i=0;i<nDsH;i++){
for (int j=0;j<nDsW;j++){
dMean += fp.getPixelValue(j, i);
}
}
dsModFunMean = dMean/(nDsW*nDsH);
return dsModFunMean;
}
示例7: LucasKanadeMatcher
import ij.process.FloatProcessor; //导入方法依赖的package包/类
/**
* Creates a new Lucas-Kanade-type matcher.
* @param I the search image (of type {@link FloatProcessor}).
* @param R the reference image (of type {@link FloatProcessor})
* @param params a parameter object of type {@link LucasKanadeMatcher.Parameters}.
*/
protected LucasKanadeMatcher(FloatProcessor I, FloatProcessor R, Parameters params) {
this.I = I; // search image
this.R = R; // reference image
this.params = params;
wR = R.getWidth();
hR = R.getHeight();
xc = 0.5 * (wR - 1);
yc = 0.5 * (hR - 1);
}
示例8: getMatch
import ij.process.FloatProcessor; //导入方法依赖的package包/类
public float[][] getMatch(FloatProcessor R) {
this.R = R;
this.MR = R.getWidth();
this.NR = R.getHeight();
this.K = MR * NR;
// calculate the mean and variance of template
double sumR = 0;
double sumR2 = 0;
for (int j = 0; j < NR; j++) {
for (int i = 0; i < MR; i++) {
float aR = R.getf(i,j);
sumR += aR;
sumR2 += aR * aR;
}
}
this.meanR = sumR / K;
this.varR = Math.sqrt(sumR2 - K * meanR * meanR);
float[][] C = new float[MI - MR + 1][NI - NR + 1];
for (int r = 0; r <= MI - MR; r++) {
for (int s = 0; s <= NI - NR; s++) {
float d = (float) getMatchValue(r, s);
C[r][s] = d;
}
}
this.R = null;
return C;
}
示例9: getMean
import ij.process.FloatProcessor; //导入方法依赖的package包/类
public static double getMean(FloatProcessor ip) {
final int W = ip.getWidth();
final int H = ip.getHeight();
final int N = W * H;
double sum = 0;
for (int j = 0; j < H; j++) {
for (int i = 0; i < W; i++) {
sum = sum + ip.getf(i, j);
}
}
return sum / N;
}
示例10: makeEyeTrackHeatmap
import ij.process.FloatProcessor; //导入方法依赖的package包/类
private BufferedImage makeEyeTrackHeatmap() {
long time = 0;
ImagePlus imp;
FloatProcessor ip = new FloatProcessor(viewer.getThumbnail().getWidth(), viewer.getThumbnail().getHeight());
Point2D[] eyeArray = trackerFeatures.getEyeArray();
for (int i = 0; i < eyeArray.length; i++) {
progressBarFrame.setCurrentFrame(i);
setProgress((int) ((double) (i * 100) / (double)totalTasks));
if (eyeArray[i] != null) {
if (i == 0) {
time = trackerFeatures.getTracker().getFrame(i).getTimestamp();
} else {
time = trackerFeatures.getTracker().getFrame(i).getTimestamp() - time;
}
int x = (int) (eyeArray[i].getX()*scalex);
int y = (int) (eyeArray[i].getY()*scaley);
if(x > 0 && y > 0 && x < ip.getWidth() && y < ip.getHeight())
ip.setf(x, y, ip.getf(x, y) + 100);
}
}
ip.blurGaussian(25);
imp = new ImagePlus("Eye heatmap", ip);
IJ.run(imp, "Fire", "");
return imp.getBufferedImage();
}
示例11: generate
import ij.process.FloatProcessor; //导入方法依赖的package包/类
public void generate(FloatProcessor img) {
double [] params = new double[molecule.values.length];
for(int i = 0; i < params.length; i++) {
params[i] = molecule.values[i];
}
//
int width = img.getWidth(), height = img.getHeight();
for(int x = (int)(molecule.getX() - region), xm = (int)(molecule.getX() + region); x <= xm; x++) {
if((x < 0) || (x >= width)) continue;
for(int y = (int)(molecule.getY() - region), ym = (int)(molecule.getY() + region); y <= ym; y++) {
if((y < 0) || (y >= height)) continue;
img.setf(x, y, img.getf(x, y) + (float)model.getValue(params, x+0.5, y+0.5));
}
}
}
示例12: generateBackground
import ij.process.FloatProcessor; //导入方法依赖的package包/类
public FloatProcessor generateBackground(int width, int height, Drift drift, Range bkg) {
// padd the background image; crop the center of the image later, after the drift is applied
FloatProcessor img = new FloatProcessor(width + 2*(int)ceil(drift.dist), height + 2*(int)ceil(drift.dist));
for(int x = 0, w = img.getWidth(); x < w; x++)
for(int y = 0, h = img.getHeight(); y < h; y++)
img.setf(x, y, (float)getNextUniform(bkg.from, bkg.to));
IFilter filter = new BoxFilter(1+2*(int)(((double)Math.min(width, width))/8.0));
return filter.filterImage(img);
}
示例13: relNeq
import ij.process.FloatProcessor; //导入方法依赖的package包/类
public static FloatProcessor relNeq(Double val, FloatProcessor mat) {
float v = val.floatValue();
FloatProcessor res = new FloatProcessor(mat.getWidth(), mat.getHeight());
res.setMask(mat.getMask());
for(int x = 0; x < mat.getWidth(); x++) {
for(int y = 0; y < mat.getHeight(); y++) {
res.setf(x, y, ((mat.getf(x, y) != v) ? 1.0f : 0.0f));
}
}
return res;
}
示例14: add
import ij.process.FloatProcessor; //导入方法依赖的package包/类
/**
* Add two images.
*
* The images are required to be of the same size.
*
* @param fp1 an input image which the other input image ({@code fp2}) will be added to
* @param fp2 another input image which will be added to {@code fp1}
* @return a <strong>new instance</strong> of FloatProcessor: {@mathjax fp3 = fp1 + fp2}
*/
public static FloatProcessor add(FloatProcessor fp1, FloatProcessor fp2) {
assert (fp1.getWidth() == fp2.getWidth());
assert (fp1.getHeight() == fp2.getHeight());
FloatProcessor out = new FloatProcessor(fp1.getWidth(), fp1.getHeight());
out.setMask(fp1.getMask() != null ? fp1.getMask(): fp2.getMask());
for (int i = 0, im = fp1.getWidth(); i < im; i++) {
for (int j = 0, jm = fp1.getHeight(); j < jm; j++) {
out.setf(i, j, fp1.getPixelValue(i, j) + fp2.getPixelValue(i, j));
}
}
return out;
}
示例15: subtract
import ij.process.FloatProcessor; //导入方法依赖的package包/类
/**
* Subtract one image to the other.
*
* The images are required to be of the same size.
*
* @param fp1 an input image which the other input image ({@code fp2}) will be subtracted from
* @param fp2 another input image which will be subtracted from {@code fp1}
* @return a <strong>new instance</strong> of FloatProcessor: {@mathjax fp3 = fp1 - fp2}
*/
public static FloatProcessor subtract(FloatProcessor fp1, FloatProcessor fp2) {
assert (fp1.getWidth() == fp2.getWidth());
assert (fp1.getHeight() == fp2.getHeight());
FloatProcessor out = new FloatProcessor(fp1.getWidth(), fp1.getHeight());
out.setMask(fp1.getMask() != null ? fp1.getMask(): fp2.getMask());
for (int i = 0, im = fp1.getWidth(); i < im; i++) {
for (int j = 0, jm = fp1.getHeight(); j < jm; j++) {
out.setf(i, j, fp1.getPixelValue(i, j) - fp2.getPixelValue(i, j));
}
}
return out;
}