net.imglib2.RealPositionable Java Examples

The following examples show how to use net.imglib2.RealPositionable. 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: OrthoSliceMeshFX.java    From paintera with GNU General Public License v2.0 6 votes vote down vote up
private static void setCoords2D(
		final int col,
		final int row,
		final RealLocalizable min,
		final RealLocalizable max,
		final RealPositionable target)
{
	final int[] pos = new int[] {col, row};
	for (int d = 0; d < 2; ++d) {
		switch (pos[d]) {
			case 0:
				target.setPosition(min.getDoublePosition(d), d);
				break;
			case 1:
				target.setPosition((min.getDoublePosition(d) + max.getDoublePosition(d)) / 2, d);
				break;
			case 2:
				target.setPosition(max.getDoublePosition(d), d);
				break;
		}
	}
}
 
Example #2
Source File: RestrictPainting.java    From paintera with GNU General Public License v2.0 6 votes vote down vote up
private static <P extends RealLocalizable & RealPositionable> P setCoordinates(
		final double x,
		final double y,
		final P location,
		final ViewerPanelFX viewer,
		final AffineTransform3D labelTransform)
{
	location.setPosition(x, 0);
	location.setPosition(y, 1);
	location.setPosition(0, 2);

	viewer.displayToGlobalCoordinates(location);
	labelTransform.applyInverse(location, location);

	return location;
}
 
Example #3
Source File: FloodFill.java    From paintera with GNU General Public License v2.0 6 votes vote down vote up
private static <P extends RealLocalizable & RealPositionable> P setCoordinates(
		final double x,
		final double y,
		final P location,
		final ViewerPanelFX viewer,
		final AffineTransform3D labelTransform)
{
	location.setPosition(x, 0);
	location.setPosition(y, 1);
	location.setPosition(0, 2);

	viewer.displayToGlobalCoordinates(location);
	labelTransform.applyInverse(location, location);

	return location;
}
 
Example #4
Source File: ViewerPanelFX.java    From paintera with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Set {@code gPos} to the display coordinates (x,y,0)<sup>T</sup> transformed into the global coordinate system.
 *
 * @param gPos
 * 		is set to the global coordinates at display (x,y,0)<sup>T</sup>.
 */
public void displayToGlobalCoordinates(final double x, final double y, final RealPositionable gPos)
{
	assert gPos.numDimensions() >= 3;
	final RealPoint lPos = new RealPoint(3);
	lPos.setPosition(x, 0);
	lPos.setPosition(y, 1);
	viewerTransform.applyInverse(gPos, lPos);
}
 
Example #5
Source File: RAIProxy.java    From BigStitcher with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void realMax(RealPositionable max)
{
	loadIfNecessary();
	rai.realMax( max );
	
}
 
Example #6
Source File: RAIProxy.java    From BigStitcher with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void realMin(RealPositionable min)
{
	loadIfNecessary();
	rai.realMin( min );
	
}
 
Example #7
Source File: CoordinateDisplayListener.java    From paintera with GNU General Public License v2.0 5 votes vote down vote up
private static <P extends RealLocalizable & RealPositionable> void toGlobalCoordinate(
		final double x,
		final double y,
		final P p,
		final ViewerPanelFX viewer)
{
	p.setPosition(x, 0);
	p.setPosition(y, 1);
	p.setPosition(0l, 2);
	viewer.displayToGlobalCoordinates(p);
}
 
Example #8
Source File: ViewerPanelFX.java    From paintera with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Set {@code gPos} to the current mouse coordinates transformed into the global coordinate system.
 *
 * @param gPos
 * 		is set to the current global coordinates.
 */
public void getGlobalMouseCoordinates(final RealPositionable gPos)
{
	assert gPos.numDimensions() == 3;
	final RealPoint lPos = new RealPoint(3);
	synchronized (mouseTracker) {
		lPos.setPosition(mouseTracker.getMouseX(), 0);
		lPos.setPosition(mouseTracker.getMouseY(), 1);
	}
	viewerTransform.applyInverse(gPos, lPos);
}
 
Example #9
Source File: ViewerPanelFX.java    From paintera with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Set {@code pos} to the display coordinates (x,y,0)<sup>T</sup> transformed into the source coordinate system.
 *
 * @param pos
 * 		is set to the source coordinates at display (x,y,0)<sup>T</sup>.
 */
public <P extends RealLocalizable & RealPositionable> void displayToSourceCoordinates(
		final double x,
		final double y,
		final AffineTransform3D sourceTransform,
		final P pos)
{
	pos.setPosition(x, 0);
	pos.setPosition(y, 1);
	pos.setPosition(0, 2);
	displayToGlobalCoordinates(pos);
	sourceTransform.applyInverse(pos, pos);
}
 
Example #10
Source File: ViewerPanelFX.java    From paintera with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Set {@code gPos} to the display coordinates at gPos transformed into the global coordinate system.
 *
 * @param gPos
 * 		is set to the corresponding global coordinates.
 */
public <P extends RealLocalizable & RealPositionable> void displayToGlobalCoordinates(final P gPos)
{
	assert gPos.numDimensions() >= 3;

	viewerTransform.applyInverse(gPos, gPos);
}
 
Example #11
Source File: DefaultDetectJunctions.java    From imagej-ops with BSD 2-Clause "Simplified" License 4 votes vote down vote up
private <L extends RealLocalizable & RealPositionable> void parallelRoutine(
	RealLocalizableRealPositionable p1, RealLocalizableRealPositionable p2,
	RealLocalizableRealPositionable q1, RealLocalizableRealPositionable q2,
	List<RealPoint> junctions, boolean areVertical)
{

	// find out whether or not they are on the same line
	boolean sameLine = false;
	if (areVertical && Math.round(p1.getDoublePosition(0)) == Math.round(q1
		.getDoublePosition(0))) sameLine = true;
	else {
		double m = (q2.getDoublePosition(1) - q1.getDoublePosition(1)) / (q2
			.getDoublePosition(0) - q1.getDoublePosition(0));
		double bp = (p2.getDoublePosition(1) - m * p2.getDoublePosition(0));
		double bq = (q2.getDoublePosition(1) - m * q2.getDoublePosition(0));

		if (bp == bq) sameLine = true;
	}

	// if the two line segments do not belong to the same line, then if the
	// minimum distance between the two points is greater than the threshold,
	// there is no junction
	if (!sameLine && Math.min(Math.min(getDistance(p1, q1), getDistance(p2,
		q1)), Math.min(getDistance(p1, q2), getDistance(p2, q2))) > threshold)
		return;

	int foundJunctions = 0;
	double lengthp = getDistance(p1, p2);
	double lengthq = getDistance(q1, q2);
	// if p and q are segments on the same line, then p1, p2, q1, and q2 can all
	// be junctions. There can be at most 2 junctions between these two line
	// segments.
	// check p1 to be a junction
	if ((getDistance(p1, q1) < lengthq && getDistance(p1, q2) < lengthq &&
		sameLine) || Math.min(getDistance(p1, q1), getDistance(p1,
			q2)) < threshold)
	{
		junctions.add(makeRealPoint(p1));
		foundJunctions++;
	}
	// check p2 to be a junction
	if ((getDistance(p2, q1) < lengthq && getDistance(p2, q2) < lengthq &&
		sameLine) || Math.min(getDistance(p2, q1), getDistance(p2,
			q2)) < threshold)
	{
		junctions.add(makeRealPoint(p2));
		foundJunctions++;
	}

	// check q1 to be a junction
	if (((getDistance(q1, p1) < lengthp && getDistance(q1, p2) < lengthp &&
		sameLine) || (Math.min(getDistance(q1, p1), getDistance(q1,
			p2)) < threshold)) && foundJunctions < 2)
	{
		junctions.add(makeRealPoint(q1));
		foundJunctions++;
	}

	// check q2 to be a junction
	if (((getDistance(q2, p1) < lengthp && getDistance(q2, p2) < lengthp &&
		sameLine) || (Math.min(getDistance(q2, p1), getDistance(q2,
			p2)) < threshold)) && foundJunctions < 2)
	{
		junctions.add(makeRealPoint(q2));
		foundJunctions++;
	}
}
 
Example #12
Source File: BoundingBox.java    From SPIM_Registration with GNU General Public License v2.0 4 votes vote down vote up
@Override
public void realMin( final RealPositionable min ) { min.setPosition( this.min ); }
 
Example #13
Source File: BoundingBox.java    From SPIM_Registration with GNU General Public License v2.0 4 votes vote down vote up
@Override
public void realMax( final RealPositionable max ) { max.setPosition( this.max ); }
 
Example #14
Source File: TransformedRealRandomAccessibleInterval.java    From SPIM_Registration with GNU General Public License v2.0 4 votes vote down vote up
@Override
public void realMin( final RealPositionable min ) { transformedInterval.realMin( min ); }
 
Example #15
Source File: TransformedRealRandomAccessibleInterval.java    From SPIM_Registration with GNU General Public License v2.0 4 votes vote down vote up
@Override
public void realMax( final RealPositionable max ) { transformedInterval.realMax( max ); }
 
Example #16
Source File: NormalizingRandomAccessibleInterval.java    From SPIM_Registration with GNU General Public License v2.0 4 votes vote down vote up
@Override
public void realMin( final RealPositionable min ) { interval.realMin( min ); }
 
Example #17
Source File: NormalizingRandomAccessibleInterval.java    From SPIM_Registration with GNU General Public License v2.0 4 votes vote down vote up
@Override
public void realMax( final RealPositionable max ) { interval.realMax( max ); }