bdv.viewer.ViewerOptions Java Examples
The following examples show how to use
bdv.viewer.ViewerOptions.
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: OrthogonalViews.java From paintera with GNU General Public License v2.0 | 6 votes |
private static ViewerAndTransforms create( final GlobalTransformManager manager, final CacheControl cacheControl, final ViewerOptions optional, final ViewerAxis axis, final Function<Source<?>, Interpolation> interpolation) { final AffineTransform3D globalToViewer = ViewerAxis.globalToViewer(axis); LOG.debug("Generating viewer, axis={}, globalToViewer={}", axis, globalToViewer); final ViewerPanelFX viewer = new ViewerPanelFX( 1, cacheControl, optional, interpolation ); final AffineTransformWithListeners displayTransform = new AffineTransformWithListeners(); final AffineTransformWithListeners globalToViewerTransform = new AffineTransformWithListeners(globalToViewer); return new ViewerAndTransforms(viewer, manager, displayTransform, globalToViewerTransform); }
Example #2
Source File: ViewerPanelFX.java From paintera with GNU General Public License v2.0 | 5 votes |
public ViewerPanelFX( final List<SourceAndConverter<?>> sources, final int numTimePoints, final CacheControl cacheControl, final Function<Source<?>, Interpolation> interpolation) { this(sources, numTimePoints, cacheControl, ViewerOptions.options(), interpolation); }
Example #3
Source File: OrthogonalViews.java From paintera with GNU General Public License v2.0 | 5 votes |
/** * * @param manager manages the transform from world coordinates to shared viewer space and is shared by all {@link ViewerPanelFX viewers}. * @param cacheControl shared between all {@link ViewerPanelFX viewers} * @param optional Options for {@link ViewerPanelFX} * @param bottomRight bottom right child * @param interpolation {@link Interpolation interpolation} lookup for every {@link Source} */ public OrthogonalViews( final GlobalTransformManager manager, final CacheControl cacheControl, final ViewerOptions optional, final BR bottomRight, final Function<Source<?>, Interpolation> interpolation) { this.manager = manager; this.topLeft = create(this.manager, cacheControl, optional, ViewerAxis.Z, interpolation); this.topRight = create(this.manager, cacheControl, optional, ViewerAxis.X, interpolation); this.bottomLeft = create(this.manager, cacheControl, optional, ViewerAxis.Y, interpolation); this.grid = new ResizableGridPane2x2<>(topLeft.viewer, topRight.viewer, bottomLeft.viewer, bottomRight); this.queue = cacheControl; }
Example #4
Source File: PainteraBaseView.java From paintera with GNU General Public License v2.0 | 5 votes |
/** * * delegates to {@link #PainteraBaseView(int, ViewerOptions, KeyAndMouseConfig) {@code PainteraBaseView(numFetcherThreads, ViewerOptions.options())}} */ public PainteraBaseView( final int numFetcherThreads, final KeyAndMouseConfig keyAndMouseBindings) { this(numFetcherThreads, ViewerOptions.options(), keyAndMouseBindings); }
Example #5
Source File: PainteraBaseView.java From paintera with GNU General Public License v2.0 | 5 votes |
/** * * @param numFetcherThreads number of threads used for {@link net.imglib2.cache.queue.FetcherThreads} * @param viewerOptions options passed down to {@link OrthogonalViews viewers} */ public PainteraBaseView( final int numFetcherThreads, final ViewerOptions viewerOptions, final KeyAndMouseConfig keyAndMouseBindings) { super(); this.sharedQueue = new SharedQueue(numFetcherThreads, 50); this.keyAndMouseBindings = keyAndMouseBindings; this.viewerOptions = viewerOptions .accumulateProjectorFactory(new CompositeProjectorPreMultiply.CompositeProjectorFactory(sourceInfo .composites())) // .accumulateProjectorFactory( new // ClearingCompositeProjector.ClearingCompositeProjectorFactory<>( // sourceInfo.composites(), new ARGBType() ) ) .numRenderingThreads(Math.min(3, Math.max(1, Runtime.getRuntime().availableProcessors() / 3))); this.views = new OrthogonalViews<>( manager, this.sharedQueue, this.viewerOptions, viewer3D, s -> Optional.ofNullable(sourceInfo.getState(s)).map(SourceState::interpolationProperty).map(ObjectProperty::get).orElse(Interpolation.NLINEAR)); this.allowedActionsProperty = new SimpleObjectProperty<>(DEFAULT_ALLOWED_ACTIONS); this.vsacUpdate = change -> views.setAllSources(visibleSourcesAndConverters); visibleSourcesAndConverters.addListener(vsacUpdate); LOG.debug("Meshes group={}", viewer3D.meshesGroup()); }
Example #6
Source File: MinimalTest.java From BigStitcher with GNU General Public License v2.0 | 5 votes |
public static void main( String[] args ) { new ImageJ(); SpimData spimData = twoAngles(); // crashes for version 2.0.0 // with version 2.2.0-SNAPSHOT it crashes when calling the brightness dialog, silently // doesn't rotate afterwards BigDataViewer.open( spimData, "Test 32bit", null, new ViewerOptions() ); }
Example #7
Source File: ViewSetupExplorerPanel.java From SPIM_Registration with GNU General Public License v2.0 | 5 votes |
public ViewSetupExplorerPanel( final ViewSetupExplorer< AS, X > explorer, final AS data, final String xml, final X io ) { this.explorer = explorer; this.listeners = new ArrayList< SelectedViewDescriptionListener< AS > >(); this.data = data; this.xml = xml.replace( "\\", "/" ).replace( "//", "/" ).replace( "/./", "/" ); this.io = io; this.isMac = System.getProperty( "os.name" ).toLowerCase().contains( "mac" ); this.selectedRows = new HashSet< BasicViewDescription< ? extends BasicViewSetup > >(); this.firstSelectedVD = null; initComponent(); if ( Hdf5ImageLoader.class.isInstance( data.getSequenceDescription().getImgLoader() ) ) { final BDVPopup bdvpopup = bdvPopup(); if ( bdvpopup != null ) { bdvpopup.bdv = BigDataViewer.open( getSpimData(), xml(), IOFunctions.getProgressWriter(), ViewerOptions.options() ); // if ( !bdv.tryLoadSettings( panel.xml() ) ) TODO: this should work, but currently tryLoadSettings is protected. fix that. InitializeViewerState.initBrightness( 0.001, 0.999, bdvpopup.bdv.getViewer(), bdvpopup.bdv.getSetupAssignments() ); // do not rotate BDV view by default BDVPopup.initTransform( bdvpopup.bdv.getViewer() ); setFusedModeSimple( bdvpopup.bdv, data ); } } }
Example #8
Source File: ViewerPanelFX.java From paintera with GNU General Public License v2.0 | 4 votes |
/** * * Will create {@link ViewerPanelFX} and populate with {@code sources}. * * @param sources * the {@link SourceAndConverter sources} to display. * @param numTimepoints * number of available timepoints. * @param cacheControl * to control IO budgeting and fetcher queue. * @param optional * optional parameters. See {@link ViewerOptions#options()}. * @param interpolation * Get interpolation method for each data source. */ public ViewerPanelFX( final List<SourceAndConverter<?>> sources, final int numTimepoints, final CacheControl cacheControl, final ViewerOptions optional, final Function<Source<?>, Interpolation> interpolation) { super(); super.getChildren().setAll(canvasPane, overlayPane); this.renderingExecutorService = Executors.newFixedThreadPool(optional.values.getNumRenderingThreads(), new RenderThreadFactory()); options = optional.values; threadGroup = new ThreadGroup(this.toString()); viewerTransform = new AffineTransform3D(); transformListeners = new CopyOnWriteArrayList<>(); mouseTracker.installInto(this); this.renderUnit = new RenderUnit( threadGroup, this::getState, interpolation, options.getAccumulateProjectorFactory(), cacheControl, options.getTargetRenderNanos(), options.getNumRenderingThreads(), renderingExecutorService ); setRenderedImageListener(); this.widthProperty().addListener((obs, oldv, newv) -> this.renderUnit.setDimensions((long)getWidth(), (long)getHeight())); this.heightProperty().addListener((obs, oldv, newv) -> this.renderUnit.setDimensions((long)getWidth(), (long)getHeight())); setWidth(options.getWidth()); setHeight(options.getHeight()); // TODO why is this necessary? transformListeners.add(tf -> getDisplay().drawOverlays()); this.state = new ViewerState(numTimepoints); state.addListener(obs -> requestRepaint()); setAllSources(sources); }
Example #9
Source File: BDVRenderer.java From 3Dscript with BSD 2-Clause "Simplified" License | 4 votes |
public void openBDV(File xmlFile) throws SpimDataException { options = ViewerOptions.options(); viewer = BigDataViewer.open(xmlFile.getAbsolutePath(), xmlFile.getName(), new ProgressWriterIJ(), options); }
Example #10
Source File: BDVPopupStitching.java From BigStitcher with GNU General Public License v2.0 | 4 votes |
public static BigDataViewer createBDV( final ExplorerWindow< ? , ? > panel , LinkOverlay lo) { if ( AbstractImgLoader.class.isInstance( panel.getSpimData().getSequenceDescription().getImgLoader() ) ) { if ( JOptionPane.showConfirmDialog( null, "Opening <SpimData> dataset that is not suited for interactive browsing.\n" + "Consider resaving as HDF5 for better performance.\n" + "Proceed anyways?", "Warning", JOptionPane.YES_NO_OPTION ) == JOptionPane.NO_OPTION ) return null; } boolean allViews2D = true; @SuppressWarnings("unchecked") final Collection< BasicViewDescription< ? > > viewDescriptions = (Collection< BasicViewDescription< ? > >) panel.getSpimData().getSequenceDescription().getViewDescriptions().values(); for (final BasicViewDescription< ? > vd : viewDescriptions) if (vd.isPresent() && vd.getViewSetup().hasSize() && vd.getViewSetup().getSize().dimension( 2 ) != 1) { allViews2D = false; break; } final ViewerOptions options = ViewerOptions.options().accumulateProjectorFactory( MaximumProjectorARGB.factory ); if (allViews2D) { options.transformEventHandlerFactory(new BehaviourTransformEventHandlerPlanarFactory() ); } BigDataViewer bdv = BigDataViewer.open( panel.getSpimData(), "BigDataViewer", null, options ); BDVPopup.initTransform( bdv.getViewer() ); // if ( !bdv.tryLoadSettings( panel.xml() ) ) TODO: this should // work, but currently tryLoadSettings is protected. fix that. BDVPopup.initBrightness( 0.001, 0.999, bdv.getViewer().getState(), bdv.getSetupAssignments() ); FilteredAndGroupedExplorerPanel.setFusedModeSimple( bdv, panel.getSpimData() ); minMaxGroupByChannels( bdv, panel.getSpimData() ); colorByChannels( bdv, panel.getSpimData(), 0 ); Set<Class<? extends Entity>> groupingFactors = new HashSet<>(); groupingFactors.add( Channel.class ); groupingFactors.add( Illumination.class ); groupSourcesByFactors( bdv, panel.getSpimData(), groupingFactors ); FilteredAndGroupedExplorerPanel.updateBDV( bdv, panel.colorMode(), panel.getSpimData(), panel.firstSelectedVD(), ((GroupedRowWindow)panel).selectedRowsGroups()); ScrollableBrightnessDialog.setAsBrightnessDialog( bdv ); bdv.getViewer().addTransformListener( lo ); bdv.getViewer().getDisplay().addOverlayRenderer( lo ); bdv.getViewerFrame().setVisible( true ); bdv.getViewer().requestRepaint(); return bdv; }
Example #11
Source File: BDVPopup.java From SPIM_Registration with GNU General Public License v2.0 | 4 votes |
public static BigDataViewer createBDV( final ViewSetupExplorerPanel< ?, ? > panel ) { BasicImgLoader il = panel.getSpimData().getSequenceDescription().getImgLoader(); if ( AbstractImgLoader.class.isInstance( il ) || StackImgLoader.class.isInstance( il ) ) { if ( JOptionPane.showConfirmDialog( null, "Opening <SpimData> dataset that is not suited for interactive browsing.\n" + "Consider resaving as HDF5 for better performance.\n" + "Proceed anyways?", "Warning", JOptionPane.YES_NO_OPTION ) == JOptionPane.NO_OPTION ) return null; } BigDataViewer bdv = BigDataViewer.open( panel.getSpimData(), panel.xml(), IOFunctions.getProgressWriter(), ViewerOptions.options() ); // if ( !bdv.tryLoadSettings( panel.xml() ) ) TODO: this should work, but currently tryLoadSettings is protected. fix that. InitializeViewerState.initBrightness( 0.001, 0.999, bdv.getViewer(), bdv.getSetupAssignments() ); // do not rotate BDV view by default BDVPopup.initTransform( bdv.getViewer() ); ViewSetupExplorerPanel.updateBDV( bdv, panel.colorMode(), panel.getSpimData(), panel.firstSelectedVD(), panel.selectedRows() ); // final ArrayList< InterestPointSource > interestPointSources = new ArrayList< InterestPointSource >(); // interestPointSources.add( new InterestPointSource() // { // private final ArrayList< RealPoint > points; // { // points = new ArrayList< RealPoint >(); // final Random rand = new Random(); // for ( int i = 0; i < 1000; ++i ) // points.add( new RealPoint( rand.nextDouble() * 1400, rand.nextDouble() * 800, rand.nextDouble() * 300 ) ); // } // // @Override // public final Collection< ? extends RealLocalizable > getLocalCoordinates( final int timepointIndex ) // { // return points; // } // // @Override // public void getLocalToGlobalTransform( final int timepointIndex, final AffineTransform3D transform ) // { // transform.identity(); // } // } ); // final InterestPointOverlay interestPointOverlay = new InterestPointOverlay( bdv.getViewer(), interestPointSources ); // bdv.getViewer().addRenderTransformListener( interestPointOverlay ); // bdv.getViewer().getDisplay().addOverlayRenderer( interestPointOverlay ); // bdv.getViewer().removeTransformListener( interestPointOverlay ); // bdv.getViewer().getDisplay().removeOverlayRenderer( interestPointOverlay ); return bdv; }
Example #12
Source File: BigDataViewerBoundingBox.java From SPIM_Registration with GNU General Public License v2.0 | 4 votes |
public static Pair< BigDataViewer, Boolean > getBDV( final AbstractSpimData< ? > spimData, final Collection< ViewId > viewIdsToProcess ) { final BDVPopup popup = ViewSetupExplorerPanel.bdvPopup(); BigDataViewer bdv; boolean bdvIsLocal = false; if ( popup == null || popup.panel == null ) { // locally run instance if ( AbstractImgLoader.class.isInstance( spimData.getSequenceDescription().getImgLoader() ) ) { if ( JOptionPane.showConfirmDialog( null, "Opening <SpimData> dataset that is not suited for interactive browsing.\n" + "Consider resaving as HDF5 for better performance.\n" + "Proceed anyways?", "Warning", JOptionPane.YES_NO_OPTION ) == JOptionPane.NO_OPTION ) return null; } bdv = BigDataViewer.open( spimData, "BigDataViewer", IOFunctions.getProgressWriter(), ViewerOptions.options() ); bdvIsLocal = true; // if ( !bdv.tryLoadSettings( panel.xml() ) ) TODO: this should work, but currently tryLoadSettings is protected. fix that. InitializeViewerState.initBrightness( 0.001, 0.999, bdv.getViewer(), bdv.getSetupAssignments() ); final List< BasicViewDescription< ? > > vds = new ArrayList< BasicViewDescription< ? > >(); for ( final ViewId viewId : viewIdsToProcess ) vds.add( spimData.getSequenceDescription().getViewDescriptions().get( viewId ) ); ViewSetupExplorerPanel.updateBDV( bdv, true, spimData, null, vds ); } else if ( popup.bdv == null ) { // if BDV was closed by the user if ( popup.bdv != null && !popup.bdv.getViewerFrame().isVisible() ) popup.bdv = null; try { bdv = popup.bdv = BDVPopup.createBDV( popup.panel ); } catch (Exception e) { IOFunctions.println( "Could not run BigDataViewer: " + e ); e.printStackTrace(); bdv = popup.bdv = null; } } else { bdv = popup.bdv; } return new ValuePair< BigDataViewer, Boolean >( bdv, bdvIsLocal ); }
Example #13
Source File: ViewerPanelFX.java From paintera with GNU General Public License v2.0 | 3 votes |
/** * Will create {@link ViewerPanelFX} without any data sources and a single time point. * * @param cacheControl * to control IO budgeting and fetcher queue. * @param optional * optional parameters. See {@link ViewerOptions#options()}. * @param interpolation * Get interpolation method for each data source. */ public ViewerPanelFX( final CacheControl cacheControl, final ViewerOptions optional, final Function<Source<?>, Interpolation> interpolation) { this(1, cacheControl, optional, interpolation); }
Example #14
Source File: ViewerPanelFX.java From paintera with GNU General Public License v2.0 | 3 votes |
/** * Will create {@link ViewerPanelFX} without any data sources. * * @param numTimepoints * number of available timepoints. * @param cacheControl * to control IO budgeting and fetcher queue. * @param optional * optional parameters. See {@link ViewerOptions#options()}. * @param interpolation * Get interpolation method for each data source. */ public ViewerPanelFX( final int numTimepoints, final CacheControl cacheControl, final ViewerOptions optional, final Function<Source<?>, Interpolation> interpolation) { this(new ArrayList<>(), numTimepoints, cacheControl, optional, interpolation); }