本文整理汇总了Java中net.imglib2.type.numeric.integer.UnsignedByteType.set方法的典型用法代码示例。如果您正苦于以下问题:Java UnsignedByteType.set方法的具体用法?Java UnsignedByteType.set怎么用?Java UnsignedByteType.set使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.imglib2.type.numeric.integer.UnsignedByteType
的用法示例。
在下文中一共展示了UnsignedByteType.set方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: example3
import net.imglib2.type.numeric.integer.UnsignedByteType; //导入方法依赖的package包/类
public static void example3()
{
final ImgFactory< UnsignedByteType > imgFactory = new ArrayImgFactory< UnsignedByteType >();
Img< UnsignedByteType > image = imgFactory.create( new int[] { DIM, DIM, DIM }, new UnsignedByteType() );
long[][] centers = new long[][] { { 50, 50, 50 }, { 20, 20, 50 }, { 20, 70, 50 }, { 70, 70, 50 }, { 70, 20, 50 }
};
long[][] spans = new long[][] { { 20, 10, 15 }, { 20, 15, 1 }, { 1, 20, 15 }, { 20, 1, 15 }, { 20, 1, 1 } };
for ( int i = 0; i < spans.length; i++ )
{
EllipsoidNeighborhood< UnsignedByteType > ellipsoid = new EllipsoidNeighborhood< UnsignedByteType >( image, centers[i], spans[i] );
// Write into the image
int val = 200;
for ( UnsignedByteType pixel : ellipsoid )
{
pixel.set( val );
// val++;
}
}
ImageJFunctions.show( image );
}
示例2: standardErode
import net.imglib2.type.numeric.integer.UnsignedByteType; //导入方法依赖的package包/类
public static void standardErode() {
final ArrayImg<UnsignedByteType, ByteArray> img = ArrayImgs.unsignedBytes(new long[] { 10, 9 });
for (final UnsignedByteType pixel : img) {
pixel.set(255);
}
final ArrayRandomAccess<UnsignedByteType> ra = img.randomAccess();
ra.setPosition(new int[] { 1, 4 });
ra.get().set(0);
final Shape strel = new CenteredRectangleShape(new int[] { 3, 2 }, false);
// final Shape strel = new HyperSphereShape(radius)
final Img< UnsignedByteType > full = Erosion.erodeFull( img, strel, 4 );
final Img< UnsignedByteType > std = Erosion.erode( img, strel, 4 );
new ImageJ();
ImageJFunctions.show(img);
ImageJFunctions.show(full);
ImageJFunctions.show(std);
}
示例3: loadUnsignedByte
import net.imglib2.type.numeric.integer.UnsignedByteType; //导入方法依赖的package包/类
/**
* Load an HDF5 uint8 dataset into a {@link CellImg} of {@link UnsignedByteType}.
*
* @param reader
* @param dataset
* @param cellDimensions
*/
static public CellImg< UnsignedByteType, ? > loadUnsignedByte(
final IHDF5Reader reader,
final String dataset,
final int[] cellDimensions )
{
final IHDF5ByteReader uint8Reader = reader.uint8();
final long[] dimensions = reorder( reader.object().getDimensions( dataset ) );
final int n = dimensions.length;
final CellImg< UnsignedByteType, ? > target = new CellImgFactory< UnsignedByteType >( cellDimensions ).create( dimensions, new UnsignedByteType() );
final long[] offset = new long[ n ];
final long[] targetCellDimensions = new long[ n ];
for ( int d = 0; d < n; )
{
cropCellDimensions( target, offset, cellDimensions, targetCellDimensions );
final RandomAccessibleInterval< UnsignedByteType > targetBlock = Views.offsetInterval( target, offset, targetCellDimensions );
final MDByteArray targetCell = uint8Reader.readMDArrayBlockWithOffset(
dataset,
Util.long2int( reorder( targetCellDimensions ) ),
reorder( offset ) );
int i = 0;
for ( final UnsignedByteType t : Views.flatIterable( targetBlock ) )
t.set( targetCell.get( i++ ) );
for ( d = 0; d < n; ++d )
{
offset[ d ] += cellDimensions[ d ];
if ( offset[ d ] < dimensions[ d ] )
break;
else
offset[ d ] = 0;
}
}
return target;
}
示例4: invertImage
import net.imglib2.type.numeric.integer.UnsignedByteType; //导入方法依赖的package包/类
/** Generic version. */
@SuppressWarnings("unused")
private void invertImage(final Img<UnsignedByteType> img) {
for (final UnsignedByteType t : img) {
final int value = t.get();
final int result = 255 - value;
t.set(result);
}
}
示例5: invertArrayImage
import net.imglib2.type.numeric.integer.UnsignedByteType; //导入方法依赖的package包/类
/** Explicit array version. */
private void invertArrayImage(final Img<UnsignedByteType> img) {
final ArrayCursor<UnsignedByteType> c =
(ArrayCursor<UnsignedByteType>) img.cursor();
while (c.hasNext()) {
final UnsignedByteType t = c.next();
final int value = t.get();
final int result = 255 - value;
t.set(result);
}
}
示例6: invertImagePlusImage
import net.imglib2.type.numeric.integer.UnsignedByteType; //导入方法依赖的package包/类
/** Explicit ImagePlus version. */
private void invertImagePlusImage(final Img<UnsignedByteType> img) {
final PlanarCursor<UnsignedByteType> c =
(PlanarCursor<UnsignedByteType>) img.cursor();
while (c.hasNext()) {
final UnsignedByteType t = c.next();
final int value = t.get();
final int result = 255 - value;
t.set(result);
}
}
示例7: randomizeImage
import net.imglib2.type.numeric.integer.UnsignedByteType; //导入方法依赖的package包/类
/** Generic version. */
@SuppressWarnings("unused")
private void randomizeImage(final Img<UnsignedByteType> img) {
for (final UnsignedByteType t : img) {
final int value = t.get();
final double result = expensiveOperation(value);
t.set((int) result);
}
}
示例8: randomizeCellImage
import net.imglib2.type.numeric.integer.UnsignedByteType; //导入方法依赖的package包/类
/** Explicit cell version. */
private void randomizeCellImage(final Img<UnsignedByteType> img) {
@SuppressWarnings("unchecked")
final CellCursor<UnsignedByteType, ?> c =
(CellCursor<UnsignedByteType, ?>) img
.cursor();
while (c.hasNext()) {
final UnsignedByteType t = c.next();
final int value = t.get();
final double result = expensiveOperation(value);
t.set((int) result);
}
}
示例9: randomizePlanarImage
import net.imglib2.type.numeric.integer.UnsignedByteType; //导入方法依赖的package包/类
/** Explicit planar version. */
private void randomizePlanarImage(final Img<UnsignedByteType> img) {
final PlanarCursor<UnsignedByteType> c =
(PlanarCursor<UnsignedByteType>) img.cursor();
while (c.hasNext()) {
final UnsignedByteType t = c.next();
final int value = t.get();
final double result = expensiveOperation(value);
t.set((int) result);
}
}
示例10: randomizeImagePlusImage
import net.imglib2.type.numeric.integer.UnsignedByteType; //导入方法依赖的package包/类
/** Explicit ImagePlus version. */
private void randomizeImagePlusImage(final Img<UnsignedByteType> img) {
final PlanarCursor<UnsignedByteType> c =
(PlanarCursor<UnsignedByteType>) img.cursor();
while (c.hasNext()) {
final UnsignedByteType t = c.next();
final int value = t.get();
final double result = expensiveOperation(value);
t.set((int) result);
}
}
示例11: createImage
import net.imglib2.type.numeric.integer.UnsignedByteType; //导入方法依赖的package包/类
private Img< UnsignedByteType > createImage(final long[] dims, final ImgFactory< UnsignedByteType > cf )
{
final Img< UnsignedByteType > img = cf.create( dims, new UnsignedByteType() );
long i = 0;
for ( final UnsignedByteType t : img )
t.set( ( int ) ( i++ % 256 ) );
return img;
}
示例12: randomizeCellImage
import net.imglib2.type.numeric.integer.UnsignedByteType; //导入方法依赖的package包/类
/** Explicit cell version. */
private void randomizeCellImage(final CellImg<UnsignedByteType, ByteArray> img) {
final CellCursor< UnsignedByteType, ? > c = img.cursor();
while ( c.hasNext() ) {
final UnsignedByteType t = c.next();
final int value = t.get();
final double result = expensiveOperation(value);
t.set((int) result);
}
}
示例13: randomizePlanarImage
import net.imglib2.type.numeric.integer.UnsignedByteType; //导入方法依赖的package包/类
/** Explicit planar version. */
private void randomizePlanarImage(final PlanarImg<UnsignedByteType, ByteArray> img) {
final PlanarCursor<UnsignedByteType> c = img.cursor();
while ( c.hasNext() ) {
final UnsignedByteType t = c.next();
final int value = t.get();
final double result = expensiveOperation(value);
t.set((int) result);
}
}
示例14: invertPlanarImage
import net.imglib2.type.numeric.integer.UnsignedByteType; //导入方法依赖的package包/类
/** Explicit planar version. */
private void invertPlanarImage(final PlanarImg<UnsignedByteType, ByteArray> img) {
final PlanarCursor<UnsignedByteType> c = img.cursor();
while ( c.hasNext() ) {
final UnsignedByteType t = c.next();
final int value = t.get();
final int result = 255 - value;
t.set(result);
}
}
示例15: invertListImage
import net.imglib2.type.numeric.integer.UnsignedByteType; //导入方法依赖的package包/类
/** Explicit list version. */
private void invertListImage(final ListImg<UnsignedByteType> img) {
final ListCursor<UnsignedByteType> c = img.cursor();
while ( c.hasNext() ) {
final UnsignedByteType t = c.next();
final int value = t.get();
final int result = 255 - value;
t.set(result);
}
}