本文整理匯總了Java中net.imglib2.type.numeric.integer.UnsignedLongType類的典型用法代碼示例。如果您正苦於以下問題:Java UnsignedLongType類的具體用法?Java UnsignedLongType怎麽用?Java UnsignedLongType使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
UnsignedLongType類屬於net.imglib2.type.numeric.integer包,在下文中一共展示了UnsignedLongType類的11個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: writeBlock
import net.imglib2.type.numeric.integer.UnsignedLongType; //導入依賴的package包/類
/**
* @param input
* Block of data to be written to dvid data set.
* @param dims
* Interpretation of the dimensionality of the block, e.g.
* [0,1,2] corresponds to "xyz".
* @param offset
* Position of the "upper left" corner of the block within the
* dvid coordinate system.
* @throws IOException
*
* Write block into dvid data set at position specified by
* offset using http POST request.
*/
public void writeBlock(
RandomAccessibleInterval< UnsignedLongType > input,
final int[] dims,
final int[] offset ) throws IOException
{
// Offset and block dimensions must be integer multiples of
// this.blockSize.
// For now add the asserts, maybe make this method private/protected and
// have
// enclosing method take care of it.
for ( int d = 0; d < input.numDimensions(); ++d )
{
assert offset[ d ] % this.blockSize[ d ] == 0;
assert input.dimension( d ) % this.blockSize[ d ] == 0;
}
dataset.put( input, offset );
}
示例2: getSparseVol
import net.imglib2.type.numeric.integer.UnsignedLongType; //導入依賴的package包/類
/**
* @param label
* @param options
* @return All pixels for given label as run length encoded byte[].
*/
public byte[] getSparseVol( UnsignedLongType label, Map< String, String > options ) throws MalformedURLException, IOException
{
String url = getRequestString( getSparsevolRequestString( label ), null, options );
byte[] data = HttpRequest.getRequest( url );
return data;
}
示例3: put
import net.imglib2.type.numeric.integer.UnsignedLongType; //導入依賴的package包/類
@Override
public void put(
RandomAccessibleInterval< UnsignedLongType > source,
int[] offset
) throws MalformedURLException, IOException
{
HttpRequest.postRequest(
getIntervalRequestUrl( source, offset ),
Views.flatIterable( source ), "application/octet-stream" );
}
示例4: get
import net.imglib2.type.numeric.integer.UnsignedLongType; //導入依賴的package包/類
@Override
public void get( RandomAccessibleInterval< UnsignedLongType > target, int[] offset ) throws MalformedURLException, IOException
{
int size = Long.BYTES;
for ( int d = 0; d < target.numDimensions(); ++d )
size *= target.dimension( d );
byte[] data = new byte[ size ];
getByteArray( target, data, offset );
ByteBuffer bb = ByteBuffer.wrap( data );
for( UnsignedLongType t : Views.flatIterable( target ) )
t.setInteger( bb.getLong() );
}
示例5: compute
import net.imglib2.type.numeric.integer.UnsignedLongType; //導入依賴的package包/類
@Override
public void compute(final C input, final UnsignedLongType output) {
final BigDecimal bd = BigDecimal.valueOf(input.getRealDouble());
final BigDecimal r = bd.remainder(BigDecimal.ONE);
if (r.compareTo(BigDecimal.ZERO) == 0) {
output.set(bd.toBigIntegerExact().longValue());
}
else {
output.set(bd.toBigInteger().longValue());
}
}
示例6: uint64
import net.imglib2.type.numeric.integer.UnsignedLongType; //導入依賴的package包/類
@OpMethod(op = net.imagej.ops.convert.ConvertImages.Uint64.class)
public <C extends ComplexType<C>> Img<UnsignedLongType> uint64(
final IterableInterval<C> in)
{
@SuppressWarnings("unchecked")
final Img<UnsignedLongType> result = (Img<UnsignedLongType>) ops().run(
Ops.Convert.Uint64.class, in);
return result;
}
示例7: writeImage
import net.imglib2.type.numeric.integer.UnsignedLongType; //導入依賴的package包/類
/**
* @param image
* Image to be stored in dvid server.
* @param iterationAxis
* Along which axis to iterate.
* @param steps
* Step sizes along each axis.
* @param offset
* Offset target position by offset.
* @param borderExtension
* Extend border with this value.
*
* Write image into data set. The image will be divided into
* blocks as defined by steps. The target coordinates will be the
* image coordinates shifted by offset.
*/
public void writeImage(
RandomAccessibleInterval< UnsignedLongType > image,
final int iterationAxis,
final int[] steps,
final int[] offset,
UnsignedLongType borderExtension )
{
// realX ensures that realX[i] is integer multiple of blockSize
long[] realDim = new long[ image.numDimensions() ];
image.dimensions( realDim );
adaptToBlockSize( realDim, this.blockSize );
int[] realSteps = adaptToBlockSize( steps.clone(), this.blockSize );
int[] realOffset = adaptToBlockSize( offset.clone(), this.blockSize );
// For now, assume always that data is in [0,1,2] == "xyz" format.
// Do we need flexibility to allow for different orderings?
int[] dims = new int[ image.numDimensions() ];
for ( int d = 0; d < image.numDimensions(); ++d )
dims[ d ] = d;
// stepSize as long[], needed for BlockedInterval
long[] stepSize = new long[ image.numDimensions() ];
for ( int i = 0; i < stepSize.length; i++ )
stepSize[ i ] = realSteps[ i ];
// Create BlockedInterval that allows for flat iteration and intuitive
// hyperslicing.
// Go along iterationAxis and hyperslice, then iterate over each
// hyperslice.
BlockedInterval< UnsignedLongType > blockedImage = BlockedInterval.createZeroExtended( image, stepSize );
for ( int a = 0, aUnitIncrement = 0; a < image.dimension( iterationAxis ); ++aUnitIncrement, a += realSteps[ iterationAxis ] )
{
IntervalView< RandomAccessibleInterval< UnsignedLongType >> hs =
Views.hyperSlice( blockedImage, iterationAxis, aUnitIncrement );
Cursor< RandomAccessibleInterval< UnsignedLongType >> cursor = Views.flatIterable( hs ).cursor();
while ( cursor.hasNext() )
{
RandomAccessibleInterval< UnsignedLongType > block = cursor.next();
int[] localOffset = realOffset.clone();
localOffset[ iterationAxis ] = a;
for ( int i = 0, k = 0; i < localOffset.length; i++ )
{
if ( i == iterationAxis )
continue;
localOffset[ i ] += cursor.getIntPosition( k++ ) * stepSize[ i ];
}
try
{
this.writeBlock( block, dims, localOffset );
}
catch ( IOException e )
{
System.err.println( "Failed to write block: " + dataset.getRequestString( DatasetBlkLabel.getIntervalRequestString( image, realSteps ) ) );
e.printStackTrace();
}
}
}
return;
}
示例8: getSparsevolRequestString
import net.imglib2.type.numeric.integer.UnsignedLongType; //導入依賴的package包/類
/**
* @param label
* @return Request URL to get all pixels for label.
*/
public static String getSparsevolRequestString( UnsignedLongType label )
{
return "sparsevol/" + label.getIntegerLong();
}
示例9: drawInto
import net.imglib2.type.numeric.integer.UnsignedLongType; //導入依賴的package包/類
/**
* @param target Write labels into this {@link RandomAccessibleInterval}.
* @param rleData Run length encoded byte[] as returned by {@link DatasetLabelVol#getSparseVol}
* @param label Label to be drawn at positions specified by rleData.
* @param offset Specifies the top left corner of target with respect to the dvid dataset.
*
* Write run length encoded pixel labels into a {@link RandomAccessibleInterval}.
*
*/
public static void drawInto(
RandomAccessibleInterval< UnsignedLongType > target,
byte[] rleData,
UnsignedLongType label,
long[] offset
)
{
ByteBuffer bb = ByteBuffer.wrap( rleData );
byte payloadDescriptor = bb.get();
assert payloadDescriptor == 0: "Expected zero payload!";
int nDim = bb.get() & 0xff;
assert nDim == 3: "Expected three dimensions";
int runDim = bb.get() & 0xff;
assert runDim >= 0 && runDim <= 2: "Run dimension must be less than three";
bb.get(); // ignore reserved byte
bb.getInt(); // ignore (number of pixels, falls back to 0 right now);
bb.getInt(); // ignore (number of spans <- what is that?);
RandomAccess< UnsignedLongType > ra = target.randomAccess();
long runDimLength = target.dimension( runDim );
ArrayList< Integer > nonRunDims = new ArrayList< Integer >();
for ( int d = 0; d < 3; ++d )
if( d != runDim )
nonRunDims.add( d );
long[] dims = new long[ 3 ];
target.dimensions( dims );
System.out.println( runDim + " " + bb.position() + " LAENGE!" );
while( bb.position() < rleData.length )
{
long[] startingCoordinates = new long[]
{
bb.getInt() - offset[ 0 ],
bb.getInt() - offset[ 1 ],
bb.getInt() - offset[ 2 ]
};
System.out.println( Arrays.toString( startingCoordinates ) );
boolean isOutOfBounds = false;
for( Integer d : nonRunDims )
{
long v = startingCoordinates[ d.intValue() ];
if ( v < 0l || v >= dims[ d ] )
{
isOutOfBounds = true;
break;
}
}
if ( isOutOfBounds ) continue;
long offsetRunDimLength = startingCoordinates[ runDim ] + runDimLength;
long maxLength = Math.min( offsetRunDimLength, dims[ runDim ] );
for (
ra.setPosition( startingCoordinates );
ra.getLongPosition( runDim ) < maxLength;
ra.fwd( runDim )
)
{
ra.get().set( label );
}
}
}
示例10: writeBlock
import net.imglib2.type.numeric.integer.UnsignedLongType; //導入依賴的package包/類
@Override
public void writeBlock( RandomAccessibleInterval< UnsignedLongType > source, int[] position ) throws MalformedURLException, IOException
{
throw new UnsupportedOperationException( "Datatype labelblk currently does not support /blocks/ api." );
}
示例11: createOutput
import net.imglib2.type.numeric.integer.UnsignedLongType; //導入依賴的package包/類
@Override
public UnsignedLongType createOutput(final C input) {
return new UnsignedLongType();
}