Examples of SlicingTransform


Examples of net.imglib2.transform.integer.SlicingTransform

        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

Examples of net.imglib2.transform.integer.SlicingTransform

          final boolean[] zero = new boolean[ m ];
          final int[] component = new int[ m ];
          mixed.getTranslation( translation );
          mixed.getComponentZero( zero );
          mixed.getComponentMapping( component );
          final SlicingTransform sl = new SlicingTransform( mixed.numSourceDimensions(), m );
          sl.setTranslation( translation );
          sl.setComponentZero( zero );
          sl.setComponentMapping( component );
          i.set( sl );
        }
      }
    }
  }
View Full Code Here

Examples of net.imglib2.transform.integer.SlicingTransform

    {
      System.out.println( "incompatible dimensions" );
      return false;
    }

    final SlicingTransform t1t2 = t1.concatenate( t2 );

    final Matrix mt1 = new Matrix( t1.getMatrix() );
    final Matrix mt2 = new Matrix( t2.getMatrix() );
    final Matrix mt1t2 = new Matrix( t1t2.getMatrix() );

    if ( mt1.times( mt2 ).minus( mt1t2 ).normF() > 0.1 )
    {
      System.out.println( "=======================" );
      System.out.println( "t1: " + t1.numSourceDimensions() + " -> " + t1.numTargetDimensions() + " (n -> m)" );
      System.out.println( "t2: " + t2.numSourceDimensions() + " -> " + t2.numTargetDimensions() + " (n -> m)" );
      System.out.println( "t1t2: " + t1t2.numSourceDimensions() + " -> " + t1t2.numTargetDimensions() + " (n -> m)" );

      System.out.print( "t1 = " );
      mt1.print( 1, 0 );
      System.out.print( "t2 = " );
      mt2.print( 1, 0 );
View Full Code Here

Examples of net.imglib2.transform.integer.SlicingTransform

    {
      System.out.println( "incompatible dimensions" );
      return false;
    }

    final SlicingTransform t1t2 = t2.preConcatenate( t1 );

    final Matrix mt1 = new Matrix( t1.getMatrix() );
    final Matrix mt2 = new Matrix( t2.getMatrix() );
    final Matrix mt1t2 = new Matrix( t1t2.getMatrix() );

    if ( mt1.times( mt2 ).minus( mt1t2 ).normF() > 0.1 )
    {
      System.out.println( "=======================" );
      System.out.println( "t1: " + t1.numSourceDimensions() + " -> " + t1.numTargetDimensions() + " (n -> m)" );
      System.out.println( "t2: " + t2.numSourceDimensions() + " -> " + t2.numTargetDimensions() + " (n -> m)" );
      System.out.println( "t1t2: " + t1t2.numSourceDimensions() + " -> " + t1t2.numTargetDimensions() + " (n -> m)" );

      System.out.print( "t1 = " );
      mt1.print( 1, 0 );
      System.out.print( "t2 = " );
      mt2.print( 1, 0 );
View Full Code Here

Examples of net.imglib2.transform.integer.SlicingTransform

  SlicingTransform sl2;

  @Before
  public void setUp()
  {
    sl1 = new SlicingTransform( 2, 3 );
    sl1.setComponentMapping( new int[] { 0, 1, -9 } );
    sl1.setComponentZero( new boolean[] { false, false, true } );
    sl1.setTranslation( new long[] { 0, 0, 100 } );

    sl2 = new SlicingTransform( 3, 4 );
    sl2.setComponentMapping( new int[] { -9, 0, 1, 2 } );
    sl2.setComponentZero( new boolean[] { true, false, false, false } );
    sl2.setTranslation( new long[] { 1287, 0, 0, 0 } );
  }
View Full Code Here

Examples of net.imglib2.transform.integer.SlicingTransform

    comp1 = rot1.concatenate( tr2 );

    translation1 = new TranslationTransform( new long[] { 2011, 3, 24 } );

    slicing1 = new SlicingTransform( 2, 3 );
    slicing1.setComponentMapping( new int[] { 0, 1, 0 } );
    slicing1.setComponentZero( new boolean[] { false, false, true } );
    slicing1.setTranslation( new long[] { 0, 0, 100 } );
  }
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.