Java Code Examples for ij.process.ShortProcessor#setValue()

The following examples show how to use ij.process.ShortProcessor#setValue() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: GeodesicDistanceTransformShort5x5.java    From MorphoLibJ with GNU Lesser General Public License v3.0 6 votes vote down vote up
private ShortProcessor initialize(ImageProcessor marker)
{
	// size of image
	sizeX = marker.getWidth();
	sizeY = marker.getHeight();
	
	ShortProcessor distMap = new ShortProcessor(sizeX, sizeY);
	distMap.setValue(0);
	distMap.fill();

	// initialize empty image with either 0 (foreground) or Inf (background)
	for (int y = 0; y < sizeY; y++) 
	{
		for (int x = 0; x < sizeX; x++) 
		{
			int val = marker.get(x, y) & 0x00ff;
			distMap.set(x, y, val == 0 ? Short.MAX_VALUE : 0);
		}
	}

	return distMap;
}
 
Example 2
Source File: GeodesicDistanceTransformShort.java    From MorphoLibJ with GNU Lesser General Public License v3.0 6 votes vote down vote up
private ShortProcessor initialize(ImageProcessor marker)
{
	// size of image
	sizeX = marker.getWidth();
	sizeY = marker.getHeight();
	
	ShortProcessor distMap = new ShortProcessor(sizeX, sizeY);
	distMap.setValue(0);
	distMap.fill();

	// initialize empty image with either 0 (foreground) or Inf (background)
	for (int y = 0; y < sizeY; y++) 
	{
		for (int x = 0; x < sizeX; x++) 
		{
			int val = marker.get(x, y) & 0x00ff;
			distMap.set(x, y, val == 0 ? Short.MAX_VALUE : 0);
		}
	}

	return distMap;
}
 
Example 3
Source File: DistanceTransform5x5Short.java    From MorphoLibJ with GNU Lesser General Public License v3.0 6 votes vote down vote up
private ShortProcessor initializeResult(ImageProcessor labelImage)
{
	this.fireStatusChanged(new AlgoEvent(this, "Initialization"));

	// size of image
	int sizeX = labelImage.getWidth();
	int sizeY = labelImage.getHeight();

	// create new empty image, and fill it with black
	ShortProcessor distMap = new ShortProcessor(sizeX, sizeY);
	distMap.setValue(0);
	distMap.fill();

	// initialize empty image with either 0 (background) or Inf (foreground)
	for (int y = 0; y < sizeY; y++) 
	{
		for (int x = 0; x < sizeX; x++)
		{
			int label = (int) labelImage.getf(x, y);
			distMap.set(x, y, label == 0 ? 0 : Short.MAX_VALUE);
		}
	}
	
	return distMap;
}
 
Example 4
Source File: DistanceTransform3x3Short.java    From MorphoLibJ with GNU Lesser General Public License v3.0 6 votes vote down vote up
private ShortProcessor initializeResult(ImageProcessor labelImage)
{
	this.fireStatusChanged(new AlgoEvent(this, "Initialization"));

	// size of image
	int sizeX = labelImage.getWidth();
	int sizeY = labelImage.getHeight();

	// create new empty image, and fill it with black
	ShortProcessor distMap = new ShortProcessor(sizeX, sizeY);
	distMap.setValue(0);
	distMap.fill();

	// initialize empty image with either 0 (background) or Inf (foreground)
	for (int y = 0; y < sizeY; y++) 
	{
		for (int x = 0; x < sizeX; x++)
		{
			int label = (int) labelImage.getf(x, y);
			distMap.set(x, y, label == 0 ? 0 : Short.MAX_VALUE);
		}
	}
	
	return distMap;
}