bdv.tools.brightness.ConverterSetup Java Examples
The following examples show how to use
bdv.tools.brightness.ConverterSetup.
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: SciView.java From sciview with BSD 2-Clause "Simplified" License | 5 votes |
/** * Adds a SourceAndConverter to the scene. * * @param sources The list of SourceAndConverter to add * @param name Name of the dataset * @param voxelDimensions Array with voxel dimensions. * @param <T> Type of the dataset. * @return THe node corresponding to the volume just added. */ public <T extends RealType<T>> Node addVolume(List<SourceAndConverter<T>> sources, int numTimepoints, String name, float... voxelDimensions ) { int setupId = 0; ArrayList<ConverterSetup> converterSetups = new ArrayList<>(); for( SourceAndConverter source: sources ) { converterSetups.add(BigDataViewer.createConverterSetup(source, setupId++)); } return addVolume(sources, converterSetups, numTimepoints, name, voxelDimensions); }
Example #3
Source File: BDVRenderer.java From 3Dscript with BSD 2-Clause "Simplified" License | 4 votes |
public BDVRenderer(File xmlFile) throws SpimDataException { openBDV(xmlFile); // this.tgtW = 0; // TODO // this.tgtH = 0; // TODO float[] pdOut = new float[] {1, 1, 1}; float[] pdIn = new float[] {1, 1, 1}; this.rotationCenter = calculateRotationCenter(); System.out.println("rotcenter: " + Arrays.toString(rotationCenter)); float[] rotcenter = rotationCenter.clone(); CombinedTransform transformation = new CombinedTransform(pdIn, pdOut, rotcenter); DisplayMode mode = viewer.getViewer().getVisibilityAndGrouping().getDisplayMode(); int tp = viewer.getViewer().getState().getCurrentTimepoint(); Interpolation interpolation = viewer.getViewer().getState().getInterpolation(); int currentSource = viewer.getViewer().getState().getCurrentSource(); int nSources = viewer.getViewer().getState().numSources(); double[] min = new double[nSources]; double[] max = new double[nSources]; Color[] colors = new Color[nSources]; SetupAssignments setupAssignments = viewer.getSetupAssignments(); for(int s = 0; s < nSources; s++) { final ConverterSetup setup = setupAssignments.getConverterSetups().get(s); colors[s] = new Color(setup.getColor().get()); min[s] = setup.getDisplayRangeMin(); max[s] = setup.getDisplayRangeMax(); } this.rs = new BDVRenderingState(0, mode, tp, interpolation, currentSource, // current source transformation, colors, min, max); }
Example #4
Source File: BDVRenderer.java From 3Dscript with BSD 2-Clause "Simplified" License | 4 votes |
@Override public ImageProcessor render(RenderingState kf) { BDVRenderingState bkf = (BDVRenderingState)kf; ViewerPanel panel = viewer.getViewer(); ViewerState state = panel.getState(); SetupAssignments setupAssignments = viewer.getSetupAssignments(); for(int s = 0; s < state.numSources(); s++) { final ConverterSetup setup = setupAssignments.getConverterSetups().get(s); setup.setColor(new ARGBType(bkf.getChannelColor(s).getRGB())); setup.setDisplayRange(bkf.getChannelMin(s), bkf.getChannelMax(s)); } DisplayMode displaymode = bkf.getDisplayMode(); Interpolation interpolation = bkf.getInterpolation(); int timepoint = bkf.getTimepoint(); int currentSource = bkf.getCurrentSource(); panel.setDisplayMode(displaymode); if(state.getInterpolation() != interpolation) panel.toggleInterpolation(); panel.setTimepoint(timepoint); panel.getVisibilityAndGrouping().setCurrentSource(currentSource); CombinedTransform transform = kf.getFwdTransform(); float[] tmp = calculateForwardTransform(transform); int w = panel.getWidth(); int h = panel.getHeight(); double rw = 2 * rotationCenter[0]; double rh = 2 * rotationCenter[1]; double scaleX = w / rw; double scaleY = h / rh; double scale = Math.min(scaleX, scaleY); rw = rw * scale; rh = rh * scale; double tx = (w - rw) / 2; double ty = (h - rh) / 2; AffineTransform3D affine = new AffineTransform3D(); affine.set(toDouble(tmp)); affine.scale(scale); affine.translate(tx, ty, 0); panel.setCurrentViewerTransform(affine); return takeSnapshot().getProcessor(); }
Example #5
Source File: BDVRenderer.java From 3Dscript with BSD 2-Clause "Simplified" License | 4 votes |
protected void transferImpSettings(final ImagePlus imp, final SetupAssignments setupAssignments) { final ConverterSetup setup = setupAssignments.getConverterSetups().get(0); setup.setDisplayRange(imp.getDisplayRangeMin(), imp.getDisplayRangeMax()); }
Example #6
Source File: SciView.java From sciview with BSD 2-Clause "Simplified" License | 4 votes |
/** * Add an IterableInterval to the image with the specified voxelDimensions and name * This version of addVolume does most of the work * @param image * @param name * @param voxelDimensions * @param <T> * @return a Node corresponding to the Volume */ public <T extends RealType<T>> Node addVolume( RandomAccessibleInterval<T> image, String name, float... voxelDimensions ) { //log.debug( "Add Volume " + name + " image: " + image ); long[] dimensions = new long[image.numDimensions()]; image.dimensions( dimensions ); long[] minPt = new long[image.numDimensions()]; // Get type at min point RandomAccess<T> imageRA = image.randomAccess(); image.min(minPt); imageRA.setPosition(minPt); T voxelType = imageRA.get().createVariable(); ArrayList<ConverterSetup> converterSetups = new ArrayList(); ArrayList<RandomAccessibleInterval<T>> stacks = AxisOrder.splitInputStackIntoSourceStacks(image, AxisOrder.getAxisOrder(AxisOrder.DEFAULT, image, false)); AffineTransform3D sourceTransform = new AffineTransform3D(); ArrayList<SourceAndConverter<T>> sources = new ArrayList(); int numTimepoints = 1; for (RandomAccessibleInterval stack : stacks) { Source<T> s; if (stack.numDimensions() > 3) { numTimepoints = (int) (stack.max(3) + 1); s = new RandomAccessibleIntervalSource4D<T>(stack, voxelType, sourceTransform, name); } else { s = new RandomAccessibleIntervalSource<T>(stack, voxelType, sourceTransform, name); } SourceAndConverter<T> source = BigDataViewer.wrapWithTransformedSource( new SourceAndConverter<T>(s, BigDataViewer.createConverterToARGB(voxelType))); converterSetups.add(BigDataViewer.createConverterSetup(source, Volume.Companion.getSetupId().getAndIncrement())); sources.add(source); } Node v = addVolume(sources, numTimepoints, name, voxelDimensions); v.getMetadata().put("RandomAccessibleInterval", image); return v; }
Example #7
Source File: SciView.java From sciview with BSD 2-Clause "Simplified" License | 4 votes |
/** * Adds a SourceAndConverter to the scene. * * This method actually instantiates the volume. * * @param sources The list of SourceAndConverter to add * @param name Name of the dataset * @param voxelDimensions Array with voxel dimensions. * @param <T> Type of the dataset. * @return THe node corresponding to the volume just added. */ public <T extends RealType<T>> Node addVolume(List<SourceAndConverter<T>> sources, ArrayList<ConverterSetup> converterSetups, int numTimepoints, String name, float... voxelDimensions ) { CacheControl cacheControl = null; // RandomAccessibleInterval<T> image = // ((RandomAccessibleIntervalSource4D) sources.get(0).getSpimSource()). // .getSource(0, 0); RandomAccessibleInterval<T> image = sources.get(0).getSpimSource().getSource(0, 0); if (image instanceof VolatileView) { VolatileViewData<T, Volatile<T>> viewData = ((VolatileView<T, Volatile<T>>) image).getVolatileViewData(); cacheControl = viewData.getCacheControl(); } long[] dimensions = new long[image.numDimensions()]; image.dimensions( dimensions ); long[] minPt = new long[image.numDimensions()]; // Get type at min point RandomAccess<T> imageRA = image.randomAccess(); image.min(minPt); imageRA.setPosition(minPt); T voxelType = imageRA.get().createVariable(); System.out.println("addVolume " + image.numDimensions() + " interval " + ((Interval) image) ); //int numTimepoints = 1; if( image.numDimensions() > 3 ) { numTimepoints = (int) image.dimension(3); } Volume.VolumeDataSource.RAISource<T> ds = new Volume.VolumeDataSource.RAISource<T>(voxelType, sources, converterSetups, numTimepoints, cacheControl); VolumeViewerOptions options = new VolumeViewerOptions(); Volume v = new RAIVolume(ds, options, getHub()); v.setName(name); v.getMetadata().put("sources", sources); TransferFunction tf = v.getTransferFunction(); float rampMin = 0f; float rampMax = 0.1f; tf.clear(); tf.addControlPoint(0.0f, 0.0f); tf.addControlPoint(rampMin, 0.0f); tf.addControlPoint(1.0f, rampMax); BoundingGrid bg = new BoundingGrid(); bg.setNode(v); return addNode(v); }
Example #8
Source File: StitchingExplorerPanel.java From BigStitcher with GNU General Public License v2.0 | 4 votes |
public static void colorSources(final List< ConverterSetup > cs, final long j) { for ( int i = 0; i < cs.size(); ++i ) cs.get( i ).setColor( new ARGBType( ColorStream.get( i + j ) ) ); }
Example #9
Source File: StitchingExplorerPanel.java From BigStitcher with GNU General Public License v2.0 | 4 votes |
public static void whiteSources(final List< ConverterSetup > cs) { for ( int i = 0; i < cs.size(); ++i ) cs.get( i ).setColor( new ARGBType( ARGBType.rgba( 255, 255, 255, 0 ) ) ); }
Example #10
Source File: ViewSetupExplorerPanel.java From SPIM_Registration with GNU General Public License v2.0 | 4 votes |
public static void colorSources( final List< ConverterSetup > cs, final long j ) { for ( int i = 0; i < cs.size(); ++i ) cs.get( i ).setColor( new ARGBType( ColorStream.get( i + j ) ) ); }
Example #11
Source File: ViewSetupExplorerPanel.java From SPIM_Registration with GNU General Public License v2.0 | 4 votes |
public static void whiteSources( final List< ConverterSetup > cs ) { for ( int i = 0; i < cs.size(); ++i ) cs.get( i ).setColor( new ARGBType( ARGBType.rgba( 255, 255, 255, 0 ) ) ); }