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


Java ResultsTable.getCounter方法代码示例

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


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

示例1: identifyGoodCores

import ij.measure.ResultsTable; //导入方法依赖的package包/类
/**
 * Identify regions in a binary image likely to correspond to complete TMA cores,
 * based both on size and circularity.
 * @param bp - The binary image to process; 0 should be background, 255 foreground
 * @param minArea - Minimum area of a region to keep (in pixels)
 * @param maxArea - Maximum area of a region to keep (in pixels)
 * @param minCircularity - Minimum circularity of a region to keep.
 * @param labelCores - TRUE if the output should be a labelled image (unique integer value per core), otherwise a binary image will be returned
 * @param polyCentroids - A Polygon to which the centroids of the detected regions will be added (if not null).
 * @return Binary or labelled image showing containing only the regions of bp with shapes & sizes corresponding to likely complete TMA cores.
 */	
private static ImageProcessor identifyGoodCores(ByteProcessor bp, double minArea, double maxArea, double minCircularity, boolean labelCores, Polygon polyCentroids) {
	// Create a binary image of only the roundest structures of approximately the correct area
	bp.setThreshold(127, 512, ImageProcessor.NO_LUT_UPDATE);
	int options = labelCores ? ParticleAnalyzer.SHOW_ROI_MASKS : ParticleAnalyzer.SHOW_MASKS;
	int measurements = Measurements.CENTROID;
	ResultsTable rt = new ResultsTable();
	ParticleAnalyzer pa = new ParticleAnalyzer(options, measurements, rt, minArea, maxArea, minCircularity, 1.0);
	pa.setHideOutputImage(true);
	pa.analyze(new ImagePlus("Temp", bp), bp);
	if (polyCentroids != null) {
		for (int i = 0; i < rt.getCounter(); i++) {
			int x = (int)(rt.getValueAsDouble(ResultsTable.X_CENTROID, i) + .5);
			int y = (int)(rt.getValueAsDouble(ResultsTable.Y_CENTROID, i) + .5);
			polyCentroids.addPoint(x, y);
		}
	}
	return pa.getOutputImage().getProcessor();
}
 
开发者ID:qupath,项目名称:qupath,代码行数:30,代码来源:TMADearrayer.java

示例2: fillParticleVOs

import ij.measure.ResultsTable; //导入方法依赖的package包/类
/**
 * Apenas faz o trabalho bracal de preencher a lista de VOs
 * 
 * @param rt
 * @return
 */
protected List<ParticleVO> fillParticleVOs(ImageDocVO data, ResultsTable rt) {
	int rowCount = rt.getCounter();
	List<ParticleVO> particles = new ArrayList<ParticleVO>(rowCount);

	if (rowCount > 0) {

		for (int row = 0; row < rowCount; row++) {

			ParticleVO particleVO = new ParticleVO();

			particleVO.setArea(getValue(rt, COLUMNS_PARTICLE.AREA, row));
			particleVO.setPerimeter(getValue(rt, COLUMNS_PARTICLE.PERIM, row));
			particleVO.setSolidity(getValue(rt, COLUMNS_PARTICLE.SOLIDITY, row));

			particleVO.setX(getValue(rt, COLUMNS_PARTICLE.X, row));
			particleVO.setY(getValue(rt, COLUMNS_PARTICLE.Y, row));

			particleVO.setCircularity(getValue(rt, COLUMNS_PARTICLE.CIRC, row));

			particles.add(particleVO);
		}

	}
	return particles;
}
 
开发者ID:darciopacifico,项目名称:omr,代码行数:32,代码来源:JazzOMRImageParser.java

示例3: setColumn

import ij.measure.ResultsTable; //导入方法依赖的package包/类
/**
 * Set a specifying column into the current instance ResultsTable.
 *
 * @param heading	heading of a column	
 * @param object
 */
public static void setColumn(String heading, Object object){
    ResultsTable rt=Analyzer.getResultsTable();
    
    int col= rt.getColumnIndex(heading);
    if (col==ResultsTable.COLUMN_NOT_FOUND) 
    	col=rt.getFreeColumn(heading);
    int cc=rt.getCounter();
    if (object instanceof double[]) {
        double[] values = (double[]) object;
        for (int i=0; i<values.length; i++){
if (cc<=i) rt.incrementCounter();
            	rt.setValue(col, i, values[i]);
        }
    }
}
 
开发者ID:TOMIGalway,项目名称:cmoct-sourcecode,代码行数:22,代码来源:MIJ.java

示例4: evaluate

import ij.measure.ResultsTable; //导入方法依赖的package包/类
/**
 * Predicate: Apenas para filtrar alternativas que nao foram encontradas particulas
 */
@Override
public boolean evaluate(Object object) {
	CriterionResultVO altRes = (CriterionResultVO) object;
	
	AbstractCriterionVO abstractCriterionVO = altRes.getCriterionCoordinateVO().getAbstractCriterionVO();
	
	if(abstractCriterionVO instanceof AlternativeVO){
		
		ResultsTable rt = altRes.getTransientResultAnalysis();
		return rt.getCounter()>0;
		
	}else{
		return false;
	}
}
 
开发者ID:darciopacifico,项目名称:omr,代码行数:19,代码来源:AlternativeComparator.java

示例5: evaluate

import ij.measure.ResultsTable; //导入方法依赖的package包/类
/**
 * Predicate: Apenas para filtrar alternativas que nao foram encontradas particulas
 */
@Override
public boolean evaluate(Object object) {

	/*
	return false;
	*/
	
	CriterionResultVO altRes = (CriterionResultVO) object;
	
	if("A".equals(altRes.getCritType())){

		ResultsTable rt = altRes.getTransientResultAnalysis();
		
		return rt.getCounter()>0;
		
	}else{
		return false;
	}
	/*
	 */
}
 
开发者ID:darciopacifico,项目名称:omr,代码行数:25,代码来源:AlternativeComparator.java

示例6: createPathObjectsFromROIs

import ij.measure.ResultsTable; //导入方法依赖的package包/类
/**
 * Turn an array of ImageJ ROIs into a list of QuPath PathObjects, optionally adding measurements as well.
 * 
 * @param imp
 * @param rois
 * @param server
 * @param downsample
 * @param asDetection
 * @param includeMeasurements
 * @return
 */
public static List<PathObject> createPathObjectsFromROIs(final ImagePlus imp, final Roi[] rois, final ImageServer<?> server, final double downsample, final boolean asDetection, final boolean includeMeasurements, final int c, final int z, final int t) {
	List<PathObject> pathObjects = new ArrayList<>();
	ResultsTable rt = new ResultsTable();
	Analyzer analyzer = new Analyzer(imp, Analyzer.getMeasurements(), rt);
	String[] headings = null;
	for (Roi roi : rois) {
		PathObject pathObject = IJTools.convertToPathObject(imp, server, roi, downsample, asDetection, c, z, t);
		if (pathObject == null)
			IJ.log("Sorry, I could not convert " + roi + " to a value QuPath object");
		else {
			// Make measurements
			if (includeMeasurements) {
				ImageProcessor ip = imp.getProcessor();
				ip.setRoi(roi);
				ImageStatistics stats = ImageStatistics.getStatistics(ip, Analyzer.getMeasurements(), imp.getCalibration());
				analyzer.saveResults(stats, roi);
				// Get measurements from table and append
				if (headings == null)
					headings = rt.getHeadings();
				int row = rt.getCounter()-1;
				MeasurementList ml = pathObject.getMeasurementList();
				for (String h : headings) {
					if ("Label".equals(h))
						continue;
					ml.putMeasurement(h, rt.getValue(h, row));
				}
				ml.closeList();
			}
			pathObjects.add(pathObject);
		}
	}
	return pathObjects;
}
 
开发者ID:qupath,项目名称:qupath,代码行数:45,代码来源:QUPath_Send_Overlay_to_QuPath.java

示例7: getColumn

import ij.measure.ResultsTable; //导入方法依赖的package包/类
/**
 * Returns a specifying column the current instance of ResultsTable.
 *
 * @param heading	heading of a column
 * @return column specified by its heading
 */
public static Object getColumn(String heading){
    ResultsTable rt=Analyzer.getResultsTable();
    int col= rt.getColumnIndex(heading);
    int counter=rt.getCounter();
    double []results=new double[counter];
    
    results=rt.getColumnAsDoubles(col);
    return results;
}
 
开发者ID:TOMIGalway,项目名称:cmoct-sourcecode,代码行数:16,代码来源:MIJ.java

示例8: comparaQuantidadeResultados

import ij.measure.ResultsTable; //导入方法依赖的package包/类
/**
 * Primeiro criterio de ordenacao. Quantidade de resultados. TODO Predicate ja eliminaria isto, mas vou deixar por enquanto
 * @param rt1
 * @param rt2
 * @return
 */
private int comparaQuantidadeResultados(ResultsTable rt1, ResultsTable rt2) {
	
	int ct1 = rt1.getCounter();
	int ct2 = rt2.getCounter();
	
	//Returns a negative integer, zero, or a positive integer as the first argument is less than, equal to, or greater than the second.
	if(ct1>0 ^ ct2>0){
		//caso uma das tabelas tenha resultado e a outra não 
		return ct1-ct2;
	}
			
	//se ambas tiverem resultados esta comparacao e indeterminada ate aqui
	return 0;
}
 
开发者ID:darciopacifico,项目名称:omr,代码行数:21,代码来源:AlternativeComparator.java

示例9: particleAnaylis

import ij.measure.ResultsTable; //导入方法依赖的package包/类
/**
 * Realiza uma analise de particulas na imagem do bullet. Estes resultados serao analizados juntamente com as outras imagens de bullets de alternativas.
 * 
 * @param bi
 * @return
 */
private ResultsTable particleAnaylis(BufferedImage bi) {

	// wrapper de imagem do ImageJ para analise
	ImagePlus ip = new ImagePlus("bullet", bi);

	// prepara imagem para analise
	contrastImageThresholds(ip, JazzOMRImageParser.THRESHOLD_HUANG);

	// cria tabela de resultados
	ResultsTable rt = new ResultsTable();

	// determina parametros de analise
	double area = bi.getHeight() * bi.getWidth();
	double minArea = area * bulletMinAreaFactor;
	double maxArea = area * bulletMaxAreaFactor;

	/*
	 * private double bulletMinAreaFactor = 0.10; private double bulletMaxAreaFactor = 0.95; private double bulletMinCirc = 0.30;
	 */
	// cria analizador de particulas para bullets
	ParticleAnalyzer jpa = new ParticleAnalyzer(0, Measurements.AREA + Measurements.CIRCULARITY, rt, minArea, maxArea, bulletMinCirc, JazzOMRImageParser.MAX_CIRCULARITY);

	// executa analise
	jpa.analyze(ip);

	// testa se foram encotradas particulas
	boolean checked = rt.getCounter() > 0;

	if (log.isDebugEnabled()) {
		imageDocLogger.logBullet(checked, bi, rt);
	}

	return rt;

}
 
开发者ID:darciopacifico,项目名称:omr,代码行数:42,代码来源:JazzOMRImageParser.java

示例10: logBullet

import ij.measure.ResultsTable; //导入方法依赖的package包/类
/**
 * Log image bullet
 * @param alternativeResultVO
 * @param imgAlternativeAnswer
 * @param rt 
 */
public void logBullet(Boolean checked, BufferedImage imgAlternativeAnswer, ResultsTable rt) {
	if(!log.isDebugEnabled() || imgAlternativeAnswer==null || rt==null ){
		return;
	}
	
	File dirBulletLog = new File("result/bulletLog/");
	
	dirBulletLog.mkdirs();

	double imgArea = imgAlternativeAnswer.getHeight()*imgAlternativeAnswer.getWidth();
	
	int circ=0;
	int area=0;
	int count = rt.getCounter();
	for(int i=0; i<count; i++){

		circ = (int) (getValue(rt, i, COLUMNS_PARTICLE.CIRC)*100);
		area = (int) ((getValue(rt, i, COLUMNS_PARTICLE.AREA)/imgArea)*100);
	}
	
	
	File bulletImg = new File(dirBulletLog,"blt_"+checked+"_"+System.currentTimeMillis()+"_"+circ+"_"+area+"."+this.DEF_IMG_TYPE);
	
	try {
		ImageIO.write(imgAlternativeAnswer, DEF_IMG_TYPE, bulletImg);
	} catch (IOException e) {
		log.error("Erro ao tentar gravar bullet de opcao!",e);
	}
	
}
 
开发者ID:darciopacifico,项目名称:omr,代码行数:37,代码来源:ImageDocLogger.java

示例11: comparaQuantidadeResultados

import ij.measure.ResultsTable; //导入方法依赖的package包/类
/**
 * Primeiro criterio de ordenacao. Quantidade de resultados. TODO Predicate ja eliminaria isto, mas vou deixar por enquanto
 * @param rt1
 * @param rt2
 * @return
 */
private int comparaQuantidadeResultados(ResultsTable rt1, ResultsTable rt2) {
	
	int ct1 = rt1.getCounter();
	int ct2 = rt2.getCounter();
	
	//Returns a negative integer, zero, or a positive integer as the first argument is less than, equal to, or greater than the second.
	if(ct1>0 ^ ct2>0){
		//caso uma das tabelas tenha resultado e a outra n�o 
		return ct1-ct2;
	}
			
	//se ambas tiverem resultados esta comparacao e indeterminada ate aqui
	return 0;
}
 
开发者ID:darciopacifico,项目名称:omr,代码行数:21,代码来源:AlternativeComparator.java

示例12: logBullet

import ij.measure.ResultsTable; //导入方法依赖的package包/类
/**
	 * Log image bullet
	 * @param alternativeResultVO
	 * @param imgAlternativeAnswer
	 * @param rt 
	 */
	public void logBullet(CriterionResultVO criterionResultVO, BufferedImage imgAlternativeAnswer, ResultsTable rt) {
		if(!log.isDebugEnabled() || imgAlternativeAnswer==null || rt==null ){
//			return;
		}
		
		Boolean checked = criterionResultVO.getChecked();
		
		File dirBulletLog = new File("result/bulletLog/");
		
		dirBulletLog.mkdirs();

		double imgArea = imgAlternativeAnswer.getHeight()*imgAlternativeAnswer.getWidth();
		
		int circ=0;
		int area=0;
		int count = rt.getCounter();
		for(int i=0; i<count; i++){

			circ = (int) (getValue(rt, i, COLUMNS_PARTICLE.CIRC)*100);
			area = (int) ((getValue(rt, i, COLUMNS_PARTICLE.AREA)/imgArea)*100);
		}
		
		
		File bulletImg = new File(dirBulletLog,"blt_"+checked+"_"+System.currentTimeMillis()+"_Circ"+circ+"_Area"+area+"."+this.DEF_IMG_TYPE);
		
		try {
			ImageIO.write(imgAlternativeAnswer, DEF_IMG_TYPE, bulletImg);
		} catch (IOException e) {
			log.error("Erro ao tentar gravar bullet de opcao!",e);
		}
		
	}
 
开发者ID:darciopacifico,项目名称:omr,代码行数:39,代码来源:ImageDocLogger.java

示例13: run

import ij.measure.ResultsTable; //导入方法依赖的package包/类
@Override
public void run(String arg) {
    if ("about".equalsIgnoreCase(arg)) {
        IJ.showMessage("About " + TITLE, ABOUT);
        return;
    }

    final Pair<List<ResultsTable>, List<String>> resultTables = listTextWindows();
    if (resultTables.getFirst().size() < 1) {
        IJ.error("Expecting at least one open Result Table window.");
        return;
    }

    final Pair<List<ImagePlus>, List<String>> images = listSupportedImages();
    if (images.getFirst().size() < 1) {
        IJ.error("Expecting at least one open image (that is not indexed color).");
        return;
    }

    // Ask user for image, results table, and other options
    if (!showOptionsDialog(resultTables.getSecond(), images.getSecond())) {
        return;
    }

    if (CONFIG.interpretStackAs3D) {
        IJ.error(TITLE, "Interpreting stacks as 3D images not yet supported.");
        return;
    }

    final ResultsTable rt = resultTables.getFirst().get(CONFIG.tableIndex);
    final ImagePlus imp = images.getFirst().get(CONFIG.imageIndex);

    //
    // Verify that table headings match image bands
    //
    final ImagePlus stack = KMeansClusteringPlugin.convertToFloatStack(imp);

    final int stackSize = stack.getStackSize();
    final String[] bandLabels = stack.getStack().getSliceLabels();
    final String[] expectedHeadings = new String[stackSize + 1];
    expectedHeadings[0] = "Cluster";
    System.arraycopy(bandLabels, 0, expectedHeadings, 1, stackSize);
    final String[] tableHeadings = rt.getHeadings();
    if (tableHeadings.length < expectedHeadings.length) {
        IJ.error(TITLE, "Not enough headings, expecting: " + Arrays.toString(expectedHeadings));
        return;
    }
    for (int i = 0; i < expectedHeadings.length; i++) {
        if (!expectedHeadings[i].equals(tableHeadings[i])) {
            IJ.error(TITLE, "Expecting heading " + (i + 1) + " to be " + expectedHeadings[i] + ", but got: " + tableHeadings[i] + ".");
            return;
        }
    }

    // Read cluster centers from the table
    final int nbClusters = rt.getCounter();
    final float[][] clusterCenters = new float[nbClusters][expectedHeadings.length - 1];
    for (int clusterIndex = 0; clusterIndex < nbClusters; clusterIndex++) {
        for (int bandIndex = 1; bandIndex < expectedHeadings.length; bandIndex++)
            clusterCenters[clusterIndex][bandIndex - 1] = (float) rt.getValueAsDouble(bandIndex, clusterIndex);
    }

    // Apply clustering to input image
    final VectorProcessor vp = new VectorProcessor(stack);
    final ByteProcessor bp = KMeans2D.encodeSegmentedImage(vp, clusterCenters);
    // Apply default color map
    if (KMeansClusteringPlugin.APPLY_LUT) {
        bp.setColorModel(KMeansClusteringPlugin.defaultColorModel());
    }
    if (KMeansClusteringPlugin.AUTO_BRIGHTNESS) {
        bp.setMinAndMax(0, nbClusters);
    }
    new ImagePlus("Clusters", bp).show();

    // Apply clustering
    if (CONFIG.showCentroidImage) {
        final ImageStack clustered = KMeansUtils.encodeCentroidValueImage(clusterCenters, new VectorProcessor(stack));
        final ImagePlus cvImp = KMeansUtils.createCentroidImage(imp.getType(), clustered);
        cvImp.show();
    }
}
 
开发者ID:ij-plugins,项目名称:ijp-toolkit,代码行数:82,代码来源:KMeansClusteringReapplyPlugin.java

示例14: getGreaterParticleValue

import ij.measure.ResultsTable; //导入方法依赖的package包/类
/**
 * Recupera o valor solicitado da particula mais expressiva encontrada na analise
 * @param rt
 * @param column
 * @return
 */
protected double getGreaterParticleValue(ResultsTable rt, COLUMNS_PARTICLE column) {
	
	int count = rt.getCounter();
	
	double area=0;
	double value=0;
	
	
	for (int i=0; i<count; i++){

		double iArea = getValue(rt, i, COLUMNS_PARTICLE.AREA);
		
		if(iArea>area){
			area=iArea;
			value = getValue(rt, i, column);
		}
		
	}
	
	return value;
}
 
开发者ID:darciopacifico,项目名称:omr,代码行数:28,代码来源:AlternativeComparator.java

示例15: sort

import ij.measure.ResultsTable; //导入方法依赖的package包/类
public static void sort(final ResultsTable table, final boolean ascending, final String... columns) {
	
	
	Integer[] rowNumbers = new Integer[table.getCounter()];
	
	for (int i = 0; i < rowNumbers.length; i++)
		rowNumbers[i] = i;
	
	Arrays.sort(rowNumbers, new Comparator<Integer>() {

		@Override
		public int compare(Integer o1, Integer o2) {
			
			for (String column: columns) {
				
				if (table.getColumnIndex(column) != ResultsTable.COLUMN_NOT_FOUND) {
					double value1 = table.getValue(column, o1);
					double value2 = table.getValue(column, o2);
				
					int difference = Double.compare(value1, value2); 
				
					if (difference != 0)
						return ascending ? difference : -difference;
				}
				
			}
			
			return 0;
		}
		
	});
	
	
	// put all rows in the correct order (in-place)
	for (int i = 0; i < rowNumbers.length; i++) {
		int j = rowNumbers[i];
		
		if (i != j) {
			
			while (j < i)	// element at position j was already swapped with another element; find out which element that was
				j = rowNumbers[j];
			
			// swap rows
			for (int k = 0; k <= table.getLastColumn(); k++) {
				
				if (table.columnExists(k)) {
					double d = table.getValueAsDouble(k, i);
					table.setValue(k, i, table.getValueAsDouble(k, j));
					table.setValue(k, j, d);
				}
			}
			
		}
		
	}
	
	table.updateResults();
	
}
 
开发者ID:SingleMolecule,项目名称:smb-plugins,代码行数:60,代码来源:ResultsTableSorter.java


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