net.imglib2.type.numeric.ARGBType Java Examples
The following examples show how to use
net.imglib2.type.numeric.ARGBType.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: BDVRenderer.java From 3Dscript with BSD 2-Clause "Simplified" License | 6 votes |
protected void transferChannelSettings(final CompositeImage ci, final SetupAssignments setupAssignments, final VisibilityAndGrouping visibility) { final int nChannels = ci.getNChannels(); final int mode = ci.getCompositeMode(); final boolean transferColor = mode == IJ.COMPOSITE || mode == IJ.COLOR; for (int c = 0; c < nChannels; ++c) { final LUT lut = ci.getChannelLut(c + 1); final ConverterSetup setup = setupAssignments.getConverterSetups().get(c); if (transferColor) setup.setColor(new ARGBType(lut.getRGB(255))); setup.setDisplayRange(lut.min, lut.max); } if (mode == IJ.COMPOSITE) { final boolean[] activeChannels = ci.getActiveChannels(); visibility.setDisplayMode(DisplayMode.FUSED); for (int i = 0; i < activeChannels.length; ++i) visibility.setSourceActive(i, activeChannels[i]); } else visibility.setDisplayMode(DisplayMode.SINGLE); visibility.setCurrentSource(ci.getChannel() - 1); }
Example #2
Source File: VolatileHierarchyProjectorPreMultiply.java From paintera with GNU General Public License v2.0 | 6 votes |
public VolatileHierarchyProjectorPreMultiply( final List<? extends RandomAccessible<A>> sources, final Converter<? super A, ARGBType> converter, final RandomAccessibleInterval<ARGBType> target, final int numThreads, final ExecutorService executorService) { this( sources, converter, target, ArrayImgs.bytes(Intervals.dimensionsAsLongArray(target)), numThreads, executorService ); }
Example #3
Source File: ColorStream.java From SPIM_Registration with GNU General Public License v2.0 | 6 votes |
final static public Iterator< ARGBType > iterator() { return new Iterator< ARGBType >() { long i = -1; @Override public boolean hasNext() { return true; } @Override public ARGBType next() { return new ARGBType( get( ++i ) ); } @Override public void remove() {} }; }
Example #4
Source File: CompositeProjectorPreMultiply.java From paintera with GNU General Public License v2.0 | 6 votes |
@Override public VolatileProjector createAccumulateProjector( final ArrayList<VolatileProjector> sourceProjectors, final ArrayList<Source<?>> sources, final ArrayList<? extends RandomAccessible<? extends ARGBType>> sourceScreenImages, final RandomAccessibleInterval<ARGBType> targetScreenImage, final int numThreads, final ExecutorService executorService) { final CompositeProjectorPreMultiply projector = new CompositeProjectorPreMultiply( sourceProjectors, sourceScreenImages, targetScreenImage, numThreads, executorService ); final ArrayList<Composite<ARGBType, ARGBType>> activeComposites = new ArrayList<>(); for (final Source<?> activeSource : sources) activeComposites.add(composites.get(activeSource)); projector.setComposites(activeComposites); return projector; }
Example #5
Source File: DerivedMatchGroup.java From render with GNU General Public License v2.0 | 6 votes |
private List<Integer> getSetIndexesForPoints(final RealPointSampleList<ARGBType> largestSetIndexSamples, final List<RealPoint> otherSetPoints) { final List<Integer> setIndexList = new ArrayList<>(); final KDTree<ARGBType> kdTree = new KDTree<>(largestSetIndexSamples); final NearestNeighborSearch<ARGBType> nnSearchSamples = new NearestNeighborSearchOnKDTree<>(kdTree); Sampler<ARGBType> sampler; ARGBType sampleItem; int nnSetIndex; for (final RealPoint otherPoint : otherSetPoints) { nnSearchSamples.search(otherPoint); sampler = nnSearchSamples.getSampler(); sampleItem = sampler.get(); nnSetIndex = sampleItem.get(); setIndexList.add(nnSetIndex); } return setIndexList; }
Example #6
Source File: ConsensusWarpFieldBuilder.java From render with GNU General Public License v2.0 | 6 votes |
private int[] buildModelIndexGrid() { final int[] targetCellIndexes = new int[getNumberOfCells()]; final ArrayImg<ARGBType, IntArray> target = ArrayImgs.argbs(targetCellIndexes, columnCount, rowCount); final KDTree<ARGBType> kdTree = new KDTree<>(consensusSetIndexSamples); final NearestNeighborSearch<ARGBType> nnSearchSamples = new NearestNeighborSearchOnKDTree<>(kdTree); final Cursor<ARGBType> targetCursor = target.localizingCursor(); Sampler<ARGBType> sampler; ARGBType sampleItem; ARGBType targetItem; while (targetCursor.hasNext()) { targetCursor.fwd(); nnSearchSamples.search(targetCursor); sampler = nnSearchSamples.getSampler(); sampleItem = sampler.get(); targetItem = targetCursor.get(); targetItem.set(sampleItem); } return targetCellIndexes; }
Example #7
Source File: ConsensusWarpFieldBuilder.java From render with GNU General Public License v2.0 | 6 votes |
private void mapCellsToPoints(final Map<Integer, List<RealPoint>> cellToPointsMap, final RealCursor<ARGBType> cursor) { List<RealPoint> pointList; while (cursor.hasNext()) { cursor.fwd(); final double x = cursor.getDoublePosition(0) * pixelsPerColumn; final double y = cursor.getDoublePosition(1) * pixelsPerRow; final int row = (int) ((y / height) * rowCount); final int column = (int) ((x / width) * columnCount); final int gridIndex = (row * rowCount) + column; pointList = cellToPointsMap.get(gridIndex); if (pointList == null) { pointList = new ArrayList<>(); cellToPointsMap.put(gridIndex, pointList); } pointList.add(new RealPoint(x, y)); } }
Example #8
Source File: RenderUnit.java From paintera with GNU General Public License v2.0 | 6 votes |
public RenderUnit( final ThreadGroup threadGroup, final Supplier<ViewerState> viewerState, final Function<Source<?>, Interpolation> interpolation, final AccumulateProjectorFactory<ARGBType> accumulateProjectorFactory, final CacheControl cacheControl, final long targetRenderNanos, final int numRenderingThreads, final ExecutorService renderingExecutorService) { this.threadGroup = threadGroup; this.viewerState = viewerState; this.interpolation = interpolation; this.accumulateProjectorFactory = accumulateProjectorFactory; this.cacheControl = cacheControl; this.targetRenderNanos = targetRenderNanos; this.numRenderingThreads = numRenderingThreads; this.renderingExecutorService = renderingExecutorService; update(); }
Example #9
Source File: ARGBColorConverter.java From paintera with GNU General Public License v2.0 | 6 votes |
@Override public void convert(final R input, final ARGBType output) { final double v = input.getRealDouble() - min.get(); if (v < 0) { output.set(black); } else { final int r0 = (int) (scaleR * v + 0.5); final int g0 = (int) (scaleG * v + 0.5); final int b0 = (int) (scaleB * v + 0.5); final int r = Math.min(255, r0); final int g = Math.min(255, g0); final int b = Math.min(255, b0); output.set(ARGBType.rgba(r, g, b, A)); } }
Example #10
Source File: ARGBColorConverter.java From paintera with GNU General Public License v2.0 | 6 votes |
@Override public void convert(final R input, final ARGBType output) { final double v = input.getRealDouble() - min.get(); if (v < 0) { output.set(black); } else { final int r0 = (int) (scaleR * v + 0.5); final int g0 = (int) (scaleG * v + 0.5); final int b0 = (int) (scaleB * v + 0.5); final int r = Math.min(255, r0); final int g = Math.min(255, g0); final int b = Math.min(255, b0); output.set(ARGBType.rgba(r, g, b, A)); } }
Example #11
Source File: Utils.java From sciview with BSD 2-Clause "Simplified" License | 6 votes |
static public Img<ARGBType> convertToARGB(Img<UnsignedByteType> screenshot) { Img<ARGBType> out = ArrayImgs.argbs(screenshot.dimension(0), screenshot.dimension(1)); long[] pos = new long[3]; Cursor<ARGBType> outCur = Views.iterable(out).cursor(); RandomAccess<UnsignedByteType> sRA = screenshot.randomAccess(); while( outCur.hasNext() ) { outCur.fwd(); outCur.localize(pos); pos[2] = 0; sRA.setPosition(pos); int r = sRA.get().get(); pos[2] = 1; sRA.setPosition(pos); int g = sRA.get().get(); pos[2] = 2; sRA.setPosition(pos); int b = sRA.get().get(); int a = 255;// FIXME outCur.get().set(ARGBType.rgba(r, g, b, a)); } return out; }
Example #12
Source File: HighlightingStreamConverter.java From paintera with GNU General Public License v2.0 | 6 votes |
@Override public void invalidated(final Observable observable) { final Map<Long, Color> map = new HashMap<>(); final TLongIntMap explicitlySpecifiedColors = stream.getExplicitlySpecifiedColorsCopy(); explicitlySpecifiedColors.forEachEntry((k, v) -> { map.put(k, Colors.toColor(new ARGBType(v))); return true; }); LOG.debug("internal map={} updated map={}", userSpecifiedColors, map); if (!userSpecifiedColors.equals(map)) { userSpecifiedColors.clear(); userSpecifiedColors.putAll(map); } }
Example #13
Source File: MinimalSourceState.java From paintera with GNU General Public License v2.0 | 6 votes |
public MinimalSourceState( final S dataSource, final C converter, final Composite<ARGBType, ARGBType> composite, final String name, final SourceState<?, ?>... dependsOn) { super(); LOG.debug( "Creating minimal source state with dataSource={} converter={} composite={} name={} dependsOn={}", dataSource, converter, composite, name, dependsOn); this.dataSource = dataSource; this.converter = converter; this.composite = new SimpleObjectProperty<>(composite); this.name = new SimpleStringProperty(name); this.dependsOn = Arrays .stream(dependsOn) .filter(d -> !this.equals(d)) .toArray(SourceState[]::new); }
Example #14
Source File: CompositeProjectorPreMultiply.java From paintera with GNU General Public License v2.0 | 6 votes |
@Override protected void accumulate(final Cursor<? extends ARGBType>[] accesses, final ARGBType t) { t.set(0); for (int i = 0; i < composites.size(); ++i) composites.get(i).compose(t, accesses[i].get()); final int nonpre = t.get(); t.set(PixelUtils.NonPretoPre(nonpre)); // @SuppressWarnings( "restriction" ) // final int pre = PixelUtils.NonPretoPre( nonpre ); // final int a = nonpre & 0xff; // if ( a == 0xff ) // return; // if ( a == 0x00 ) // return; // int r = nonpre >> 24 & 0xff; // int g = nonpre >> 16 & 0xff; // int b = nonpre >> 8 & 0xff; // r = ( r * a + 0x7f ) / 0xff; // g = ( g * a + 0x7f ) / 0xff; // b = ( b * a + 0x7f ) / 0xff; // final int pre = a << 0 | r << 24 | g << 16 | b << 8; // final int pre = PixelUtils.NonPretoPre( nonpre ); // t.set( pre ); }
Example #15
Source File: SourceInfo.java From paintera with GNU General Public License v2.0 | 5 votes |
@Deprecated public <D extends Type<D>, T extends RealType<T>> RawSourceState<D, T> makeRawSourceState( final DataSource<D, T> source, final double min, final double max, final ARGBType color, final Composite<ARGBType, ARGBType> composite) { final ARGBColorConverter<T> converter = new ARGBColorConverter.InvertingImp1<>(min, max); converter.colorProperty().set(color); final RawSourceState<D, T> state = new RawSourceState<>(source, converter, composite, source.getName()); return state; }
Example #16
Source File: LinearIntensityMap.java From TrakEM2 with GNU General Public License v3.0 | 5 votes |
final static protected < T extends RealType< T > > void mapARGB( final IterableInterval< ARGBType > image, final IterableInterval< RealComposite< T > > coefficients ) { final Cursor< ARGBType > cs = image.cursor(); final Cursor< RealComposite< T > > ct = coefficients.cursor(); while ( cs.hasNext() ) { final RealComposite< T > t = ct.next(); final double alpha = t.get( 0 ).getRealDouble(); final double beta = t.get( 1 ).getRealDouble(); final ARGBType s = cs.next(); final int argb = s.get(); final int a = ( ( argb >> 24 ) & 0xff ); final double r = ( ( argb >> 16 ) & 0xff ) * alpha + beta; final double g = ( ( argb >> 8 ) & 0xff ) * alpha + beta; final double b = ( argb & 0xff ) * alpha + beta; s.set( ( a << 24 ) | ( ( r < 0 ? 0 : r > 255 ? 255 : ( int )( r + 0.5 ) ) << 16 ) | ( ( g < 0 ? 0 : g > 255 ? 255 : ( int )( g + 0.5 ) ) << 8 ) | ( b < 0 ? 0 : b > 255 ? 255 : ( int )( b + 0.5 ) ) ); } }
Example #17
Source File: RawSourceState.java From paintera with GNU General Public License v2.0 | 5 votes |
public RawSourceState( final DataSource<D, T> dataSource, final ARGBColorConverter<T> converter, final Composite<ARGBType, ARGBType> composite, final String name) { super(dataSource, converter, composite, name); }
Example #18
Source File: SourceState.java From paintera with GNU General Public License v2.0 | 5 votes |
static VBox defaultPreferencePaneNode(ObjectProperty<Composite<ARGBType, ARGBType>> composite) { final TitledPane titledPane = SourceStateCompositePane.createTitledPane(composite); final VBox vbox = new VBox(titledPane); vbox.setSpacing(0.0); vbox.setPadding(Insets.EMPTY); return vbox; }
Example #19
Source File: OrthoSliceFX.java From paintera with GNU General Public License v2.0 | 5 votes |
private void setTextureOpacityAndShading(final Texture texture, final Interval interval) { // NOTE: the opacity property of the MeshView object does not have any effect. // But the transparency can still be controlled by modifying the alpha channel in the texture images. final double alpha = this.opacity.get(); final double shading = this.shading.get(); final BufferExposingWritableImage[] targetImages = {texture.selfIlluminationMapImage, texture.diffuseMapImage}; final double[] brightnessFactors = {1 - shading, shading}; final RandomAccessibleInterval<ARGBType> src = Views.interval(texture.originalImage.asArrayImg(), interval); for (int i = 0; i < 2; ++i) { final BufferExposingWritableImage targetImage = targetImages[i]; final double brightnessFactor = brightnessFactors[i]; final RandomAccessibleInterval<ARGBType> dst = Views.interval(targetImage.asArrayImg(), interval); final Cursor<ARGBType> srcCursor = Views.flatIterable(src).cursor(); final Cursor<ARGBType> dstCursor = Views.flatIterable(dst).cursor(); while (dstCursor.hasNext()) { final int srcArgb = srcCursor.next().get(); final int dstArgb = ARGBType.rgba( ARGBType.red(srcArgb) * brightnessFactor, ARGBType.green(srcArgb) * brightnessFactor, ARGBType.blue(srcArgb) * brightnessFactor, alpha * 255); dstCursor.next().set(PixelUtils.NonPretoPre(dstArgb)); } } Arrays.stream(targetImages).forEach(BufferExposingWritableImage::setPixelsDirty); }
Example #20
Source File: MultiResolutionRendererFX.java From paintera with GNU General Public License v2.0 | 5 votes |
public MultiResolutionRendererFX( final TransformAwareRenderTargetGeneric<BufferExposingWritableImage> display, final PainterThread painterThread, final double[] screenScales, final long targetRenderNanos, final boolean doubleBuffered, final int numRenderingThreads, final ExecutorService renderingExecutorService, final boolean useVolatileIfAvailable, final AccumulateProjectorFactory<ARGBType> accumulateProjectorFactory, final CacheControl cacheControl) { super( display, painterThread, screenScales, targetRenderNanos, doubleBuffered, numRenderingThreads, renderingExecutorService, useVolatileIfAvailable, accumulateProjectorFactory, cacheControl, BufferExposingWritableImage::asArrayImg, new MakeWritableImage(), img -> (int) img.getWidth(), img -> (int) img.getHeight() ); }
Example #21
Source File: SourceInfo.java From paintera with GNU General Public License v2.0 | 5 votes |
@Deprecated public <D extends Type<D>, T extends RealType<T>> RawSourceState<D, T> addRawSource( final DataSource<D, T> source, final double min, final double max, final ARGBType color, final Composite<ARGBType, ARGBType> composite) { final RawSourceState<D, T> state = makeRawSourceState(source, min, max, color, composite); addState(source, state); return state; }
Example #22
Source File: CompositeProjectorPreMultiply.java From paintera with GNU General Public License v2.0 | 5 votes |
public CompositeProjectorPreMultiply( final ArrayList<VolatileProjector> sourceProjectors, final ArrayList<? extends RandomAccessible<? extends ARGBType>> sources, final RandomAccessibleInterval<ARGBType> target, final int numThreads, final ExecutorService executorService) { super(sourceProjectors, sources, target, numThreads, executorService); LOG.debug("Creating {}", this.getClass().getName()); }
Example #23
Source File: MaximumProjectorARGB.java From BigStitcher with GNU General Public License v2.0 | 5 votes |
@Override protected void accumulate( final Cursor< ? extends ARGBType >[] accesses, final ARGBType target ) { int aMax = 0, rMax = 0, gMax = 0, bMax = 0; for ( final Cursor< ? extends ARGBType > access : accesses ) { final int value = access.get().get(); final int a = ARGBType.alpha( value ); final int r = ARGBType.red( value ); final int g = ARGBType.green( value ); final int b = ARGBType.blue( value ); aMax = Math.max( aMax, a ); rMax = Math.max( rMax, r ); gMax = Math.max( gMax, g ); bMax = Math.max( bMax, b ); } if ( aMax > 255 ) aMax = 255; if ( rMax > 255 ) rMax = 255; if ( gMax > 255 ) gMax = 255; if ( bMax > 255 ) bMax = 255; target.set( ARGBType.rgba( rMax, gMax, bMax, aMax ) ); }
Example #24
Source File: Colors.java From paintera with GNU General Public License v2.0 | 5 votes |
public static Color toColor(final int argb) { final int r = ARGBType.red(argb); final int g = ARGBType.green(argb); final int b = ARGBType.blue(argb); final int a = ARGBType.alpha(argb); return Color.rgb(r, g, b, a / 255.0); }
Example #25
Source File: ARGBColorConverter.java From paintera with GNU General Public License v2.0 | 5 votes |
private void update() { final double scale = 1.0 / (max.get() - min.get()); final int value = color.get().get(); A = (int) Math.min(Math.max(Math.round(255 * alphaProperty().get()), 0), 255); scaleR = ARGBType.red(value) * scale; scaleG = ARGBType.green(value) * scale; scaleB = ARGBType.blue(value) * scale; black = ARGBType.rgba(0, 0, 0, A); }
Example #26
Source File: ARGBColorConverter.java From paintera with GNU General Public License v2.0 | 5 votes |
@Override public void convert(final R input, final ARGBType output) { final double v = input.getRealDouble() - min.get(); final int r0 = (int) (scaleR * v + 0.5); final int g0 = (int) (scaleG * v + 0.5); final int b0 = (int) (scaleB * v + 0.5); final int r = Math.min(255, Math.max(r0, 0)); final int g = Math.min(255, Math.max(g0, 0)); final int b = Math.min(255, Math.max(b0, 0)); output.set(ARGBType.rgba(r, g, b, A)); }
Example #27
Source File: AveragingProjectorARGB.java From BigStitcher with GNU General Public License v2.0 | 5 votes |
@Override public VolatileProjector createAccumulateProjector(ArrayList< VolatileProjector > sourceProjectors, ArrayList< Source< ? > > sources, ArrayList< ? extends RandomAccessible< ? extends ARGBType > > sourceScreenImages, RandomAccessibleInterval< ARGBType > targetScreenImage, int numThreads, ExecutorService executorService) { return new AveragingProjectorARGB( sourceProjectors, sourceScreenImages, targetScreenImage, numThreads, executorService ); }
Example #28
Source File: MaximumProjectorARGB.java From BigStitcher with GNU General Public License v2.0 | 5 votes |
@Override public VolatileProjector createAccumulateProjector( ArrayList< VolatileProjector > sourceProjectors, ArrayList< Source< ? > > sources, ArrayList< ? extends RandomAccessible< ? extends ARGBType > > sourceScreenImages, RandomAccessibleInterval< ARGBType > targetScreenImage, int numThreads, ExecutorService executorService) { return new MaximumProjectorARGB( sourceProjectors, sourceScreenImages, targetScreenImage, numThreads, executorService ); }
Example #29
Source File: ARGBCompositeColorConverter.java From paintera with GNU General Public License v2.0 | 5 votes |
private static < R extends RealType<R>, C extends RealComposite<R>, V extends Volatile<C>> void convertInverting( V input, final ARGBType output, final int numChannels, final DoubleProperty[] min, final double[] scaleR, final double[] scaleG, final double[] scaleB, final int A ) { double rd = 0.0; double gd = 0.0; double bd = 0.0; final RealComposite<? extends RealType<?>> c = input.get(); for (int channel = 0; channel < numChannels; ++channel) { final double v = c.get(channel).getRealDouble() - min[channel].get(); rd += scaleR[channel] * v; gd += scaleG[channel] * v; bd += scaleB[channel] * v; } final int r0 = (int) (rd + 0.5); final int g0 = (int) (gd + 0.5); final int b0 = (int) (bd + 0.5); final int r = Math.min(255, Math.max(r0, 0)); final int g = Math.min(255, Math.max(g0, 0)); final int b = Math.min(255, Math.max(b0, 0)); output.set(ARGBType.rgba(r, g, b, A)); }
Example #30
Source File: Screenshot.java From sciview with BSD 2-Clause "Simplified" License | 5 votes |
@Override public void run() { Img<ARGBType> screenshot = sciView.getARGBScreenshot(); img = new ImgPlus<>(screenshot); uiService.show(img); }