本文整理汇总了Java中net.imglib2.img.basictypeaccess.array.ShortArray类的典型用法代码示例。如果您正苦于以下问题:Java ShortArray类的具体用法?Java ShortArray怎么用?Java ShortArray使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ShortArray类属于net.imglib2.img.basictypeaccess.array包,在下文中一共展示了ShortArray类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createUnsignedShortInstance
import net.imglib2.img.basictypeaccess.array.ShortArray; //导入依赖的package包/类
@SuppressWarnings( "unchecked" )
public static BigWarpImageStackImageLoader< UnsignedShortType, ShortArray > createUnsignedShortInstance( final ImagePlus imp, int[] ids )
{
return new BigWarpImageStackImageLoader< UnsignedShortType, ShortArray >( new UnsignedShortType(), imp, ids )
{
@Override
protected ShortArray wrapPixels( final Object array )
{
return new ShortArray( ( short[] ) array );
}
@Override
protected void linkType( final PlanarImg< UnsignedShortType, ShortArray > img )
{
img.setLinkedType( new UnsignedShortType( img ) );
}
};
}
示例2: createImg
import net.imglib2.img.basictypeaccess.array.ShortArray; //导入依赖的package包/类
private static final Img<?> createImg(final BufferedImage bi) {
final long[] dims = new long[]{bi.getWidth(), bi.getHeight()};
switch (bi.getType()) {
case BufferedImage.TYPE_BYTE_GRAY:
case BufferedImage.TYPE_BYTE_INDEXED:
ByteArray ba = new ByteArray(((DataBufferByte)bi.getRaster().getDataBuffer()).getData());
ArrayImg<UnsignedByteType, ByteArray> b = new ArrayImg<UnsignedByteType, ByteArray>(ba, dims, new Fraction());
b.setLinkedType(new UnsignedByteType(b));
return b;
case BufferedImage.TYPE_USHORT_GRAY:
ShortArray sa = new ShortArray(((DataBufferShort)bi.getRaster().getDataBuffer()).getData());
ArrayImg<UnsignedShortType, ShortArray> s = new ArrayImg<UnsignedShortType, ShortArray>(sa, dims, new Fraction());
s.setLinkedType(new UnsignedShortType(s));
return s;
case BufferedImage.TYPE_INT_RGB:
case BufferedImage.TYPE_INT_ARGB:
IntArray ia = new IntArray(((DataBufferInt)bi.getRaster().getDataBuffer()).getData());
ArrayImg<ARGBType, IntArray> i = new ArrayImg<ARGBType, IntArray>(ia, dims, new Fraction());
i.setLinkedType(new ARGBType(i));
return i;
}
throw new UnsupportedOperationException("Cannot wrap images of type " + bi.getType());
}
示例3: createUnsignedShortInstance
import net.imglib2.img.basictypeaccess.array.ShortArray; //导入依赖的package包/类
public static ImageStackImageLoader< UnsignedShortType, ShortArray > createUnsignedShortInstance( final ImagePlus imp )
{
return new ImageStackImageLoader< UnsignedShortType, ShortArray >( new UnsignedShortType(), imp )
{
@Override
protected ShortArray wrapPixels( final Object array )
{
return new ShortArray( ( short[] ) array );
}
@Override
protected void linkType( final PlanarImg< UnsignedShortType, ShortArray > img )
{
img.setLinkedType( new UnsignedShortType( img ) );
}
};
}
示例4: multiply
import net.imglib2.img.basictypeaccess.array.ShortArray; //导入依赖的package包/类
@OpMethod(ops = {
net.imagej.ops.math.ConstantToArrayImageP.MultiplyShort.class,
net.imagej.ops.math.ConstantToArrayImage.MultiplyShort.class,
net.imagej.ops.math.ConstantToArrayImageP.MultiplyUnsignedShort.class,
net.imagej.ops.math.ConstantToArrayImage.MultiplyUnsignedShort.class })
public <S extends GenericShortType<S>> ArrayImg<S, ShortArray> multiply(
final ArrayImg<S, ShortArray> image, final short value)
{
@SuppressWarnings("unchecked")
final ArrayImg<S, ShortArray> result = (ArrayImg<S, ShortArray>) ops().run(
Ops.Math.Multiply.NAME, image, value);
return result;
}
示例5: add
import net.imglib2.img.basictypeaccess.array.ShortArray; //导入依赖的package包/类
@OpMethod(ops = { net.imagej.ops.math.ConstantToPlanarImage.AddShort.class,
net.imagej.ops.math.ConstantToPlanarImage.AddUnsignedShort.class })
public <S extends GenericShortType<S>> PlanarImg<S, ShortArray> add(
final PlanarImg<S, ShortArray> arg, final short value)
{
@SuppressWarnings("unchecked")
final PlanarImg<S, ShortArray> result = (PlanarImg<S, ShortArray>) ops()
.run(Ops.Math.Add.NAME, arg, value);
return result;
}
示例6: divide
import net.imglib2.img.basictypeaccess.array.ShortArray; //导入依赖的package包/类
@OpMethod(ops = { net.imagej.ops.math.ConstantToArrayImageP.DivideShort.class,
net.imagej.ops.math.ConstantToArrayImage.DivideShort.class,
net.imagej.ops.math.ConstantToArrayImageP.DivideUnsignedShort.class,
net.imagej.ops.math.ConstantToArrayImage.DivideUnsignedShort.class })
public <S extends GenericShortType<S>> ArrayImg<S, ShortArray> divide(
final ArrayImg<S, ShortArray> image, final short value)
{
@SuppressWarnings("unchecked")
final ArrayImg<S, ShortArray> result = (ArrayImg<S, ShortArray>) ops().run(
Ops.Math.Divide.NAME, image, value);
return result;
}
示例7: subtract
import net.imglib2.img.basictypeaccess.array.ShortArray; //导入依赖的package包/类
@OpMethod(ops = {
net.imagej.ops.math.ConstantToArrayImageP.SubtractShort.class,
net.imagej.ops.math.ConstantToArrayImage.SubtractShort.class,
net.imagej.ops.math.ConstantToArrayImageP.SubtractUnsignedShort.class,
net.imagej.ops.math.ConstantToArrayImage.SubtractUnsignedShort.class })
public <S extends GenericShortType<S>> ArrayImg<S, ShortArray> subtract(
final ArrayImg<S, ShortArray> image, final short value)
{
@SuppressWarnings("unchecked")
final ArrayImg<S, ShortArray> result = (ArrayImg<S, ShortArray>) ops().run(
Ops.Math.Subtract.NAME, image, value);
return result;
}
示例8: createInstance
import net.imglib2.img.basictypeaccess.array.ShortArray; //导入依赖的package包/类
@Override
public
SCIFIOCellImg<T, ShortArray>
createShortInstance(final long[] dimensions, final Fraction entitiesPerPixel)
{
return createInstance(new ShortArrayLoader(reader(), subregion),
dimensions, entitiesPerPixel);
}
示例9: main
import net.imglib2.img.basictypeaccess.array.ShortArray; //导入依赖的package包/类
public static void main( final String[] args )
{
new ImageJ();
final double[] coefficients = new double[]{
0, 2, 4, 8,
1, 1, 1, 1,
1, 10, 5, 1,
1, 1, 1, 1,
0, 10, 20, 30,
40, 50, 60, 70,
80, 90, 100, 110,
120, 130, 140, 150
};
final LinearIntensityMap< DoubleType > transform = new LinearIntensityMap< DoubleType >( ArrayImgs.doubles( coefficients, 4, 4, 2 ) );
//final ImagePlus imp = new ImagePlus( "http://upload.wikimedia.org/wikipedia/en/2/24/Lenna.png" );
final ImagePlus imp1 = new ImagePlus( "http://fly.mpi-cbg.de/~saalfeld/Pictures/norway.jpg");
final ArrayImg< FloatType, FloatArray > image1 = ArrayImgs.floats( ( float[] )imp1.getProcessor().convertToFloatProcessor().getPixels(), imp1.getWidth(), imp1.getHeight() );
final ArrayImg< UnsignedByteType, ByteArray > image2 = ArrayImgs.unsignedBytes( ( byte[] )imp1.getProcessor().convertToByteProcessor().getPixels(), imp1.getWidth(), imp1.getHeight() );
final ArrayImg< UnsignedShortType, ShortArray > image3 = ArrayImgs.unsignedShorts( ( short[] )imp1.getProcessor().convertToShortProcessor().getPixels(), imp1.getWidth(), imp1.getHeight() );
final ArrayImg< ARGBType, IntArray > image4 = ArrayImgs.argbs( ( int[] )imp1.getProcessor().getPixels(), imp1.getWidth(), imp1.getHeight() );
ImageJFunctions.show( ArrayImgs.doubles( coefficients, 4, 4, 2 ) );
transform.run( image1 );
transform.run( image2 );
transform.run( image3 );
transform.run( image4 );
ImageJFunctions.show( image1 );
ImageJFunctions.show( image2 );
ImageJFunctions.show( image3 );
ImageJFunctions.show( image4 );
}
示例10: UnsignedShortImage
import net.imglib2.img.basictypeaccess.array.ShortArray; //导入依赖的package包/类
public UnsignedShortImage(final long[] dim, final short[] pixels) {
super(new ShortArray(pixels), dim, new Fraction());
setLinkedType(new UnsignedShortType(this));
}
示例11: emptyArray
import net.imglib2.img.basictypeaccess.array.ShortArray; //导入依赖的package包/类
@Override
public ShortArray emptyArray(final int entities) {
return new ShortArray(entities);
}