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


Java FloatProcessor.setMask方法代码示例

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


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

示例1: modulo

import ij.process.FloatProcessor; //导入方法依赖的package包/类
public static FloatProcessor modulo(FloatProcessor a, FloatProcessor b) {
    if((a.getWidth() != b.getWidth()) || (a.getHeight()!= b.getHeight())) {
        throw new IllegalArgumentException("Error during evaluation of `a%b` expression! Both operands must be of the same size!");
    }
    FloatProcessor res = new FloatProcessor(a.getWidth(), a.getHeight());
    res.setMask(a.getMask() != null ? a.getMask(): b.getMask());
    float tmp;
    for (int i = 0, im = a.getWidth(); i < im; i++) {
        for (int j = 0, jm = a.getHeight(); j < jm; j++) {
            tmp = a.getf(i, j) / b.getf(i, j);
            res.setf(i, j, a.getf(i, j) - (((float)((int)tmp)) * b.getf(i, j)));
        }
    }
    return res;
}
 
开发者ID:zitmen,项目名称:thunderstorm,代码行数:16,代码来源:ImageMath.java

示例2: 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;
}
 
开发者ID:zitmen,项目名称:thunderstorm,代码行数:24,代码来源:ImageMath.java

示例3: 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;
}
 
开发者ID:zitmen,项目名称:thunderstorm,代码行数:24,代码来源:ImageMath.java

示例4: multiply

import ij.process.FloatProcessor; //导入方法依赖的package包/类
/**
 * Multiply 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 multiplied with
 * @param fp2 another input image which will be multiplied with {@code fp1}
 * @return a <strong>new instance</strong> of FloatProcessor: {@mathjax fp3 = fp1 * fp2}
 */
public static FloatProcessor multiply(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;
}
 
开发者ID:zitmen,项目名称:thunderstorm,代码行数:24,代码来源:ImageMath.java

示例5: divide

import ij.process.FloatProcessor; //导入方法依赖的package包/类
/**
 * Divide values of one image by values of the other image.
 * 
 * The images are required to be of the same size.
 *
 * @param fp1 an input image which the other input image ({@code fp2}) will be divided by
 * @param fp2 another input image which will divide the {@code fp1}
 * @return a <strong>new instance</strong> of FloatProcessor: {@mathjax fp3 = fp1 / fp2}
 */
public static FloatProcessor divide(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;
}
 
开发者ID:zitmen,项目名称:thunderstorm,代码行数:24,代码来源:ImageMath.java

示例6: power

import ij.process.FloatProcessor; //导入方法依赖的package包/类
/**
 * Calculate a {@code val}-th power of an image {@code fp}.
 * 
 * @param val {@code val}-th power of {@code fp}
 * @param fp an input image
 * @return a <strong>new instance</strong> of FloatProcessor: {@mathjax fpv = fp ^ val}
 */
public static FloatProcessor power(FloatProcessor fp, float val) {
    FloatProcessor out = new FloatProcessor(fp.getWidth(), fp.getHeight());
    out.setMask(fp.getMask());
    for (int i = 0, im = fp.getWidth(); i < im; i++) {
        for (int j = 0, jm = fp.getHeight(); j < jm; j++) {
            out.setf(i, j, (float)pow((double)fp.getPixelValue(i, j), (double)val));
        }
    }

    return out;
}
 
开发者ID:zitmen,项目名称:thunderstorm,代码行数:19,代码来源:ImageMath.java

示例7: relNeq

import ij.process.FloatProcessor; //导入方法依赖的package包/类
public static FloatProcessor relNeq(FloatProcessor a, FloatProcessor b) {
    if((a.getWidth() != b.getWidth()) || (a.getHeight()!= b.getHeight())) {
        throw new IllegalArgumentException("Error during evaluation of `a<b` expression! Both operands must be of the same size!");
    }
    FloatProcessor res = new FloatProcessor(a.getWidth(), a.getHeight());
    res.setMask(a.getMask() != null ? a.getMask(): b.getMask());
    for(int x = 0; x < a.getWidth(); x++) {
        for(int y = 0; y < a.getHeight(); y++) {
            res.setf(x, y, ((a.getf(x, y) != b.getf(x, y)) ? 1.0f : 0.0f));
        }
    }
    return res;
}
 
开发者ID:zitmen,项目名称:thunderstorm,代码行数:14,代码来源:ImageMath.java

示例8: relGt

import ij.process.FloatProcessor; //导入方法依赖的package包/类
public static FloatProcessor relGt(FloatProcessor a, FloatProcessor b) {
    if((a.getWidth() != b.getWidth()) || (a.getHeight()!= b.getHeight())) {
        throw new IllegalArgumentException("Error during evaluation of `a<b` expression! Both operands must be of the same size!");
    }
    FloatProcessor res = new FloatProcessor(a.getWidth(), a.getHeight());
    res.setMask(a.getMask() != null ? a.getMask(): b.getMask());
    for(int x = 0; x < a.getWidth(); x++) {
        for(int y = 0; y < a.getHeight(); y++) {
            res.setf(x, y, ((a.getf(x, y) > b.getf(x, y)) ? 1.0f : 0.0f));
        }
    }
    return res;
}
 
开发者ID:zitmen,项目名称:thunderstorm,代码行数:14,代码来源:ImageMath.java

示例9: relLt

import ij.process.FloatProcessor; //导入方法依赖的package包/类
public static FloatProcessor relLt(FloatProcessor a, FloatProcessor b) {
    if((a.getWidth() != b.getWidth()) || (a.getHeight()!= b.getHeight())) {
        throw new IllegalArgumentException("Error during evaluation of `a<b` expression! Both operands must be of the same size!");
    }
    FloatProcessor res = new FloatProcessor(a.getWidth(), a.getHeight());
    res.setMask(a.getMask() != null ? a.getMask(): b.getMask());
    for(int x = 0; x < a.getWidth(); x++) {
        for(int y = 0; y < a.getHeight(); y++) {
            res.setf(x, y, ((a.getf(x, y) < b.getf(x, y)) ? 1.0f : 0.0f));
        }
    }
    return res;
}
 
开发者ID:zitmen,项目名称:thunderstorm,代码行数:14,代码来源:ImageMath.java

示例10: logAnd

import ij.process.FloatProcessor; //导入方法依赖的package包/类
public static FloatProcessor logAnd(FloatProcessor a, FloatProcessor b) {
    if((a.getWidth() != b.getWidth()) || (a.getHeight()!= b.getHeight())) {
        throw new IllegalArgumentException("Error during evaluation of `a&b` expression! Both operands must be of the same size!");
    }
    FloatProcessor res = new FloatProcessor(a.getWidth(), a.getHeight());
    res.setMask(a.getMask() != null ? a.getMask(): b.getMask());
    for(int x = 0; x < a.getWidth(); x++) {
        for(int y = 0; y < a.getHeight(); y++) {
            res.setf(x, y, (((a.getf(x, y) != 0.0f) && (b.getf(x, y) != 0.0f)) ? 1.0f : 0.0f));
        }
    }
    return res;
}
 
开发者ID:zitmen,项目名称:thunderstorm,代码行数:14,代码来源:ImageMath.java

示例11: logOr

import ij.process.FloatProcessor; //导入方法依赖的package包/类
public static FloatProcessor logOr(FloatProcessor a, FloatProcessor b) {
    if((a.getWidth() != b.getWidth()) || (a.getHeight()!= b.getHeight())) {
        throw new IllegalArgumentException("Error during evaluation of `a|b` expression! Both operands must be of the same size!");
    }
    FloatProcessor res = new FloatProcessor(a.getWidth(), a.getHeight());
    res.setMask(a.getMask() != null ? a.getMask(): b.getMask());
    for(int x = 0; x < a.getWidth(); x++) {
        for(int y = 0; y < a.getHeight(); y++) {
            res.setf(x, y, (((a.getf(x, y) != 0.0f) || (b.getf(x, y) != 0.0f)) ? 1.0f : 0.0f));
        }
    }
    return res;
}
 
开发者ID:zitmen,项目名称:thunderstorm,代码行数:14,代码来源:ImageMath.java

示例12: relEq

import ij.process.FloatProcessor; //导入方法依赖的package包/类
public static FloatProcessor relEq(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;
}
 
开发者ID:zitmen,项目名称:thunderstorm,代码行数:12,代码来源:ImageMath.java

示例13: abs

import ij.process.FloatProcessor; //导入方法依赖的package包/类
public static FloatProcessor abs(FloatProcessor mat) {
    FloatProcessor res = new FloatProcessor(mat.getWidth(), mat.getHeight(), (float [])mat.getPixelsCopy(), null);
    res.abs();
    res.setMask(mat.getMask());
    return res;
}
 
开发者ID:zitmen,项目名称:thunderstorm,代码行数:7,代码来源:ImageMath.java


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