Examples of FloatArray


Examples of de.ailis.jollada.model.FloatArray

     */

    @Test
    public void testGetValues()
    {
        final FloatArray array = new FloatArray(4);
        array.setValue(0, 1);
        array.setValue(1, 2);
        array.setValue(2, 3);
        array.setValue(3, 4);

        // Test getting copy of values
        double[] values = array.getValues();
        assertEquals(1, values[0], 0.001f);
        assertEquals(2, values[1], 0.001f);
        assertEquals(3, values[2], 0.001f);
        assertEquals(4, values[3], 0.001f);

        // Test filling array with values
        values = new double[4];
        array.getValues(values);
        assertEquals(1, values[0], 0.001f);
        assertEquals(2, values[1], 0.001f);
        assertEquals(3, values[2], 0.001f);
        assertEquals(4, values[3], 0.001f);

        // Test getting subset of array
        values = new double[4];
        array.getValues(1, 2, values);
        assertEquals(2, values[0], 0.001f);
        assertEquals(3, values[1], 0.001f);
        assertEquals(0, values[2], 0.001f);
        assertEquals(0, values[3], 0.001f);

        // Test getting subset of array and writing to specific offset
        values = new double[4];
        array.getValues(1, 2, values, 1);
        assertEquals(0, values[0], 0.001f);
        assertEquals(2, values[1], 0.001f);
        assertEquals(3, values[2], 0.001f);
        assertEquals(0, values[3], 0.001f);
    }
View Full Code Here

Examples of de.ailis.jollada.model.FloatArray

     */

    @Test
    public void testSetValues()
    {
        final FloatArray array = new FloatArray(4);
        final double[] values = new double[] { 1, 2, 3, 4 };
        array.setValues(values);
        assertEquals(1, array.getValue(0), 0.001f);
        assertEquals(2, array.getValue(1), 0.001f);
        assertEquals(3, array.getValue(2), 0.001f);
        assertEquals(4, array.getValue(3), 0.001f);

        array.setValues(1, 2, values);
        assertEquals(1, array.getValue(0), 0.001f);
        assertEquals(1, array.getValue(1), 0.001f);
        assertEquals(2, array.getValue(2), 0.001f);
        assertEquals(4, array.getValue(3), 0.001f);

        array.setValues(1, 2, values, 1);
        assertEquals(1, array.getValue(0), 0.001f);
        assertEquals(2, array.getValue(1), 0.001f);
        assertEquals(3, array.getValue(2), 0.001f);
        assertEquals(4, array.getValue(3), 0.001f);
    }
View Full Code Here

Examples of de.ailis.jollada.model.FloatArray

     */

    private void enterFloatArray(final Attributes attributes)
    {
        final int count = Integer.parseInt(attributes.getValue("count"));
        final FloatArray array = this.floatArray = new FloatArray(count);
        final String digits = attributes.getValue("digits");
        final String magnitude = attributes.getValue("magnitude");
        if (digits != null)
            this.floatArray.setDigits(Integer.parseInt(digits));
        if (magnitude != null)
            this.floatArray.setMagnitude(Integer.parseInt(magnitude));
        this.floatArray.setId(attributes.getValue("id"));
        this.floatArray.setName(attributes.getValue("name"));
        this.chunkFloatReader = new ChunkFloatReader()
        {
            private int index = 0;

            @Override
            protected void valueFound(final double value)
            {
                array.setValue(this.index++, value);
            }
        };

        enterElement(ParserMode.FLOAT_ARRAY);
    }
View Full Code Here

Examples of net.imglib2.img.basictypeaccess.array.FloatArray

      return ( ArrayImgAWTScreenImage ) container;
    }

    if ( FloatType.class.isAssignableFrom( type.getClass() ) )
    {
      final FloatArray array = new FloatArray( numElements( dims ) );
      final ArrayImgAWTScreenImage< FloatType, FloatArray > container = new FloatAWTScreenImage( new FloatType( array ), array, dims );
      container.setLinkedType( new FloatType( container ) );
      return ( ArrayImgAWTScreenImage ) container;
    }
View Full Code Here

Examples of net.imglib2.img.basictypeaccess.array.FloatArray

  }

  @Override
  public CellImg< T, FloatArray, DefaultCell< FloatArray > > createFloatInstance( final long[] dimensions, final Fraction entitiesPerPixel )
  {
    return createInstance( new FloatArray( 1 ), dimensions, entitiesPerPixel );
  }
View Full Code Here

Examples of net.imglib2.img.basictypeaccess.array.FloatArray

  }

  @Override
  public NativeImg< T, FloatArray > createFloatInstance( final long[] dimensions, final Fraction entitiesPerPixel )
  {
    return new PlanarImg< T, FloatArray >( new FloatArray( 1 ), dimensions, entitiesPerPixel );
  }
View Full Code Here

Examples of net.imglib2.img.basictypeaccess.array.FloatArray

  // this is the constructor if you want it to be a variable
  public ComplexFloatType( final float r, final float i )
  {
    img = null;
    dataAccess = new FloatArray( 2 );
    set( r, i );
  }
View Full Code Here

Examples of net.imglib2.img.basictypeaccess.array.FloatArray

  // this is the constructor if you want it to be a variable
  public FloatType( final float value )
  {
    img = null;
    dataAccess = new FloatArray( 1 );
    set( value );
  }
View Full Code Here

Examples of net.imglib2.img.basictypeaccess.array.FloatArray

  @Override
  public ArrayImg< T, FloatArray > createFloatInstance( final long[] dimensions, final Fraction entitiesPerPixel )
  {
    final int numEntities = numEntitiesRangeCheck( dimensions, entitiesPerPixel );

    return new ArrayImg< T, FloatArray >( new FloatArray( numEntities ), dimensions, entitiesPerPixel );
  }
View Full Code Here

Examples of net.imglib2.img.basictypeaccess.array.FloatArray

   * Creates an {@link ArrayImg}<{@link FloatType}, {@link FloatArray}>
   * reusing a passed float[] array.
   */
  final public static ArrayImg< FloatType, FloatArray > floats( final float[] array, final long... dim )
  {
    final FloatArray access = new FloatArray( array );
    final ArrayImg< FloatType, FloatArray > img = new ArrayImg< FloatType, FloatArray >( access, dim, new Fraction() );
    final FloatType t = new FloatType( img )
    img.setLinkedType( t );
    return img;
  }
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.