@Override public long dimension(final int d) { return imgPlus.dimension(d); }
/** * {@inheritDoc} */ @Override public ImgPlus< T > createEmptyOutput( ImgPlus< T > op ) { BitSet isLength1 = new BitSet( op.numDimensions() ); for ( int d = 0; d < op.numDimensions(); d++ ) { if ( op.dimension( d ) == 1 ) { isLength1.set( d ); } } long[] min = new long[ op.numDimensions() - isLength1.cardinality() ]; long[] max = new long[ min.length ]; int d = 0; for ( int i = 0; i < op.numDimensions(); i++ ) { if ( !isLength1.get( i ) ) { max[ d ] = op.dimension( i ) - 1; d++; } } Img< T > res = op.factory().create( new FinalInterval( min, max ), op.firstElement().createVariable() ); return new ImgPlus< T >( res ); }
/** * {@inheritDoc} */ @Override public ImgPlus< T > createEmptyOutput( ImgPlus< T > op ) { AxisType[] axes = new AxisType[ op.numDimensions() ]; op.axes( axes ); m_isNewDim.clear(); for ( int d = 0; d < m_newDimensions.length; d++ ) { for ( int a = 0; a < axes.length; a++ ) { if ( !axes[ a ].getLabel().equals( m_newDimensions[ d ] ) ) { m_isNewDim.set( d ); } } } long[] newDims = new long[ op.numDimensions() + m_isNewDim.cardinality() ]; Arrays.fill( newDims, 1 ); for ( int i = 0; i < op.numDimensions(); i++ ) { newDims[ i ] = op.dimension( i ); } return new ImgPlus< T >( op.factory().create( newDims, op.firstElement().createVariable() ) ); }
@Override public void rebuild() { // NB: Make sure any calls to updateLUTs are ignored. If they happen before // the converters are correctly defined (in setupProjector) an exception // can get thrown. Basically if you add a channel to an image the converter // size() can be out of sync. uninitializeView(); channelDimIndex = getChannelDimIndex(); final ImgPlus<? extends RealType<?>> img = getData().getImgPlus(); if (defaultLUTs == null || defaultLUTs.size() != getChannelCount()) { defaultLUTs = new ArrayList<ColorTable>(); resetColorTables(false); } final int width = (int) img.dimension(0); final int height = (int) img.dimension(1); screenImage = new ARGBScreenImage(width, height); initializeView(isComposite()); updateLUTs(); projector.map(); }
private boolean mergedColorCompatible() { if (isSigned()) return false; if (!isInteger()) return false; if (getType().getBitsPerPixel() != 8) return false; if (imgPlus.getAxisIndex(Axes.CHANNEL) < 0) return false; if (imgPlus.dimension(getAxisIndex(Axes.CHANNEL)) != 3) return false; return true; } }
for ( int d = 0; d < op.numDimensions(); d++ ) if ( op.dimension( d ) == 1 )