Package net.imglib2.type.logic

Examples of net.imglib2.type.logic.BitType


    }
    else
    {
      this.source = source;
      final int sourceDim = this.source.numDimensions();
      this.transformToSource = new MixedTransform( n, sourceDim );
      this.transformToSource.set( transformToSource );
    }

    fullViewRandomAccessible = null;
  }
View Full Code Here


        if ( iterableSource.supportsOptimizedCursor( interval ) )
          return new SubInterval( iterableSource );
      }
      else if ( transforms.size() == 1 && SlicingTransform.class.isInstance( transforms.get( 0 ) ) )
      {
        final SlicingTransform t = ( SlicingTransform ) transforms.get( 0 );
        final int m = t.numTargetDimensions();
        final int n = t.numSourceDimensions();

        // Check whether the slicing can be potentially optimized.
        boolean optimizable = true;

        // 1.) Slice dimensions must be mapped to a contiguous range of
        // target dimensions starting with dimension 0.
        int firstZeroDim = 0;
        for ( ; firstZeroDim < m && !t.getComponentZero( firstZeroDim ); ++firstZeroDim );
        for ( int d = firstZeroDim + 1; d < m && optimizable; ++d )
          if ( !t.getComponentZero( d ) )
            optimizable = false;

        // 2.) All slice dimensions must be mapped to a target dimension
        final int[] sourceComponent = new int[ n ];
        if ( optimizable )
        {
          Arrays.fill( sourceComponent, -1 );
          for ( int d = 0; d < m; ++d )
            if ( !t.getComponentZero( d ) )
              sourceComponent[ t.getComponentMapping( d ) ] = d;
          for ( int d = 0; d < n && optimizable; ++d )
            if ( sourceComponent[ d ] < 0 )
              optimizable = false;
        }

        if ( optimizable )
        {
//          System.out.println( "interval = " + Util.printInterval( interval ) );
          final Interval sliceInterval = t.transform( new BoundingBox( interval ) ).getInterval();
//          System.out.println( "transformed interval = " + Util.printInterval( sliceInterval ) );
          if ( iterableSource.supportsOptimizedCursor( sliceInterval ) )
          {
            // check for FlatIterationOrder
            boolean flat = FlatIterationOrder.class.isInstance( iterableSource.subIntervalIterationOrder( sliceInterval ) );
View Full Code Here

   * Create an {@link ArrayImg}<{@link BitType}, {@link BitArray}>.
   */
  @SuppressWarnings( "unchecked" )
  final static public ArrayImg< BitType, LongArray > bits( final long... dim )
  {
    return ( ArrayImg< BitType, LongArray > ) new ArrayImgFactory< BitType >().create( dim, new BitType() );
  }
View Full Code Here

   * Create an {@link PlanarImg}<{@link BitType}, {@link BitArray}>.
   */
  @SuppressWarnings( "unchecked" )
  final static public PlanarImg< BitType, LongArray > bits( final long... dim )
  {
    return ( PlanarImg< BitType, LongArray > ) new PlanarImgFactory< BitType >().create( dim, new BitType() );
  }
View Full Code Here

  }

  @Test
  public void testBitDefaultCellSize()
  {
    testDefaultCellSize( new BitType() );
  }
View Full Code Here

  }

  @Test
  public void testBitDefaultCellDimensions()
  {
    testDefaultCellDimensions( new BitType() );
  }
View Full Code Here

    Cursor<BitType> c = mask.cursor();
    /*
     * Note that axes are reversed.
     */
    while(c.hasNext()) {
      BitType t = c.next();
      c.localize(position);
      assertEquals(t.get(), position[1] >=5 && position[1] < 11 && position[0] >= 16 && position[0] <23);
    }
  }
View Full Code Here

    Img<BitType> mask = OverlayUtils.extractMask(iDisplay);
    assertNotNull(mask);
    Cursor<BitType> c = mask.cursor();
    double [] position = new double [2];
    while(c.hasNext()) {
      BitType t = c.next();
      position[1] = c.getDoublePosition(0);
      position[0] = c.getDoublePosition(1);
      assertEquals(t.get(), roi.contains(position));
    }
  }
View Full Code Here

    assertNotNull(mask);
    assertNotNull(mask);
    Cursor<BitType> c = mask.cursor();
    double [] position = new double [2];
    while(c.hasNext()) {
      BitType t = c.next();
      position[1] = c.getDoublePosition(0);
      position[0] = c.getDoublePosition(1);
      boolean inside = false;
      for (Overlay o:oo) {
        inside |= o.getRegionOfInterest().contains(position);
      }
      assertEquals(t.get(), inside);
    }
  }
View Full Code Here

         * Boo! We have to sample from the ROI.
         */
        RealRandomAccess<BitType> roiAccess = roi.realRandomAccess();
        Cursor<BitType> c = Views.iterable(adapter).cursor();
        while(c.hasNext()) {
          BitType t = c.next();
          roiAccess.setPosition(c);
          t.set(roiAccess.get().get());
        }
      }
    }
    return mask;
  }
View Full Code Here

TOP

Related Classes of net.imglib2.type.logic.BitType

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.