Package net.imglib2.type.numeric.integer

Examples of net.imglib2.type.numeric.integer.IntType


    {
      intData[ i ] = random.nextInt();
      intDataSum += intData[ i ];
    }

    intImg = new ArrayImgFactory< IntType >().create( dimensions, new IntType() );
  }
View Full Code Here


        randomAccessBenchmark.fillImage();
      }
    } );
    randomAccessBenchmark.intData = null;

    randomAccessBenchmark.intImgCopy = new ArrayImgFactory< IntType >().create( randomAccessBenchmark.dimensions, new IntType() );
    System.out.println( "benchmarking copy to array" );
    benchmark( new Benchmark()
    {
      @Override
      public void run()
View Full Code Here

    { 5, 4, 3 },
    { 2, 1, 0 }
    } };
    for ( int i = 0; i < offsets.length; i++ )
    {
      final Img< IntType > img = new ArrayImgFactory< IntType >().create( new long[] { 3, 3 }, new IntType() );
      ImgUtil.copy( input, offsets[ i ], strides[ i ], img );
      final RandomAccess< IntType > ra = img.randomAccess();
      final long[] location = new long[ 2 ];
      for ( int x = 0; x < 3; x++ )
      {
View Full Code Here

  @SuppressWarnings( "unchecked" )
  @Before
  public void setUp()
  {
    dimensions = new long[] { 207, 103 };
    array1 = ( ArrayImg< IntType, IntArray > ) new ArrayImgFactory< IntType >().create( dimensions, new IntType() );
    array2 = ( ArrayImg< IntType, IntArray > ) new ArrayImgFactory< IntType >().create( dimensions, new IntType() );
    cell = ( CellImg< IntType, IntArray, DefaultCell< IntArray > > ) new CellImgFactory< IntType >().create( dimensions, new IntType() );

    // fill intData with random values
    numValues = 1;
    for ( int d = 0; d < dimensions.length; ++d )
      numValues *= dimensions[ d ];
View Full Code Here

  @Test
  public void testNoTail()
  {
    long binPos;
    final IntType tmp = new IntType();
    final Integer1dBinMapper< IntType > binMapper =
        new Integer1dBinMapper< IntType >( 0, 100, false );
    assertEquals( 100, binMapper.getBinCount() );
    for ( int i = 0; i <= 99; i++ )
    {
      tmp.setInteger( i );
      binPos = binMapper.map( tmp );
      assertEquals( i, binPos );
      binMapper.getLowerBound( binPos, tmp );
      assertEquals( i, tmp.getIntegerLong() );
      binMapper.getUpperBound( binPos, tmp );
      assertEquals( i, tmp.getIntegerLong() );
      binMapper.getCenterValue( binPos, tmp );
      assertEquals( i, tmp.getIntegerLong() );
    }
    tmp.setReal( -1 );
    assertEquals( Long.MIN_VALUE, binMapper.map( tmp ) );
    tmp.setReal( 100 );
    assertEquals( Long.MAX_VALUE, binMapper.map( tmp ) );
  }
View Full Code Here

    {
      intData[ i ] = random.nextInt();
      intDataSum += intData[ i ];
    }

    intImg = new CellImgFactory< IntType >( 10 ).create( dimensions, new IntType() );

    final long[] pos = new long[ dimensions.length ];
    final RandomAccess< IntType > a = intImg.randomAccess();

    for ( int i = 0; i < numValues; ++i )
View Full Code Here

  }

  @Test
  public void testCopyToArrayContainerWithSourceIteration()
  {
    final ArrayImg< IntType, ? > array = new ArrayImgFactory< IntType >().create( dimensions, new IntType() );
    copyWithSourceIteration( intImg, array );
    assertArrayEquals( intData, getImgAsInts( array ) );
  }
View Full Code Here

  }

  @Test
  public void testCopyToArrayContainerWithDestIteration()
  {
    final ArrayImg< IntType, ? > array = new ArrayImgFactory< IntType >().create( dimensions, new IntType() );
    copyWithDestIteration( intImg, array );
    assertArrayEquals( intData, getImgAsInts( array ) );
  }
View Full Code Here

  }

  @Test
  public void testCopyToCellContainerWithSourceIteration()
  {
    final CellImg< IntType, ?, ? > cellImg = new CellImgFactory< IntType >( new int[] { 2, 7, 4 } ).create( dimensions, new IntType() );
    copyWithSourceIteration( intImg, cellImg );
    assertArrayEquals( intData, getImgAsInts( cellImg ) );
  }
View Full Code Here

  @Test
  public void testTail()
  {
    long binPos;
    final IntType tmp = new IntType();
    final Integer1dBinMapper< IntType > binMapper =
        new Integer1dBinMapper< IntType >( 0, 100, true );
    assertEquals( 100, binMapper.getBinCount() );
    // test the interior areas
    for ( int i = 0; i < 98; i++ )
    {
      tmp.setInteger( i );
      binPos = binMapper.map( tmp );
      assertEquals( i + 1, binPos );
      binMapper.getLowerBound( binPos, tmp );
      assertEquals( i, tmp.getIntegerLong() );
      binMapper.getUpperBound( binPos, tmp );
      assertEquals( i, tmp.getIntegerLong() );
      binMapper.getCenterValue( binPos, tmp );
      assertEquals( i, tmp.getIntegerLong() );
    }

    // test the lower tail
    tmp.setInteger( -1 );
    binPos = binMapper.map( tmp );
    assertEquals( 0, binPos );

    // test the upper tail
    tmp.setInteger( 100 );
    binPos = binMapper.map( tmp );
    assertEquals( 99, binPos );
  }
View Full Code Here

TOP

Related Classes of net.imglib2.type.numeric.integer.IntType

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.