本文整理汇总了Java中ij.process.Blitter类的典型用法代码示例。如果您正苦于以下问题:Java Blitter类的具体用法?Java Blitter怎么用?Java Blitter使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Blitter类属于ij.process包,在下文中一共展示了Blitter类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: getParts
import ij.process.Blitter; //导入依赖的package包/类
/**
* Retrieve all glyph instances that could be part of clef.
*
* @param isFirstPass true for first pass
* @return clef possible parts
*/
private List<Glyph> getParts (boolean isFirstPass)
{
final Rectangle rect = isFirstPass ? outerRect : innerRect;
// Grab pixels out of staff-free source
ByteProcessor source = sheet.getPicture().getSource(Picture.SourceKey.NO_STAFF);
ByteProcessor buf = new ByteProcessor(rect.width, rect.height);
buf.copyBits(source, -rect.x, -rect.y, Blitter.COPY);
// Extract parts
RunTable runTable = new RunTableFactory(VERTICAL).createTable(buf);
List<Glyph> parts = GlyphFactory.buildGlyphs(runTable, rect.getLocation());
// Keep only interesting parts
purgeParts(parts, isFirstPass);
system.registerGlyphs(parts, Group.CLEF_PART);
logger.debug("{} parts: {}", this, parts.size());
return parts;
}
开发者ID:Audiveris,项目名称:audiveris,代码行数:28,代码来源:ClefBuilder.java
示例2: imposeMinima
import ij.process.Blitter; //导入依赖的package包/类
public static void imposeMinima(final FloatProcessor fp, final Roi roi) {
final ImageProcessor fpOrig = fp.duplicate();
// ImageStatistics stats = fp.getStatistics();
fp.setValue(Float.NEGATIVE_INFINITY);
fp.fill(roi);
ROILabeling.fillOutside(fp, roi, Float.POSITIVE_INFINITY);
fpOrig.copyBits(fp, 0, 0, Blitter.MIN);
fpOrig.multiply(-1);
fp.multiply(-1);
morphologicalReconstruction(fp, fpOrig);
fp.multiply(-1);
}
开发者ID:qupath,项目名称:qupath,代码行数:17,代码来源:MorphologicalReconstruction.java
示例3: imposeMaxima
import ij.process.Blitter; //导入依赖的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);
}
}
开发者ID:qupath,项目名称:qupath,代码行数:22,代码来源:MorphologicalReconstruction.java
示例4: fillOutside
import ij.process.Blitter; //导入依赖的package包/类
/**
* Fill in a region outside a specified ROI
* @param ip
* @param roi
*/
public static void fillOutside(ImageProcessor ip, Roi roi, double value) {
// Check we don't have a full rectangle
if (roi.getType() == Roi.RECTANGLE && roi.getBounds().equals(new Rectangle(0, 0, ip.getWidth(), ip.getHeight())))
return;
// if (roi instanceof ShapeRoi) {
// Appears to be a bug with ShapeRois so that filling outside can fail using ImageJ's own code
ByteProcessor bpMask = new ByteProcessor(ip.getWidth(), ip.getHeight());
bpMask.setValue(1);
bpMask.fill(roi);
if (value == 0)
ip.copyBits(bpMask, 0, 0, Blitter.MULTIPLY);
else {
float floatValue = (float)value;
byte[] px = (byte[])bpMask.getPixels();
for (int i = 0; i < px.length; i++) {
if (px[i] == (byte)0)
ip.setf(i, floatValue);
}
}
// } else {
// ip.setValue(value);
// ip.fillOutside(roi);
// }
}
开发者ID:qupath,项目名称:qupath,代码行数:30,代码来源:ROILabeling.java
示例5: dilate
import ij.process.Blitter; //导入依赖的package包/类
private void dilate(ByteProcessor ip, int[][] H) {
if (H == null) {
IJ.error("no structuring element");
return;
}
//assume that the hot spot of se is at its center (ic,jc)
int ic = (H[0].length - 1) / 2;
int jc = (H.length - 1) / 2;
int N = H.length * H[0].length;
ImageProcessor tmp = ip.createProcessor(ip.getWidth(), ip.getHeight());
int k = 0;
IJ.showProgress(k, N);
for (int j = 0; j < H.length; j++) {
for (int i = 0; i < H[j].length; i++) {
if (H[j][i] > 0) { // this element is set
// copy image into position (u-ch,v-cv)
tmp.copyBits(ip, i - ic, j - jc, Blitter.MAX);
}
IJ.showProgress(k++, N);
}
}
ip.copyBits(tmp, 0, 0, Blitter.COPY);
}
开发者ID:imagingbook,项目名称:imagingbook-common,代码行数:28,代码来源:BinaryMorphologyFilter.java
示例6: outline
import ij.process.Blitter; //导入依赖的package包/类
public void outline(ByteProcessor ip) {
int[][] H = {
{ 0, 1, 0 },
{ 1, 1, 1 },
{ 0, 1, 0 } };
ByteProcessor foreground = (ByteProcessor) ip.duplicate();
erode(foreground, H);
ip.copyBits(foreground, 0, 0, Blitter.DIFFERENCE);
}
开发者ID:imagingbook,项目名称:imagingbook-common,代码行数:10,代码来源:BinaryMorphologyFilter.java
示例7: dilate
import ij.process.Blitter; //导入依赖的package包/类
void dilate(ImageProcessor ip, int[][] H){
if (H == null) {
IJ.error("no structuring element");
return;
}
//assume that the hot spot of se is at its center (ic,jc)
int ic = (H[0].length - 1) / 2;
int jc = (H.length - 1) / 2;
int N = H.length * H[0].length;
ImageProcessor tmp = ip.createProcessor(ip.getWidth(),ip.getHeight());
int k = 0;
IJ.showProgress(k,N);
for (int j = 0; j < H.length; j++) {
for (int i = 0; i < H[j].length; i++) {
if (H[j][i] > 0) { // this pixel is set
// copy image into position (u-ch,v-cv)
tmp.copyBits(ip, i - ic, j - jc, Blitter.MAX);
}
IJ.showProgress(k++, N);
}
}
ip.copyBits(tmp, 0, 0, Blitter.COPY);
}
开发者ID:imagingbook,项目名称:imagingbook-common,代码行数:28,代码来源:BinMorpher.java
示例8: outline
import ij.process.Blitter; //导入依赖的package包/类
void outline(ImageProcessor ip){
int[][] H = {{0,1,0},
{1,1,1},
{0,1,0}
};
ImageProcessor foreground = ip.duplicate();
erode(foreground,H);
ip.copyBits(foreground,0,0,Blitter.DIFFERENCE);
}
开发者ID:imagingbook,项目名称:imagingbook-common,代码行数:10,代码来源:BinMorpher.java
示例9: getBuffer
import ij.process.Blitter; //导入依赖的package包/类
/**
* Compute the scaled buffer for the provided glyph, using related staff interline
* value.
*
* @param glyph the source glyph
* @param interline the related staff interline
* @return the computed buffer using 0 for black (foreground) and 255 for white (background)
*/
public static ByteProcessor getBuffer (Glyph glyph,
int interline)
{
final RunTable runTable = glyph.getRunTable();
final ByteProcessor glyphBuffer = runTable.getBuffer();
final double scale = (double) INTERLINE / interline;
// Build scaled buffer, filled by (scaled) glyph
final int scaledWidth = (int) Math.ceil(runTable.getWidth() * scale);
final int scaledHeight = (int) Math.ceil(runTable.getHeight() * scale);
final ByteProcessor scaledBuffer = (ByteProcessor) glyphBuffer.resize(
scaledWidth,
scaledHeight,
true); // True => use averaging when down-scaling
// Copy scaledBuffer into a WIDTH*HEIGHT target buffer centered on glyph centroid
final Point centroid = glyph.getCentroid();
final Point center = glyph.getCenter();
final int dx = centroid.x - center.x; // X shift of centroid WRT center
final int dy = centroid.y - center.y; // Y shift of centroid WRT center
final int targetDx = (int) Math.rint(dx * scale); // Scaled x shift
final int targetDy = (int) Math.rint(dy * scale); // Scaled y shift
final ByteProcessor buffer = new ByteProcessor(WIDTH, HEIGHT); // Same dim for any symbol
ByteUtil.raz(buffer); // Correct
///ByteUtil.fill(targetBuffer, 100); // Not correct, just meant to visualize limits...
final int xOffset = ((WIDTH - scaledWidth) / 2) - targetDx;
final int yOffset = ((HEIGHT - scaledHeight) / 2) - targetDy;
buffer.copyBits(scaledBuffer, xOffset, yOffset, Blitter.COPY);
return buffer;
}
开发者ID:Audiveris,项目名称:audiveris,代码行数:42,代码来源:ScaledBuffer.java
示例10: getAreaPixels
import ij.process.Blitter; //导入依赖的package包/类
/**
* Report the pixels buffer for the whole key area
*
* @param source pixel source (staff free)
* @param range start/stop values for key area
* @return the buffer of area pixels
*/
public ByteProcessor getAreaPixels (ByteProcessor source,
StaffHeader.Range range)
{
Rectangle keyRect = new Rectangle(range.getStart(), y, range.getWidth(), height);
ByteProcessor keyBuffer = new ByteProcessor(keyRect.width, height);
keyBuffer.copyBits(source, -keyRect.x, -y, Blitter.COPY);
return keyBuffer;
}
开发者ID:Audiveris,项目名称:audiveris,代码行数:17,代码来源:KeyRoi.java
示例11: getParts
import ij.process.Blitter; //导入依赖的package包/类
/**
* Retrieve all glyph instances that could be part of time sig.
*
* @return time sig possible parts
*/
private List<Glyph> getParts (Rectangle rect)
{
final Sheet sheet = system.getSheet();
// Grab pixels out of staff-free source
ByteProcessor source = sheet.getPicture().getSource(Picture.SourceKey.NO_STAFF);
ByteProcessor buf = new ByteProcessor(rect.width, rect.height);
buf.copyBits(source, -rect.x, -rect.y, Blitter.COPY);
// Extract parts
RunTable runTable = new RunTableFactory(VERTICAL).createTable(buf);
List<Glyph> parts = GlyphFactory.buildGlyphs(runTable, rect.getLocation());
// Keep only interesting parts
purgeParts(parts, rect);
final GlyphIndex glyphIndex = sheet.getGlyphIndex();
for (ListIterator<Glyph> li = parts.listIterator(); li.hasNext();) {
final Glyph part = li.next();
Glyph glyph = glyphIndex.registerOriginal(part);
glyph.addGroup(Group.TIME_PART); // For debug?
system.addFreeGlyph(glyph);
li.set(glyph);
}
return parts;
}
开发者ID:Audiveris,项目名称:audiveris,代码行数:34,代码来源:TimeBuilder.java
示例12: clearBoundary
import ij.process.Blitter; //导入依赖的package包/类
/**
* Starting from all white pixels (value = 255) on a ROI's boundary,
* fill the pixels with black
*
* @param bp
* @param roi
* @param clearValue
*/
public static void clearBoundary(ByteProcessor bp, Roi roi, double clearValue) {
ByteProcessor bpEdgeMask = new ByteProcessor(bp.getWidth(), bp.getHeight());
bpEdgeMask.setValue(255);
if (roi == null)
bpEdgeMask.fill();
else {
bpEdgeMask.fill(roi);
}
bpEdgeMask.filter(ByteProcessor.MIN);
bpEdgeMask.invert();
bpEdgeMask.copyBits(bp, 0, 0, Blitter.AND);
bpEdgeMask = MorphologicalReconstruction.binaryReconstruction(bpEdgeMask, bp, false);
bp.copyBits(bpEdgeMask, 0, 0, Blitter.SUBTRACT);
//
// ImagePlus imp = new ImagePlus("Edge", bp.duplicate());
// imp.setRoi(roi);
// imp.show();
// ByteProcessor bpEdgeMask = new ByteProcessor(bp.getWidth(), bp.getHeight());
// bpEdgeMask.setValue(255);
// bpEdgeMask.setLineWidth(2);
// if (roi == null)
// bpEdgeMask.draw(new Roi(0, 0, bp.getWidth(), bp.getHeight()));
// else
// bpEdgeMask.draw(roi);
// bpEdgeMask.copyBits(bp, 0, 0, Blitter.AND);
// bpEdgeMask = MorphologicalReconstruction.binaryReconstruction(bpEdgeMask, bp, false);
// bp.copyBits(bpEdgeMask, 0, 0, Blitter.SUBTRACT);
// new ImagePlus("Edge", bp.duplicate()).show();
}
开发者ID:qupath,项目名称:qupath,代码行数:39,代码来源:ROILabeling.java
示例13: convertToOpticalDensitySum
import ij.process.Blitter; //导入依赖的package包/类
public static FloatProcessor convertToOpticalDensitySum(ColorProcessor cp, double maxRed, double maxGreen, double maxBlue) {
FloatProcessor fp = cp.toFloat(0, null);
ColorDeconvolutionHelper.convertPixelsToOpticalDensities((float[])fp.getPixels(), maxRed, true);
FloatProcessor fpTemp = cp.toFloat(1, null);
ColorDeconvolutionHelper.convertPixelsToOpticalDensities((float[])fpTemp.getPixels(), maxGreen, true);
fp.copyBits(fpTemp, 0, 0, Blitter.ADD);
fpTemp = cp.toFloat(2, fpTemp);
ColorDeconvolutionHelper.convertPixelsToOpticalDensities((float[])fpTemp.getPixels(), maxBlue, true);
fp.copyBits(fpTemp, 0, 0, Blitter.ADD);
return fp;
}
开发者ID:qupath,项目名称:qupath,代码行数:14,代码来源:ColorDeconvolutionIJ.java
示例14: setPasteMode
import ij.process.Blitter; //导入依赖的package包/类
/** Sets the transfer mode used by the <i>Edit/Paste</i> command, where mode is "Copy", "Blend", "Average", "Difference",
"Transparent", "Transparent2", "AND", "OR", "XOR", "Add", "Subtract", "Multiply", or "Divide". */
public static void setPasteMode(String mode) {
mode = mode.toLowerCase(Locale.US);
int m = Blitter.COPY;
if (mode.startsWith("ble") || mode.startsWith("ave"))
m = Blitter.AVERAGE;
else if (mode.startsWith("diff"))
m = Blitter.DIFFERENCE;
else if (mode.indexOf("zero")!=-1)
m = Blitter.COPY_ZERO_TRANSPARENT;
else if (mode.startsWith("tran"))
m = Blitter.COPY_TRANSPARENT;
else if (mode.startsWith("and"))
m = Blitter.AND;
else if (mode.startsWith("or"))
m = Blitter.OR;
else if (mode.startsWith("xor"))
m = Blitter.XOR;
else if (mode.startsWith("sub"))
m = Blitter.SUBTRACT;
else if (mode.startsWith("add"))
m = Blitter.ADD;
else if (mode.startsWith("div"))
m = Blitter.DIVIDE;
else if (mode.startsWith("mul"))
m = Blitter.MULTIPLY;
else if (mode.startsWith("min"))
m = Blitter.MIN;
else if (mode.startsWith("max"))
m = Blitter.MAX;
Roi.setPasteMode(m);
}
开发者ID:darciopacifico,项目名称:omr,代码行数:34,代码来源:IJJazzOMR.java
示例15: copyBits
import ij.process.Blitter; //导入依赖的package包/类
private void copyBits(ImageProcessor ip, FloatProcessor fp, int lowerX, int lowerY, double weight)
{
if (weight > 0)
{
fp = (FloatProcessor) fp.duplicate();
fp.multiply(weight);
ip.copyBits(fp, lowerX, lowerY, Blitter.ADD);
}
}
开发者ID:aherbert,项目名称:GDSC-SMLM,代码行数:10,代码来源:PSFCreator.java
示例16: calculateDriftUsingFrames
import ij.process.Blitter; //导入依赖的package包/类
/**
* Calculate the drift by aligning N consecutive frames with the overall image. Update the current drift parameters.
*
* @param blocks
* @param blockT
* @param bounds
* @param scale
* @param dx
* @param dy
* @param smoothing
* @param iterations
* @return
*/
private double calculateDriftUsingFrames(ArrayList<ArrayList<Localisation>> blocks, int[] blockT, Rectangle bounds,
float scale, double[] dx, double[] dy, double[] originalDriftTimePoints, double smoothing, int iterations)
{
// Construct images using the current drift
tracker.status("Constructing images");
// Built an image for each block of results.
final ImageProcessor[] images = new ImageProcessor[blocks.size()];
List<Future<?>> futures = new LinkedList<Future<?>>();
progressCounter = 0;
totalCounter = images.length * 2;
for (int i = 0; i < images.length; i++)
{
futures.add(threadPool.submit(new ImageBuilder(blocks.get(i), images, i, bounds, scale, dx, dy)));
}
Utils.waitForCompletion(futures);
for (int i = 0; i < blocks.size(); i++)
{
tracker.progress(i, blocks.size());
IJImagePeakResults blockImage = newImage(bounds, scale);
for (Localisation r : blocks.get(i))
{
blockImage.add(r.t, (float) (r.x + dx[r.t]), (float) (r.y + dy[r.t]), r.s);
}
images[i] = getImage(blockImage);
}
// Build an image with all results.
FloatProcessor allIp = new FloatProcessor(images[0].getWidth(), images[0].getHeight());
for (ImageProcessor ip : images)
allIp.copyBits(ip, 0, 0, Blitter.ADD);
return calculateDrift(blockT, scale, dx, dy, originalDriftTimePoints, smoothing, iterations, images, allIp,
true);
}
开发者ID:aherbert,项目名称:GDSC-SMLM,代码行数:52,代码来源:DriftCalculator.java
示例17: mouseClicked
import ij.process.Blitter; //导入依赖的package包/类
public void mouseClicked(MouseEvent e)
{
if (e == null)
return;
ImageCanvas ic = imp.getCanvas();
int cx = ic.offScreenX(e.getX());
int cy = ic.offScreenY(e.getY());
final int radius = (int) Math.ceil(diameter * 500 / nmPerPixel);
final int radiusz = (int) Math.ceil(diameter * 500 / nmPerSlice);
if (sphere == null)
{
int inc = 2 * radius + 1;
int incz = 2 * radiusz + 1;
sphere = createEllipsoid(inc, inc, incz);
}
int xloc = cx - radius;
int yloc = cy - radius;
int offset = imp.getCurrentSlice() - radiusz;
ImageStack stack = imp.getImageStack();
for (int slice = 1; slice <= sphere.getSize(); slice++)
{
int i = slice + offset;
if (i < 1 || i > stack.getSize())
continue;
ImageProcessor ip = stack.getProcessor(i);
ImageProcessor ip2 = sphere.getProcessor(slice);
ip.copyBits(ip2, xloc, yloc, Blitter.MAX);
}
imp.updateAndDraw();
}
开发者ID:aherbert,项目名称:GDSC-SMLM,代码行数:31,代码来源:NucleusMask.java
示例18: createMasksAndRois
import ij.process.Blitter; //导入依赖的package包/类
/**
* Creates appropriate data structures from the ROI information
* passed. If an irregular ROI is found, it will be put into a
* frame of its bounding box size and put into an {@code Image<T>}.
*
* In the end the members ROIs, masks and maskBBs will be
* filled if ROIs or masks were found. They will be null
* otherwise.
*/
protected void createMasksAndRois(final Roi[] rois, final int width,
final int height)
{
// create empty list
masks.clear();
for (final Roi r : rois) {
final MaskInfo mi = new MaskInfo();
// add it to the list of masks/ROIs
masks.add(mi);
// get the ROIs/masks bounding box
final Rectangle rect = r.getBounds();
mi.roi = new BoundingBox(new long[] { rect.x, rect.y }, new long[] {
rect.width, rect.height });
final ImageProcessor ipMask = r.getMask();
// check if we got a regular ROI and return if so
if (ipMask == null) {
continue;
}
// create a mask processor of the same size as a slice
final ImageProcessor ipSlice = ipMask.createProcessor(width, height);
// fill the new slice with black
ipSlice.setValue(0.0);
ipSlice.fill();
// position the mask on the new mask processor
ipSlice.copyBits(ipMask, (int) mi.roi.offset[0], (int) mi.roi.offset[1],
Blitter.COPY);
// create an Image<T> out of it
final ImagePlus maskImp = new ImagePlus("Mask", ipSlice);
// and remember it and the masks bounding box
mi.mask = ImagePlusAdapter.<T> wrap(maskImp);
}
}
开发者ID:fiji,项目名称:Colocalisation_Analysis,代码行数:44,代码来源:Coloc_2.java
示例19: prepareCC
import ij.process.Blitter; //导入依赖的package包/类
/**
* For each image except the reference image an instance of
* {@link NormCrossCorrelation} is created. The input images are copied and
* cropped before committed to {@link NormCrossCorrelation}.
*/
private NormCrossCorrelation[] prepareCC() {
final NormCrossCorrelation[] ccArray = new NormCrossCorrelation[stack
.getStackSize()];
roi.x = roi.x - deltaX;
roi.y = roi.y - deltaY;
roi.width = roi.width + 2 * deltaX;
roi.height = roi.height + 2 * deltaY;
FloatProcessor reference = new FloatProcessor(stack.getWidth(), stack
.getHeight());
reference.copyBits(stack.getStack().getProcessor(referenceIndex), 0, 0,
Blitter.COPY);
reference.setRoi(roi);
reference = (FloatProcessor) reference.crop();
for (int i = 0; i < stack.getStackSize(); i++) {
if (i != referenceIndex - 1) {
FloatProcessor fp = new FloatProcessor(stack.getWidth(), stack
.getHeight());
fp.copyBits(stack.getStack().getProcessor(i + 1), 0, 0, Blitter.COPY);
fp.setRoi(roi);
fp = (FloatProcessor) fp.crop();
ccArray[i] = new NormCrossCorrelation(reference, fp, deltaX, deltaY);
}
else {
ccArray[i] = null;
}
}
// this is the count of subtasks
NormCrossCorrelation.setProgressSteps((ccArray.length - 1) * (deltaY * 2 +
1));
return ccArray;
}
开发者ID:EFTEMj,项目名称:EFTEMj,代码行数:37,代码来源:DriftDetectionPlugin.java
示例20: showLnAMap
import ij.process.Blitter; //导入依赖的package包/类
/**
* Shows an {@link ImagePlus} with the map of the parameter
* <strong>ln(a)</strong>. Using the logarithm makes it easier to review the
* map.<br />
* All values are 0 if no calculation has been done before.
*
* @param cal A {@link Calibration} object or <code>null</code>.
*/
public void showLnAMap(final Calibration cal) {
final FloatProcessor lnAMap = new FloatProcessor(aMap.getWidth(), aMap
.getHeight());
lnAMap.copyBits(aMap, 0, 0, Blitter.COPY);
lnAMap.log();
final ImagePlus impLnAMap = new ImagePlus("Map of parameter ln(a)", lnAMap);
if (cal != null) {
impLnAMap.setCalibration(cal);
}
impLnAMap.show();
}
开发者ID:EFTEMj,项目名称:EFTEMj,代码行数:20,代码来源:ElementalMapping.java
注:本文中的ij.process.Blitter类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论