本文整理汇总了Java中mpicbg.models.NoninvertibleModelException类的典型用法代码示例。如果您正苦于以下问题:Java NoninvertibleModelException类的具体用法?Java NoninvertibleModelException怎么用?Java NoninvertibleModelException使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
NoninvertibleModelException类属于mpicbg.models包,在下文中一共展示了NoninvertibleModelException类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: applyInverseInPlace
import mpicbg.models.NoninvertibleModelException; //导入依赖的package包/类
@Override
public void applyInverseInPlace(double[] l)
throws NoninvertibleModelException
{
if ( isInvertible )
{
final double l0 = l[ 0 ];
final double l1 = l[ 1 ];
l[ 0 ] = l0 * i00 + l1 * i01 + l[ 2 ] * i02 + i03;
l[ 1 ] = l0 * i10 + l1 * i11 + l[ 2 ] * i12 + i13;
l[ 2 ] = l0 * i20 + l1 * i21 + l[ 2 ] * i22 + i23;
}
else
throw new NoninvertibleModelException( "Model not invertible." );
}
示例2: process
import mpicbg.models.NoninvertibleModelException; //导入依赖的package包/类
public <T extends RealType<T>> void process( Img<T> img )
{
// Define the transformation model
RigidModel2D model = new RigidModel2D();
model.set( (float)Math.toRadians( 15 ), 0, 0 );
// Define the transformation model
//TranslationModel2D model = new TranslationModel2D();
//model.set( 10.1f, -12.34f );
try
{
// compute the gradient on the image
Img<T> transformed = transform( img, model );
// show the new Img that contains the gradient
ImageJFunctions.show( transformed );
}
catch ( NoninvertibleModelException e )
{
IJ.log( model + " cannot be inverted: " + e );
}
}
示例3: run
import mpicbg.models.NoninvertibleModelException; //导入依赖的package包/类
@Override
public void run() {
// get chunk of pixels to process
final Chunk myChunk = threadChunks.get(threadNumber);
loopOffset = (int) myChunk.getStartPosition();
loopSize = (int) myChunk.getLoopSize();
try {
// Process each tile index assigned to this thread
// For each position in this tile, fuse its pixels across the
// appropriate images
// NB: recursion is necessary because there are an arbitrary
// number of dimensions in the tile
processTile(currentTile[0], 0, myFusion, transform, in, out, inPos,
threadNumber, count, lastDraw, fusionImp[0]);
}
catch (NoninvertibleModelException e) {
Log.error("Cannot invert model, qutting.");
return;
}
}
示例4: getLocalCoordinates
import mpicbg.models.NoninvertibleModelException; //导入依赖的package包/类
/**
* @param x world x coordinate to inversely transform into local coordinate.
* @param y world y coordinate to inversely transform into local coordinate.
*
* @return local coordinates (x, y, z) for the specified world coordinates.
*
* @throws IllegalStateException
* if width or height have not been defined for this tile.
*
* @throws NoninvertibleModelException
* if this tile's transforms cannot be inverted for the specified point.
*/
public double[] getLocalCoordinates(final double x, final double y, final double meshCellSize)
throws IllegalStateException, NoninvertibleModelException {
final double[] localCoordinates;
final double[] l = new double[] {x, y};
if (hasTransforms()) {
final CoordinateTransformMesh mesh = getCoordinateTransformMesh(meshCellSize);
mesh.applyInverseInPlace(l);
}
if (z == null) {
localCoordinates = l;
} else {
localCoordinates = new double[]{l[0], l[1], z};
}
return localCoordinates;
}
示例5: convertMatchesToLocal
import mpicbg.models.NoninvertibleModelException; //导入依赖的package包/类
public static List<PointMatch> convertMatchesToLocal(final List<PointMatch> worldMatchList,
final TileSpec pMatchTileSpec,
final TileSpec qMatchTileSpec) {
final List<PointMatch> localMatchList = new ArrayList<>(worldMatchList.size());
Point pPoint;
Point qPoint;
for (final PointMatch worldMatch : worldMatchList) {
try {
pPoint = getLocalPoint(worldMatch.getP1(), pMatchTileSpec);
qPoint = getLocalPoint(worldMatch.getP2(), qMatchTileSpec);
localMatchList.add(new PointMatch(pPoint, qPoint));
} catch (final NoninvertibleModelException e) {
LOG.warn("skipping match", e);
}
}
return localMatchList;
}
示例6: toPixelCoordinate
import mpicbg.models.NoninvertibleModelException; //导入依赖的package包/类
/**
* @see Patch#toPixelCoordinate(double, double)
* @param world_x The X of the world coordinate (in pixels, uncalibrated)
* @param world_y The Y of the world coordinate (in pixels, uncalibrated)
* @param aff The {@link AffineTransform} of the {@link Patch}.
* @param ct The {@link CoordinateTransform} of the {@link Patch}, if any (can be null).
* @param meshResolution The precision demanded for approximating a transform with a {@link TransformMesh}.
* @param o_width The width of the image underlying the {@link Patch}.
* @param o_height The height of the image underlying the {@link Patch}.
* @return A {@code double[]} array with the x,y values.
* @throws NoninvertibleTransformException
*/
static public final double[] toPixelCoordinate(final double world_x, final double world_y,
final AffineTransform aff, final CoordinateTransform ct,
final int meshResolution, final int o_width, final int o_height) throws NoninvertibleTransformException {
// Inverse the affine
final double[] d = new double[]{world_x, world_y};
aff.inverseTransform(d, 0, d, 0, 1);
// Inverse the coordinate transform
if (null != ct) {
final double[] f = new double[]{d[0], d[1]};
final mpicbg.models.InvertibleCoordinateTransform t =
mpicbg.models.InvertibleCoordinateTransform.class.isAssignableFrom(ct.getClass()) ?
(mpicbg.models.InvertibleCoordinateTransform) ct
: new mpicbg.trakem2.transform.TransformMesh(ct, meshResolution, o_width, o_height);
try { t.applyInverseInPlace(f); } catch ( final NoninvertibleModelException e ) {}
d[0] = f[0];
d[1] = f[1];
}
return d;
}
示例7: applyTransformToImageInverse
import mpicbg.models.NoninvertibleModelException; //导入依赖的package包/类
ImageProcessor applyTransformToImageInverse(
final AbstractAffineModel2D< ? > a, final ImageProcessor ip){
final ImageProcessor newIp = ip.duplicate();
newIp.max(0.0);
for (int x=0; x<ip.getWidth(); x++){
for (int y=0; y<ip.getHeight(); y++){
final double[] position = new double[]{x,y};
// float[] newPosition = a.apply(position);
double[] newPosition = new double[]{0,0};
try
{
newPosition = a.applyInverse(position);
}
catch ( final NoninvertibleModelException e ) {}
final int xn = (int) newPosition[0];
final int yn = (int) newPosition[1];
if ( (xn >= 0) && (yn >= 0) && (xn < ip.getWidth()) && (yn < ip.getHeight()))
newIp.set(xn,yn,ip.get(x,y));
}
}
return newIp;
}
示例8: applyInverse
import mpicbg.models.NoninvertibleModelException; //导入依赖的package包/类
@Override
public double[] applyInverse( double[] l )
throws NoninvertibleModelException
{
final double[] transformed = l.clone();
applyInverseInPlace( transformed );
return transformed;
}
示例9: processTile
import mpicbg.models.NoninvertibleModelException; //导入依赖的package包/类
/**
* Intermediate helper method to delegate to
* {@link #processTile(ClassifiedRegion, int[], int, PixelFusion, ArrayList, ArrayList, LocalizableByDimCursor, float[], int[], int, int[], long[], ImagePlus)}
*/
private void processTile(ClassifiedRegion r, int depth,
PixelFusion myFusion, ArrayList<InvertibleBoundable> transform,
ArrayList<RealRandomAccess<? extends RealType<?>>> in,
RandomAccess<T> out, double[][] inPos,
int threadNumber, int[] count, long[] lastDraw, ImagePlus fusionImp)
throws NoninvertibleModelException
{
processTile(r, r.classArray(), depth, myFusion, transform, in, out,
inPos, threadNumber, count, lastDraw, fusionImp);
}
示例10: applyInverse
import mpicbg.models.NoninvertibleModelException; //导入依赖的package包/类
@Override
public double[] applyInverse(final double[] location) throws NoninvertibleModelException {
assert location.length == 2 : "2d transform meshs can be applied to 2d points only.";
final double[] transformed = location.clone();
applyInverseInPlace(transformed);
return transformed;
}
示例11: applyInverseInPlace
import mpicbg.models.NoninvertibleModelException; //导入依赖的package包/类
@Override
public void applyInverseInPlace(final double[] location) throws NoninvertibleModelException {
assert location.length == 2 : "2d transform meshs can be applied to 2d points only.";
for (final Pair<AffineModel2D, double[][]> apq : av) {
if (isInTargetTriangle(apq.b, location)) {
apq.a.applyInPlace(location);
return;
}
}
throw new NoninvertibleModelException("Noninvertible location ( " + location[0] + ", " + location[1] + " )");
}
示例12: getLocalPoint
import mpicbg.models.NoninvertibleModelException; //导入依赖的package包/类
public static Point getLocalPoint(final Point worldPoint,
final TileSpec tileSpec)
throws NoninvertibleModelException {
final double[] world = worldPoint.getL();
final double[] local = tileSpec.getLocalCoordinates(world[0], world[1], tileSpec.getMeshCellSize());
return new Point(local);
}
示例13: invert
import mpicbg.models.NoninvertibleModelException; //导入依赖的package包/类
final static public void invert( double[] a ) throws NoninvertibleModelException
{
assert a.length == 9 : "Matrix3x3 supports 3x3 double[][] only.";
final double det = det( a );
if ( det == 0 ) throw new NoninvertibleModelException( "Matrix not invertible." );
final double i00 = ( a[ 4 ] * a[ 8 ] - a[ 5 ] * a[ 7 ] ) / det;
final double i01 = ( a[ 2 ] * a[ 7 ] - a[ 1 ] * a[ 8 ] ) / det;
final double i02 = ( a[ 1 ] * a[ 5 ] - a[ 2 ] * a[ 4 ] ) / det;
final double i10 = ( a[ 5 ] * a[ 6 ] - a[ 3 ] * a[ 8 ] ) / det;
final double i11 = ( a[ 0 ] * a[ 8 ] - a[ 2 ] * a[ 6 ] ) / det;
final double i12 = ( a[ 2 ] * a[ 3 ] - a[ 0 ] * a[ 5 ] ) / det;
final double i20 = ( a[ 3 ] * a[ 7 ] - a[ 4 ] * a[ 6 ] ) / det;
final double i21 = ( a[ 1 ] * a[ 6 ] - a[ 0 ] * a[ 7 ] ) / det;
final double i22 = ( a[ 0 ] * a[ 4 ] - a[ 1 ] * a[ 3 ] ) / det;
a[ 0 ] = i00;
a[ 1 ] = i01;
a[ 2 ] = i02;
a[ 3 ] = i10;
a[ 4 ] = i11;
a[ 5 ] = i12;
a[ 6 ] = i20;
a[ 7 ] = i21;
a[ 8 ] = i22;
}
示例14: applyInverseInPlace
import mpicbg.models.NoninvertibleModelException; //导入依赖的package包/类
final public static void applyInverseInPlace( final AbstractAffineModel3D<?> m, final Point3d p ) throws NoninvertibleModelException
{
final double[] tmp = new double[ 3 ];
tmp[ 0 ] = p.x;
tmp[ 1 ] = p.y;
tmp[ 2 ] = p.z;
m.applyInverseInPlace( tmp );
p.x = tmp[ 0 ];
p.y = tmp[ 1 ];
p.z = tmp[ 2 ];
}
示例15: intersects
import mpicbg.models.NoninvertibleModelException; //导入依赖的package包/类
/** Returns true if fo[0,1] x,y world coords intersect the affine and potentially coordinate transformed pixels of the other Patch. */
static private double intersects(final double[] fo, final Patch other, final TransformMesh mesh) {
// First inverse affine transform
final AffineTransform at = other.getAffineTransform();
final Point2D.Double po = new Point2D.Double(fo[0], fo[1]);
final int o_width = other.getOWidth();
final int o_height = other.getOHeight();
try {
at.inverseTransform(po, po);
} catch (final NoninvertibleTransformException nite) {
return -1;
}
if (null == mesh) {
if (po.x >= 0 && po.x < o_width
&& po.y >= 0 && po.y < o_height) {
return computeWeight(po.x, po.y, o_width, o_height);
} else {
return -1;
}
}
// Then inverse the coordinate transform
try {
fo[0] = po.x;
fo[1] = po.y;
mesh.applyInverseInPlace(fo);
return computeWeight(fo[0], fo[1], o_width, o_height);
} catch (final NoninvertibleModelException nime) {
// outside boundaries
return -1;
}
}