本文整理汇总了Java中ij.plugin.ContrastEnhancer类的典型用法代码示例。如果您正苦于以下问题:Java ContrastEnhancer类的具体用法?Java ContrastEnhancer怎么用?Java ContrastEnhancer使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ContrastEnhancer类属于ij.plugin包,在下文中一共展示了ContrastEnhancer类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: setup
import ij.plugin.ContrastEnhancer; //导入依赖的package包/类
/** Method to return types supported
* @param arg unused
* @param imp The ImagePlus, used to get the spatial calibration
* @return Code describing supported formats etc.
* (see ij.plugin.filter.PlugInFilter & ExtendedPlugInFilter)
*/
public int setup(String arg, ImagePlus imp) {
this.imp = imp;
if (imp!=null)
{
if (imp.getRoi()!=null) {
Rectangle roiRect = imp.getRoi().getBounds();
if (roiRect.y > 0 || roiRect.y+roiRect.height < imp.getDimensions()[1])
flags |= SNAPSHOT; // snapshot for pixels above and/or below roi rectangle
}
if (arg.equals("final"))
{
imp.resetDisplayRange();
if (enhanceContrast)
{
ContrastEnhancer ce = new ContrastEnhancer();
ce.stretchHistogram(imp, 0.35);
}
imp.updateAndDraw();
}
}
return flags;
}
开发者ID:aherbert,项目名称:GDSC,代码行数:30,代码来源:DifferenceOfGaussians.java
示例2: process
import ij.plugin.ContrastEnhancer; //导入依赖的package包/类
@Override
public ImageProcessor process(final ImageProcessor ip, final double scale) {
try {
ContrastEnhancer eqhist = new ij.plugin.ContrastEnhancer();
eqhist.equalize(ip);
} catch (final Exception e) {
e.printStackTrace();
}
return ip;
}
开发者ID:saalfeldlab,项目名称:render,代码行数:11,代码来源:EqualizeHistogram.java
示例3: run
import ij.plugin.ContrastEnhancer; //导入依赖的package包/类
public void run(ImageProcessor inputProcessor)
{
ContrastEnhancer ce = new ContrastEnhancer();
double saturated = 0.35;
for (int id : gdsc.core.ij.Utils.getIDList())
{
ImagePlus imp = WindowManager.getImage(id);
imp.resetDisplayRange();
ce.stretchHistogram(imp, saturated);
imp.updateAndDraw();
}
}
开发者ID:aherbert,项目名称:GDSC,代码行数:13,代码来源:Contrast_Enhancer.java
示例4: filter
import ij.plugin.ContrastEnhancer; //导入依赖的package包/类
public void filter(final ImageProcessor ip, final double filterLarge, final double filterSmall,
final int noneHorOrVer, final double widthOfStripeFilter) {
ImageProcessor ip2 = ip;
final Rectangle roiRect = ip.getRoi();
final int maxN = Math.max(roiRect.width, roiRect.height);
int i=2;
while(i<1.5 * maxN) i *= 2;
// Calculate the inverse of the 1/e frequencies for large and small structures.
final double fl = 2.0*filterLarge / i;
final double fs = 2.0*filterSmall / i;
final Rectangle fitRect = new Rectangle();
fitRect.x = (int) Math.round( (i - roiRect.width) / 2.0 );
fitRect.y = (int) Math.round( (i - roiRect.height) / 2.0 );
fitRect.width = roiRect.width;
fitRect.height = roiRect.height;
ip2 = tileMirror(ip, i, i, fitRect.x, fitRect.y);
final FHT fht = new FHT(ip2);
fht.transform();
super.filterLargeSmall(fht, fl, fs, noneHorOrVer, widthOfStripeFilter);
fht.inverseTransform();
fht.setRoi(fitRect);
ip2 = fht.crop();
final ImagePlus imp2 = new ImagePlus("", ip2);
new ContrastEnhancer().stretchHistogram(imp2, 1.0);
ip2 = imp2.getProcessor();
ip2.convertToByte(true);
ip.snapshot();
ip.copyBits(ip2, roiRect.x, roiRect.y, Blitter.COPY);
ip.resetMinAndMax();
}
开发者ID:Soulforged,项目名称:ecgdoctor,代码行数:35,代码来源:OwnFFTFilter.java
示例5: setup
import ij.plugin.ContrastEnhancer; //导入依赖的package包/类
/** Setup of the PlugInFilter. Returns the flags specifying the capabilities and needs
* of the filter.
*
* @param arg Defines type of filter operation
* @param imp The ImagePlus to be processed
* @return Flags specifying further action of the PlugInFilterRunner
*/
public int setup(String arg, ImagePlus imp) {
this.imp = imp;
if (arg.equals("mean"))
filterType = MEAN;
else if (arg.equals("min"))
filterType = MIN;
else if (arg.equals("max"))
filterType = MAX;
else if (arg.equals("variance")) {
filterType = VARIANCE;
flags |= FINAL_PROCESSING;
} else if (arg.equals("median"))
filterType = MEDIAN;
else if (arg.equals("outliers"))
filterType = OUTLIERS;
else if (arg.equals("despeckle"))
filterType = DESPECKLE;
else if (arg.equals("close"))
filterType = CLOSE;
else if (arg.equals("open"))
filterType = OPEN;
else if (arg.equals("nan")) {
filterType = REMOVE_NAN;
if (imp!=null && imp.getBitDepth()!=32) {
IJ.error("RankFilters","\"Remove NaNs\" requires a 32-bit image");
return DONE;
}
} else if (arg.equals("final")) { //after variance filter, adjust brightness&contrast
if (imp!=null && imp.getBitDepth()!=8 && imp.getBitDepth()!=24 && imp.getRoi()==null)
new ContrastEnhancer().stretchHistogram(imp.getProcessor(), 0.5);
} else if (arg.equals("masks")) {
showMasks();
return DONE;
} else {
IJ.error("RankFilters","Argument missing or undefined: "+arg);
return DONE;
}
if (isMultiStepFilter(filterType) && imp!=null) { //composite filter: 'open maxima' etc:
Roi roi = imp.getRoi();
if (roi!=null && !roi.getBounds().contains(new Rectangle(imp.getWidth(), imp.getHeight())))
//Roi < image? (actually tested: NOT (Roi>=image))
flags |= SNAPSHOT; //snapshot for resetRoiBoundary
}
return flags;
}
开发者ID:mstritt,项目名称:orbit-image-analysis,代码行数:53,代码来源:RankFiltersOrbit.java
示例6: run
import ij.plugin.ContrastEnhancer; //导入依赖的package包/类
/** This method is invoked for each slice during execution
* @param ip The image subject to filtering. It must have a valid snapshot if
* the height of the roi is less than the full image height.
*/
@Override
public void run(ImageProcessor ip) {
if (ignoreChange)
{
ignoreChange = false;
return;
}
ignoreChange = false;
pass++;
if (pass>nPasses) pass =1;
// Check if this is the same slice within the preview or a new slice when processing a stack
if (currentSliceNumber != pfr.getSliceNumber())
{
computeSigma1 = true;
computeSigma2 = true;
}
currentSliceNumber = pfr.getSliceNumber();
double sigmaX = sigmaScaled ? sigma1/imp.getCalibration().pixelWidth : sigma1;
double sigmaY = sigmaScaled ? sigma1/imp.getCalibration().pixelHeight : sigma1;
double sigma2X = sigmaScaled ? sigma2/imp.getCalibration().pixelWidth : sigma2;
double sigma2Y = sigmaScaled ? sigma2/imp.getCalibration().pixelHeight : sigma2;
double accuracy = (ip instanceof ByteProcessor || ip instanceof ColorProcessor) ?
0.002 : 0.0002;
// Recompute only the parts necessary
if (computeSigma1)
{
ip1 = duplicateProcessor(ip);
blurGaussian(ip1, sigmaX, sigmaY, accuracy);
if (Thread.currentThread().isInterrupted()) return; // interruption for new parameters during preview?
computeSigma1 = false;
}
showProgressInternal(0.333);
if (computeSigma2)
{
ip2 = duplicateProcessor(ip);
blurGaussian(ip2, sigma2X, sigma2Y, accuracy);
if (Thread.currentThread().isInterrupted()) return; // interruption for new parameters during preview?
computeSigma2 = false;
}
showProgressInternal(0.667);
differenceOfGaussians(ip, ip1, ip2);
// Need to refresh on screen display
//ip.resetMinAndMax();
if (imp != null)
{
// This is necessary when processing stacks after preview
imp.getStack().setPixels(ip.getPixels(), currentSliceNumber);
imp.resetDisplayRange();
if (enhanceContrast)
{
ContrastEnhancer ce = new ContrastEnhancer();
ce.stretchHistogram(imp, 0.35);
}
imp.updateAndDraw();
}
showProgressInternal(1.0);
}
开发者ID:aherbert,项目名称:GDSC,代码行数:69,代码来源:DifferenceOfGaussians.java
示例7: set
import ij.plugin.ContrastEnhancer; //导入依赖的package包/类
private void set(String field, Object value) throws Exception {
Field f = ContrastEnhancer.class.getDeclaredField(field);
f.setAccessible(true);
f.set(ce, value);
}
开发者ID:trakem2,项目名称:TrakEM2,代码行数:6,代码来源:ContrastEnhancerWrapper.java
示例8: process
import ij.plugin.ContrastEnhancer; //导入依赖的package包/类
@Override
public ImageProcessor process(ImageProcessor ip) {
new ContrastEnhancer().equalize(ip);
return ip;
}
开发者ID:trakem2,项目名称:TrakEM2,代码行数:6,代码来源:EqualizeHistogram.java
示例9: process
import ij.plugin.ContrastEnhancer; //导入依赖的package包/类
@Override
public ImageProcessor process(ImageProcessor ip) {
// Will not alter ip, no need to duplicate
new ContrastEnhancer().stretchHistogram(ip, s, ImageStatistics.getStatistics(ip, Measurements.MIN_MAX, null));
return ip;
}
开发者ID:trakem2,项目名称:TrakEM2,代码行数:7,代码来源:EnhanceContrast.java
注:本文中的ij.plugin.ContrastEnhancer类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论