for ( final ListIterator< Transform > i = transforms.listIterator(); i.hasNext(); )
{
final Transform t = i.next();
if ( Mixed.class.isInstance( t ) )
{
final Mixed mixed = ( Mixed ) t;
if ( isIdentity( mixed ) )
{
// found identity
// remove from transforms list
i.remove();
}
else if ( isTranslation( mixed ) )
{
// found pure translation
// replace by a TranslationTransform
final long[] translation = new long[ mixed.numTargetDimensions() ];
mixed.getTranslation( translation );
i.set( new TranslationTransform( translation ) );
}
// else if ( isComponentMapping( mixed ) )
// {
// // found pure component mapping
// // replace by a ComponentMappingTransform
// final int[] component = new int[ mixed.numTargetDimensions() ];
// mixed.getComponentMapping( component );
// i.set( new ComponentMappingTransform( component ) );
// }
else if ( isSlicing( mixed ) )
{
// found pure slicing
// replace by a SlicingTransform
final int m = mixed.numTargetDimensions();
final long[] translation = new long[ m ];
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 );
}