Examples of IntType


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

  @SuppressWarnings( "unchecked" )
  public void setUp()
  {
    dimensions = new long[] { 207, 103, 1021 };
    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

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

        {
          if ( cursor == null )
          {
            cursor = img.cursor();
            tuple = new ArrayList< IntType >();
            tuple.add( new IntType() );
            tuple.add( new IntType() );
            tuple.add( new IntType() );
          }
          return cursor.hasNext();
        }

        @Override
View Full Code Here

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

  @Test
  public void testIntNoTails()
  {
    long binPos;
    final IntType tmp = new IntType();
    final Real1dBinMapper< IntType > binMapper =
        new Real1dBinMapper< IntType >( 0.0, 100.0, 100, false );
    assertEquals( 100, binMapper.getBinCount() );
    for ( double i = 0; i <= 100; i += 0.125 )
    {
      tmp.setReal( i );
      binPos = binMapper.map( tmp );
      double expectedBin = Math.round( i );
      if ( i >= 99.5 )
        expectedBin--;
      assertEquals( expectedBin, binPos, 0 );
      binMapper.getLowerBound( binPos, tmp );
      assertEquals( expectedBin, tmp.getRealDouble(), 0.0 );
      binMapper.getUpperBound( binPos, tmp );
      assertEquals( expectedBin + 1, tmp.getRealDouble(), 0.0 );
      // Note - one would hope this would calc easily but due to rounding
      // errors
      // one cannot always easily tell what the bin center is when using
      // an
      // integral type with a Real1dBinMapper. One should really use an
      // Integer1dBinMapper in these cases. Disabling test.
      // binMapper.getCenterValues(binPos, tmpList);
      // assertEquals(expectedBin + 1, tmp.getRealDouble(), 0.0);
    }
    tmp.setReal( -1 );
    assertEquals( Long.MIN_VALUE, binMapper.map( tmp ) );
    tmp.setReal( 101 );
    assertEquals( Long.MAX_VALUE, binMapper.map( tmp ) );
  }
View Full Code Here

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

  @Test
  public void testIntTails()
  {
    long binPos;
    final IntType tmp = new IntType();
    final Real1dBinMapper< IntType > binMapper =
        new Real1dBinMapper< IntType >( 0.0, 100.0, 102, true );
    assertEquals( 102, binMapper.getBinCount() );
    for ( double i = 0; i <= 100; i += 0.125 )
    {
      tmp.setReal( i );
      binPos = binMapper.map( tmp );
      double expectedBin = Math.round( i ) + 1;
      if ( i >= 99.5 )
        expectedBin--;
      assertEquals( expectedBin, binPos, 0 );
      binMapper.getLowerBound( binPos, tmp );
      assertEquals( expectedBin - 1, tmp.getRealDouble(), 0.0 );
      binMapper.getUpperBound( binPos, tmp );
      assertEquals( expectedBin, tmp.getRealDouble(), 0.0 );
      // Note - one would hope this would calc easily but due to rounding
      // errors
      // one cannot always easily tell what the bin center is when using
      // an
      // integral type with a Real1dBinMapper. One should really use an
      // Integer1dBinMapper in these cases. Disabling test.
      // binMapper.getCenterValues(binPos, tmpList);
      // assertEquals(expectedBin + 1, tmp.getRealDouble(), 0.0);
    }
    tmp.setReal( -1 );
    assertEquals( 0, binMapper.map( tmp ) );
    tmp.setReal( 101 );
    assertEquals( 101, binMapper.map( tmp ) );
  }
View Full Code Here

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

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

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

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

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

    randomAccessBenchmark.intImgCopy = new PlanarImgFactory< IntType >().create( randomAccessBenchmark.dimensions, new IntType() );
    System.out.println( "benchmarking copy planar to planar" );
    benchmark( new Benchmark()
    {
      @Override
      public void run()
      {
        randomAccessBenchmark.copyWithSourceIteration( randomAccessBenchmark.intImg, randomAccessBenchmark.intImgCopy );
      }
    } );
    randomAccessBenchmark.intImgCopy = null;

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

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

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

    intImg = new PlanarImgFactory< IntType >().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

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

  }

  @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

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

  }

  @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

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

  }

  @Test
  public void testCopyToPlanarContainerWithSourceIteration()
  {
    final PlanarImg< IntType, ? > planarImg = new PlanarImgFactory< IntType >().create( dimensions, new IntType() );
    copyWithSourceIteration( intImg, planarImg );
    assertArrayEquals( intData, getImgAsInts( planarImg ) );
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.