diff --git a/pom.xml b/pom.xml index faacb112c..800983e01 100644 --- a/pom.xml +++ b/pom.xml @@ -105,12 +105,8 @@ like Selective Plane Illumination Microscopy (SPIM) Data. sign,deploy-to-scijava - 6.1.0 - 0.13.2 - 1.0.0-beta-17 - 10.4.6 - 1.0.0-beta-32 - 5.0.0 + 10.4.12 + 1.0.0-beta-33 diff --git a/src/main/java/net/preibisch/mvrecon/fiji/datasetmanager/grid/RegularTranformHelpers.java b/src/main/java/net/preibisch/mvrecon/fiji/datasetmanager/grid/RegularTranformHelpers.java index 89eefedab..ddf4e5bff 100644 --- a/src/main/java/net/preibisch/mvrecon/fiji/datasetmanager/grid/RegularTranformHelpers.java +++ b/src/main/java/net/preibisch/mvrecon/fiji/datasetmanager/grid/RegularTranformHelpers.java @@ -264,8 +264,8 @@ private static int prod(int ... v) } public static > void applyToSpimData( - AS data, - List > > viewDescriptions, + AS data, + List > > viewDescriptions, RegularTranslationParameters params, boolean applyToAllTimePoints) { @@ -313,8 +313,8 @@ private static int getRotationAxisFromUnitVector(double[] axis) } private static > void applyToSpimDataSingleTP( - AS data, - List< ? extends Group< ? extends BasicViewDescription< ? extends BasicViewSetup > > > viewDescriptions, + AS data, + List< ? extends Group< ? extends BasicViewDescription< ? > > > viewDescriptions, RegularTranslationParameters params, TimePoint tp) { diff --git a/src/main/java/net/preibisch/mvrecon/fiji/plugin/Data_Explorer.java b/src/main/java/net/preibisch/mvrecon/fiji/plugin/Data_Explorer.java index 87a45c5dc..6b08e0068 100644 --- a/src/main/java/net/preibisch/mvrecon/fiji/plugin/Data_Explorer.java +++ b/src/main/java/net/preibisch/mvrecon/fiji/plugin/Data_Explorer.java @@ -73,7 +73,7 @@ public void actionPerformed(ActionEvent e) final String xml = result.getXMLFileName(); final XmlIoSpimData2 io = result.getIO(); - final ViewSetupExplorer< SpimData2, XmlIoSpimData2 > explorer = new ViewSetupExplorer( data, xml, io ); + final ViewSetupExplorer< SpimData2 > explorer = new ViewSetupExplorer<>( data, xml, io ); explorer.getFrame().toFront(); } diff --git a/src/main/java/net/preibisch/mvrecon/fiji/plugin/Interest_Point_Detection.java b/src/main/java/net/preibisch/mvrecon/fiji/plugin/Interest_Point_Detection.java index 55278a5d7..ec0736cbd 100644 --- a/src/main/java/net/preibisch/mvrecon/fiji/plugin/Interest_Point_Detection.java +++ b/src/main/java/net/preibisch/mvrecon/fiji/plugin/Interest_Point_Detection.java @@ -66,7 +66,7 @@ public class Interest_Point_Detection implements PlugIn public static boolean defaultGroupTiles = true; public static boolean defaultGroupIllums = true; - public static ExplorerWindow< ?, ? > currentPanel; + public static ExplorerWindow< ? > currentPanel; static { diff --git a/src/main/java/net/preibisch/mvrecon/fiji/plugin/Split_Views.java b/src/main/java/net/preibisch/mvrecon/fiji/plugin/Split_Views.java index 6003a8292..5e2bc5a85 100644 --- a/src/main/java/net/preibisch/mvrecon/fiji/plugin/Split_Views.java +++ b/src/main/java/net/preibisch/mvrecon/fiji/plugin/Split_Views.java @@ -86,7 +86,7 @@ public static boolean split( if ( display ) { - final ViewSetupExplorer< SpimData2, XmlIoSpimData2 > explorer = new ViewSetupExplorer( newSD, saveAs, new XmlIoSpimData2( "" ) ); + final ViewSetupExplorer< SpimData2 > explorer = new ViewSetupExplorer<>( newSD, saveAs, new XmlIoSpimData2( "" ) ); explorer.getFrame().toFront(); } else diff --git a/src/main/java/net/preibisch/mvrecon/fiji/spimdata/explorer/ExplorerWindow.java b/src/main/java/net/preibisch/mvrecon/fiji/spimdata/explorer/ExplorerWindow.java index 10a754b76..26435afca 100644 --- a/src/main/java/net/preibisch/mvrecon/fiji/spimdata/explorer/ExplorerWindow.java +++ b/src/main/java/net/preibisch/mvrecon/fiji/spimdata/explorer/ExplorerWindow.java @@ -32,9 +32,9 @@ import mpicbg.spim.data.generic.sequence.BasicViewSetup; import mpicbg.spim.data.sequence.ViewId; -public interface ExplorerWindow< AS extends AbstractSpimData< ? >, X extends XmlIoAbstractSpimData< ?, AS > > +public interface ExplorerWindow< AS extends AbstractSpimData< ? > > { - public List< BasicViewDescription< ? extends BasicViewSetup > > selectedRows(); + public List< BasicViewDescription< ? > > selectedRows(); public List< ViewId > selectedRowsViewId(); public AS getSpimData(); public void updateContent(); @@ -48,5 +48,5 @@ public interface ExplorerWindow< AS extends AbstractSpimData< ? >, X extends Xml // BDV-specific public BasicBDVPopup bdvPopup(); public boolean colorMode(); - public BasicViewDescription< ? extends BasicViewSetup > firstSelectedVD(); + public BasicViewDescription< ? > firstSelectedVD(); } diff --git a/src/main/java/net/preibisch/mvrecon/fiji/spimdata/explorer/FilteredAndGroupedExplorer.java b/src/main/java/net/preibisch/mvrecon/fiji/spimdata/explorer/FilteredAndGroupedExplorer.java index 7998a264b..5e0642f8c 100644 --- a/src/main/java/net/preibisch/mvrecon/fiji/spimdata/explorer/FilteredAndGroupedExplorer.java +++ b/src/main/java/net/preibisch/mvrecon/fiji/spimdata/explorer/FilteredAndGroupedExplorer.java @@ -27,19 +27,18 @@ import javax.swing.JFrame; import mpicbg.spim.data.generic.AbstractSpimData; -import mpicbg.spim.data.generic.XmlIoAbstractSpimData; -public abstract class FilteredAndGroupedExplorer, X extends XmlIoAbstractSpimData< ?, AS >> +public abstract class FilteredAndGroupedExplorer > { protected JFrame frame; - protected FilteredAndGroupedExplorerPanel< AS, X > panel; + protected FilteredAndGroupedExplorerPanel< AS > panel; public AS getSpimData() { return panel.getSpimData(); } - public FilteredAndGroupedExplorerPanel< AS, X > getPanel() + public FilteredAndGroupedExplorerPanel< AS > getPanel() { return panel; } public JFrame getFrame() diff --git a/src/main/java/net/preibisch/mvrecon/fiji/spimdata/explorer/FilteredAndGroupedExplorerPanel.java b/src/main/java/net/preibisch/mvrecon/fiji/spimdata/explorer/FilteredAndGroupedExplorerPanel.java index a84abdb8b..351a31b31 100644 --- a/src/main/java/net/preibisch/mvrecon/fiji/spimdata/explorer/FilteredAndGroupedExplorerPanel.java +++ b/src/main/java/net/preibisch/mvrecon/fiji/spimdata/explorer/FilteredAndGroupedExplorerPanel.java @@ -22,6 +22,7 @@ */ package net.preibisch.mvrecon.fiji.spimdata.explorer; +import java.awt.event.KeyAdapter; import java.awt.event.KeyEvent; import java.awt.event.KeyListener; import java.util.ArrayList; @@ -29,8 +30,9 @@ import java.util.Collections; import java.util.HashSet; import java.util.List; -import java.util.Map; +import java.util.Set; +import java.util.stream.Collectors; import javax.swing.JPanel; import javax.swing.JPopupMenu; import javax.swing.JTable; @@ -40,10 +42,9 @@ import bdv.BigDataViewer; import bdv.tools.HelpDialog; import bdv.tools.brightness.ConverterSetup; -import bdv.tools.transformation.TransformedSource; import bdv.viewer.DisplayMode; -import bdv.viewer.VisibilityAndGrouping; -import bdv.viewer.state.SourceState; +import bdv.viewer.SourceAndConverter; +import bdv.viewer.ViewerState; import mpicbg.spim.data.SpimDataException; import mpicbg.spim.data.generic.AbstractSpimData; import mpicbg.spim.data.generic.XmlIoAbstractSpimData; @@ -62,6 +63,7 @@ import net.preibisch.mvrecon.fiji.spimdata.SpimData2; import net.preibisch.mvrecon.fiji.spimdata.SpimDataTools; import net.preibisch.mvrecon.fiji.spimdata.explorer.bdv.BDVFlyThrough; +import net.preibisch.mvrecon.fiji.spimdata.explorer.bdv.BDVUtils; import net.preibisch.mvrecon.fiji.spimdata.explorer.popup.BDVPopup; import net.preibisch.mvrecon.fiji.spimdata.explorer.popup.ExplorerWindowSetable; import net.preibisch.mvrecon.fiji.spimdata.interestpoints.InterestPoints; @@ -69,10 +71,10 @@ import net.preibisch.mvrecon.fiji.spimdata.interestpoints.ViewInterestPoints; import net.preibisch.mvrecon.process.interestpointregistration.TransformationTools; -public abstract class FilteredAndGroupedExplorerPanel, X extends XmlIoAbstractSpimData< ?, AS >> - extends JPanel implements ExplorerWindow< AS, X >, GroupedRowWindow +public abstract class FilteredAndGroupedExplorerPanel< AS extends AbstractSpimData< ? > > + extends JPanel implements ExplorerWindow< AS >, GroupedRowWindow { - public static FilteredAndGroupedExplorerPanel< ?, ? > currentInstance = null; + public static FilteredAndGroupedExplorerPanel< ? > currentInstance = null; protected ArrayList< ExplorerWindowSetable > popups; @@ -81,32 +83,31 @@ public abstract class FilteredAndGroupedExplorerPanel tableModel; protected ArrayList< SelectedViewDescriptionListener< AS > > listeners; protected AS data; - protected FilteredAndGroupedExplorer< AS, X > explorer; + protected FilteredAndGroupedExplorer< AS > explorer; protected final String xml; - protected final X io; + protected final XmlIoAbstractSpimData< ?, AS > io; protected final boolean isMac; protected boolean colorMode = false; - - final protected HashSet< List> > selectedRows; - protected BasicViewDescription< ? extends BasicViewSetup > firstSelectedVD; + final protected HashSet< List< BasicViewDescription< ? > > > selectedRows; + protected BasicViewDescription< ? > firstSelectedVD; - public FilteredAndGroupedExplorerPanel(final FilteredAndGroupedExplorer< AS, X > explorer, final AS data, - final String xml, final X io) + public FilteredAndGroupedExplorerPanel(final FilteredAndGroupedExplorer< AS > explorer, final AS data, + final String xml, final XmlIoAbstractSpimData< ?, AS > io) { - - - + + + this.explorer = explorer; - this.listeners = new ArrayList< SelectedViewDescriptionListener< AS > >(); + this.listeners = new ArrayList<>(); this.data = data; // normalize the xml path @@ -119,9 +120,9 @@ public FilteredAndGroupedExplorerPanel(final FilteredAndGroupedExplorer< AS, X > this.selectedRows = new HashSet<>(); this.firstSelectedVD = null; - + popups = initPopups(); - + // for access to the current BDV currentInstance = this; } @@ -130,8 +131,8 @@ public FilteredAndGroupedExplorerPanel(final FilteredAndGroupedExplorer< AS, X > public BDVPopup bdvPopup() { for ( final ExplorerWindowSetable s : popups ) - if ( BDVPopup.class.isInstance( s ) ) - return ( (BDVPopup) s ); + if ( s instanceof BDVPopup ) + return ( BDVPopup ) s; return null; } @@ -143,7 +144,7 @@ public boolean colorMode() } @Override - public BasicViewDescription< ? extends BasicViewSetup > firstSelectedVD() + public BasicViewDescription< ? > firstSelectedVD() { return firstSelectedVD; } @@ -165,20 +166,20 @@ public String xml() return xml; } - public X io() + public XmlIoAbstractSpimData< ?, AS > io() { return io; } - public FilteredAndGroupedExplorer< AS, X > explorer() + public FilteredAndGroupedExplorer< AS > explorer() { return explorer; } - @SuppressWarnings("unchecked") - public void setSpimData(final Object data) + @SuppressWarnings( "unchecked" ) + public void setSpimData( final Object data ) { - this.data = (AS) data; + this.data = ( AS ) data; this.getTableModel().updateElements(); } @@ -191,11 +192,11 @@ public void updateContent() } @Override - public List< BasicViewDescription< ? extends BasicViewSetup > > selectedRows() + public List< BasicViewDescription< ? > > selectedRows() { // TODO: this will break the grouping of selected Views -> change interface??? - final ArrayList< BasicViewDescription< ? extends BasicViewSetup > > list = new ArrayList< BasicViewDescription< ? extends BasicViewSetup > >(); - for (List> vds : selectedRows) + final ArrayList< BasicViewDescription< ? > > list = new ArrayList<>(); + for ( List< BasicViewDescription< ? > > vds : selectedRows ) list.addAll( vds ); Collections.sort( list ); return list; @@ -205,13 +206,9 @@ public void updateContent() public List< ViewId > selectedRowsViewId() { // TODO: adding Grouped Views here, not all selected ViewIds individually - final ArrayList< ViewId > list = new ArrayList< ViewId >(); - for (List> vds : selectedRows) - { - ArrayList< ViewId > vids = new ArrayList<>(); - vids.addAll( vds ); - list.add( new GroupedViews( vids )); - } + final ArrayList< ViewId > list = new ArrayList<>(); + for ( List< BasicViewDescription< ? > > vds : selectedRows ) + list.add( new GroupedViews( new ArrayList<>( vds ) ) ); Collections.sort( list ); return list; } @@ -220,10 +217,7 @@ public void addListener(final SelectedViewDescriptionListener< AS > listener) { this.listeners.add( listener ); - List>> selectedList = new ArrayList<>(); - for (List> selectedI : selectedRows) - selectedList.add( selectedI ); - + final List< List< BasicViewDescription< ? > > > selectedList = new ArrayList<>( selectedRows ); listener.selectedViewDescriptions( selectedList ); } @@ -233,48 +227,43 @@ public ArrayList< SelectedViewDescriptionListener< AS > > getListeners() } public abstract void initComponent(); - - public void updateFilter(Class entityClass, Entity selectedInstance) + + public void updateFilter( Class< ? extends Entity > entityClass, Entity selectedInstance ) { - ArrayList selectedInstances = new ArrayList<>(); + ArrayList< Entity > selectedInstances = new ArrayList<>(); selectedInstances.add( selectedInstance ); - tableModel.addFilter( entityClass, selectedInstances ); + tableModel.addFilter( entityClass, selectedInstances ); } - - protected static List getEntityNamesOrIds(List entities) + + protected static List< String > getEntityNamesOrIds( List< ? extends Entity > entities ) { - ArrayList names = new ArrayList<>(); - - for (Entity e : entities) - names.add( NamedEntity.class.isInstance( e ) ? ((NamedEntity)e).getName() : Integer.toString( e.getId())); - + ArrayList< String > names = new ArrayList<>(); + + for ( Entity e : entities ) + names.add( e instanceof NamedEntity ? ( ( NamedEntity ) e ).getName() : Integer.toString( e.getId() ) ); + return names; } - - public static Entity getInstanceFromNameOrId(AbstractSequenceDescription sd, Class entityClass, String nameOrId) + + public static Entity getInstanceFromNameOrId( AbstractSequenceDescription< ?, ?, ? > sd, Class< ? extends Entity > entityClass, String nameOrId ) { - for (Entity e : SpimDataTools.getInstancesOfAttribute( sd, entityClass )) - if (NamedEntity.class.isInstance( e ) && ((NamedEntity)e).getName().equals( nameOrId ) || Integer.toString( e.getId()).equals( nameOrId )) + for ( Entity e : SpimDataTools.getInstancesOfAttribute( sd, entityClass ) ) + if ( e instanceof NamedEntity && ( ( NamedEntity ) e ).getName().equals( nameOrId ) || Integer.toString( e.getId() ).equals( nameOrId ) ) return e; return null; } protected void addHelp() { - table.addKeyListener( new KeyListener() + table.addKeyListener( new KeyAdapter() + { + @Override + public void keyPressed( KeyEvent e ) { - public void keyTyped( KeyEvent e ) {} - - @Override - public void keyReleased( KeyEvent e ) {} - - @Override - public void keyPressed( KeyEvent e ) - { - if ( e.getKeyCode() == 112 ) - new HelpDialog( explorer().getFrame(), this.getClass().getResource( getHelpHtml() ) ).setVisible( true ); - } - } ); + if ( e.getKeyCode() == 112 ) + new HelpDialog( explorer().getFrame(), this.getClass().getResource( getHelpHtml() ) ).setVisible( true ); + } + } ); } protected abstract String getHelpHtml(); @@ -299,14 +288,15 @@ public void valueChanged(final ListSelectionEvent arg0) selectedRows.add( tableModel.getElements().get( row ) ); } - - List>> selectedList = new ArrayList<>(); - for (List> selectedI : selectedRows) + + + List>> selectedList = new ArrayList<>(); + for (List> selectedI : selectedRows) selectedList.add( selectedI ); - + for ( int i = 0; i < listeners.size(); ++i ) listeners.get( i ).selectedViewDescriptions( selectedList ); - + /* if ( table.getSelectedRowCount() != 1 ) { @@ -354,48 +344,53 @@ public void valueChanged(final ListSelectionEvent arg0) */ if ( b != null && b.bdv != null ) - { + { updateBDV( b.bdv, colorMode, data, firstSelectedVD, selectedRows); - + } - - + + } - + }; } - - - - public static void resetBDVManualTransformations(BigDataViewer bdv) + public static void resetBDVManualTransformations( BigDataViewer bdv ) { if ( bdv == null ) return; - + // reset manual transform for all views - for (int sourceIdx = 0; sourceIdx s = bdv.getViewer().getVisibilityAndGrouping().getSources().get( sourceIdx ); - ((TransformedSource< ? >)s.getSpimSource()).setFixedTransform( new AffineTransform3D() ); - ((TransformedSource< ? >)s.getSpimSource()).setIncrementalTransform( new AffineTransform3D() ); + BDVUtils.forEachTransformedSource( + state.getSources(), + ( soc, source ) -> { + source.setFixedTransform( identity ); + source.setIncrementalTransform( identity ); + } ); } } - - public static void updateBDV(final BigDataViewer bdv, final boolean colorMode, final AbstractSpimData< ? > data, - BasicViewDescription< ? extends BasicViewSetup > firstVD, - final Collection< List< BasicViewDescription< ? extends BasicViewSetup >> > selectedRows) + + public static void updateBDV( + final BigDataViewer bdv, + final boolean colorMode, + final AbstractSpimData< ? > data, + BasicViewDescription< ? > firstVD, + final Collection< List< BasicViewDescription< ? > > > selectedRows ) { - + // bdv is not open if ( bdv == null ) return; - + // we always set the fused mode - //setFusedModeSimple( bdv, data ); - - //resetBDVManualTransformations( bdv ); + setFusedModeSimple( bdv, data ); + + resetBDVManualTransformations( bdv ); if ( selectedRows == null || selectedRows.size() == 0 ) return; @@ -403,73 +398,73 @@ public static void updateBDV(final BigDataViewer bdv, final boolean colorMode, f if ( firstVD == null ) firstVD = selectedRows.iterator().next().get( 0 ); + final ViewerState state = bdv.getViewer().state(); + // always use the first timepoint final TimePoint firstTP = firstVD.getTimePoint(); - if ( bdv.getViewer().getState().getCurrentTimepoint() != getBDVTimePointIndex( firstTP, data ) ) - bdv.getViewer().setTimepoint( getBDVTimePointIndex( firstTP, data ) ); + state.setCurrentTimepoint( getBDVTimePointIndex( firstTP, data ) ); - final boolean[] active = new boolean[data.getSequenceDescription().getViewSetupsOrdered().size()]; + final Set< Integer > selectedViewSetupIds = selectedRows.stream() + .flatMap( Collection::stream ) + .filter( vd -> vd.getTimePointId() == firstTP.getId() ) + .map( ViewId::getViewSetupId ) + .collect( Collectors.toSet() ); - for ( final List< ? extends BasicViewDescription< ? extends BasicViewSetup > > vds : selectedRows ) - for ( BasicViewDescription< ? > vd : vds){ - if ( vd.getTimePointId() == firstTP.getId() ) - active[getBDVSourceIndex( vd.getViewSetup(), data )] = true; - } + final List< SourceAndConverter< ? > > active = new ArrayList<>(); + synchronized ( state ) + { + BDVUtils.forEachAbstractSpimSource( + state.getSources(), + ( soc, source ) -> { + if ( selectedViewSetupIds.contains( source.getSetupId() ) ) + active.add( soc ); + } ); + } + setVisibleSources( state, active ); // if ( selectedRows.size() > 1 && colorMode ) // colorSources( bdv.getSetupAssignments().getConverterSetups(), data, channelColors); // else // whiteSources( bdv.getSetupAssignments().getConverterSetups() ); - setVisibleSources( bdv.getViewer().getVisibilityAndGrouping(), active ); bdv.getViewer().requestRepaint(); } - public static void setFusedModeSimple(final BigDataViewer bdv, final AbstractSpimData< ? > data) + public static void setFusedModeSimple( final BigDataViewer bdv, final AbstractSpimData< ? > data ) { if ( bdv == null ) return; - - - if ( bdv.getViewer().getVisibilityAndGrouping().getDisplayMode() != DisplayMode.FUSED ) + final ViewerState state = bdv.getViewer().state(); + if ( state.getDisplayMode() != DisplayMode.FUSED ) { - final boolean[] active = new boolean[data.getSequenceDescription().getViewSetupsOrdered().size()]; - active[0] = true; - setVisibleSources( bdv.getViewer().getVisibilityAndGrouping(), active ); - bdv.getViewer().getVisibilityAndGrouping().setDisplayMode( DisplayMode.FUSED ); - } - } - - public static void colorSources(final List< ConverterSetup > cs, AbstractSpimData< ? > data, Map channelColors) - { - for ( int i = 0; i < cs.size(); ++i ) - { - Channel ch = data.getSequenceDescription().getViewSetups().get(cs.get( i ).getSetupId()).getAttribute( Channel.class ); - cs.get( i ).setColor( channelColors.get( ch ) ); + setVisibleSources( state, state.getSources().subList( 0, 0 ) ); + state.setDisplayMode( DisplayMode.FUSED ); } } - public static void whiteSources(final List< ConverterSetup > cs) + // TODO (TP) This has duplicates in StitchingExplorerPanel and ViewSetupExplorerPanel + // Move to common utility class? + 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, 255 ) ) ); + sameColorSources( cs, 255, 255, 255, 255 ); } - public static void sameColorSources(final List< ConverterSetup > cs, final int r, final int g, final int b, final int a) + public static void sameColorSources( final List< ConverterSetup > cs, final int r, final int g, final int b, final int a ) { - for ( int i = 0; i < cs.size(); ++i ) - cs.get( i ).setColor( new ARGBType( ARGBType.rgba( r, g, b, a ) ) ); + final ARGBType color = new ARGBType( ARGBType.rgba( r, g, b, a ) ); + cs.forEach( c -> c.setColor( color ) ); } - public static void setVisibleSources(final VisibilityAndGrouping vag, final boolean[] active) + public static void setVisibleSources( final ViewerState state, final Collection< ? extends SourceAndConverter< ? > > active ) { - for ( int i = 0; i < active.length; ++i ) - vag.setSourceActive( i, active[i] ); - + final List< SourceAndConverter< ? > > inactive = new ArrayList<>( state.getSources() ); + inactive.removeAll( active ); + state.setSourcesActive( inactive, false ); + state.setSourcesActive( active, true ); } - public static int getBDVTimePointIndex(final TimePoint t, final AbstractSpimData< ? > data) + public static int getBDVTimePointIndex( final TimePoint t, final AbstractSpimData< ? > data ) { final List< TimePoint > list = data.getSequenceDescription().getTimePoints().getTimePointsOrdered(); @@ -480,7 +475,7 @@ public static int getBDVTimePointIndex(final TimePoint t, final AbstractSpimData return 0; } - public static int getBDVSourceIndex(final BasicViewSetup vs, final AbstractSpimData< ? > data) + public static int getBDVSourceIndex( final BasicViewSetup vs, final AbstractSpimData< ? > data ) { final List< ? extends BasicViewSetup > list = data.getSequenceDescription().getViewSetupsOrdered(); @@ -491,14 +486,14 @@ public static int getBDVSourceIndex(final BasicViewSetup vs, final AbstractSpimD return 0; } - public HashSet< List >> getSelectedRows() + public Set< List< BasicViewDescription< ? > > > getSelectedRows() { return selectedRows; } public void showInfoBox() { - new ViewSetupExplorerInfoBox< AS >( data, xml ); + new ViewSetupExplorerInfoBox<>( data, xml ); } @Override @@ -511,9 +506,9 @@ public void saveXML() for ( final SelectedViewDescriptionListener< AS > l : listeners ) l.save(); - if ( SpimData2.class.isInstance( data ) ) + if ( data instanceof SpimData2 ) { - final ViewInterestPoints vip = ( (SpimData2) data ).getViewInterestPoints(); + final ViewInterestPoints vip = ( ( SpimData2 ) data ).getViewInterestPoints(); for ( final ViewInterestPointLists vipl : vip.getViewInterestPoints().values() ) { @@ -535,7 +530,7 @@ public void saveXML() } } - protected void addPopupMenu(final JTable table) + protected void addPopupMenu( final JTable table ) { final JPopupMenu popupMenu = new JPopupMenu(); @@ -547,10 +542,10 @@ protected void addPopupMenu(final JTable table) protected void addColorMode() { - table.addKeyListener( new KeyListener() + table.addKeyListener( new KeyAdapter() { @Override - public void keyPressed(final KeyEvent arg0) + public void keyPressed( final KeyEvent arg0 ) { if ( arg0.getKeyChar() == 'c' || arg0.getKeyChar() == 'C' ) { @@ -560,28 +555,18 @@ public void keyPressed(final KeyEvent arg0) final BDVPopup p = bdvPopup(); if ( p != null && p.bdv != null && p.bdv.getViewerFrame().isVisible() ) - updateBDV( p.bdv, colorMode, data, null, selectedRows); + updateBDV( p.bdv, colorMode, data, null, selectedRows ); } } - - @Override - public void keyReleased(final KeyEvent arg0) - { - } - - @Override - public void keyTyped(final KeyEvent arg0) - { - } } ); } protected void addReCenterShortcut() { - table.addKeyListener( new KeyListener() + table.addKeyListener( new KeyAdapter() { @Override - public void keyPressed(final KeyEvent arg0) + public void keyPressed( final KeyEvent arg0 ) { if ( arg0.getKeyChar() == 'r' || arg0.getKeyChar() == 'R' ) { @@ -589,18 +574,13 @@ public void keyPressed(final KeyEvent arg0) if ( p != null && p.bdv != null && p.bdv.getViewerFrame().isVisible() ) { TransformationTools.reCenterViews( p.bdv, - selectedRows.stream().collect( + selectedRows.stream().collect( HashSet< BasicViewDescription< ? > >::new, - (a, b) -> a.addAll( b ), (a, b) -> a.addAll( b ) ), - data.getViewRegistrations() ); + ( a, b ) -> a.addAll( b ), ( a, b ) -> a.addAll( b ) ), + data.getViewRegistrations() ); } } } - - @Override - public void keyReleased(final KeyEvent arg0){} - @Override - public void keyTyped(final KeyEvent arg0){} } ); } @@ -611,21 +591,21 @@ protected void addAppleA() boolean appleKeyDown = false; @Override - public void keyTyped(KeyEvent arg0) + public void keyTyped( KeyEvent arg0 ) { if ( appleKeyDown && arg0.getKeyChar() == 'a' ) table.selectAll(); } @Override - public void keyReleased(KeyEvent arg0) + public void keyReleased( KeyEvent arg0 ) { if ( arg0.getKeyCode() == 157 ) appleKeyDown = false; } @Override - public void keyPressed(KeyEvent arg0) + public void keyPressed( KeyEvent arg0 ) { if ( arg0.getKeyCode() == 157 ) appleKeyDown = true; @@ -637,17 +617,17 @@ public void keyPressed(KeyEvent arg0) protected void addScreenshot() { - table.addKeyListener( new KeyListener() + table.addKeyListener( new KeyAdapter() { @Override - public void keyPressed(final KeyEvent arg0) + public void keyPressed( final KeyEvent arg0 ) { if ( arg0.getKeyChar() == 'E' ) { enableFlyThrough = true; IOFunctions.println( "EASTER EGG activated." ); - IOFunctions.println( "You can now record a fly-through: "); + IOFunctions.println( "You can now record a fly-through: " ); IOFunctions.println( " press 'a' to add the current view as keypoint" ); IOFunctions.println( " press 'x' to remove all keypoints" ); IOFunctions.println( " press 'd' to remove last keypoint" ); @@ -672,13 +652,13 @@ public void run() } ).start(); else IOFunctions.println("Please open BigDataViewer to record a fly-through or add keypoints."); - + if ( arg0.getKeyChar() == 'a' ) if (bdvRunning) BDVFlyThrough.addCurrentViewerTransform( bdvPopup().bdv.getViewer() ); else IOFunctions.println("Please open BigDataViewer to record a fly-through or add keypoints."); - + if ( arg0.getKeyChar() == 'x' ) BDVFlyThrough.clearAllViewerTransform(); @@ -688,39 +668,26 @@ public void run() if ( arg0.getKeyChar() == 'j' ) BDVFlyThrough.jumpToLastViewerTransform( bdvPopup().bdv.getViewer() ); - if ( arg0.getKeyChar() == 's' ) { + if ( arg0.getKeyChar() == 's' ) try { BDVFlyThrough.saveViewerTransforms(); } catch ( Exception e ) { IOFunctions.println( "couldn't save json: " + e ); } - } - if ( arg0.getKeyChar() == 'l' ){ + if ( arg0.getKeyChar() == 'l' ) try { BDVFlyThrough.loadViewerTransforms(); } catch ( Exception e ) { IOFunctions.println( "couldn't load json: " + e ); } - } if ( arg0.getKeyChar() == 'R' ) - if (bdvRunning) - new Thread( new Runnable() - { - @Override - public void run() - { BDVFlyThrough.renderScreenshot( bdvPopup().bdv.getViewer() ); } - } ).start(); + if ( bdvRunning ) + new Thread( () -> BDVFlyThrough.renderScreenshot( bdvPopup().bdv.getViewer() ) ).start(); else - IOFunctions.println("Please open BigDataViewer to make a screenshot."); + IOFunctions.println( "Please open BigDataViewer to make a screenshot." ); } } - - @Override - public void keyReleased(final KeyEvent arg0) {} - - @Override - public void keyTyped(final KeyEvent arg0){} } ); } public abstract ArrayList< ExplorerWindowSetable > initPopups(); @Override - public Collection< List< BasicViewDescription< ? extends BasicViewSetup > > > selectedRowsGroups() + public Collection< List< BasicViewDescription< ? > > > selectedRowsGroups() { return selectedRows; } @@ -728,13 +695,9 @@ public void keyTyped(final KeyEvent arg0){} @Override public List< List< ViewId > > selectedRowsViewIdGroups() { - final ArrayList< List> list = new ArrayList<>(); - for (List> vds : selectedRows) - { - ArrayList< ViewId > vids = new ArrayList<>(); - vids.addAll( vds ); - list.add( vids); - } + final ArrayList< List< ViewId > > list = new ArrayList<>(); + for ( List< BasicViewDescription< ? > > vds : selectedRows ) + list.add( new ArrayList<>( vds ) ); //Collections.sort( list ); return list; } diff --git a/src/main/java/net/preibisch/mvrecon/fiji/spimdata/explorer/FilteredAndGroupedTableModel.java b/src/main/java/net/preibisch/mvrecon/fiji/spimdata/explorer/FilteredAndGroupedTableModel.java index 7177c5ce8..86543af1b 100644 --- a/src/main/java/net/preibisch/mvrecon/fiji/spimdata/explorer/FilteredAndGroupedTableModel.java +++ b/src/main/java/net/preibisch/mvrecon/fiji/spimdata/explorer/FilteredAndGroupedTableModel.java @@ -57,8 +57,8 @@ public class FilteredAndGroupedTableModel < AS extends AbstractSpimData< ? > > e private static final long serialVersionUID = -6526338840427674269L; protected List< List< BasicViewDescription< ? > >> elements = null; - - final ExplorerWindow< AS, ? > panel; + + final ExplorerWindow< AS > panel; Set> groupingFactors; Map, List> filters; List> columnClasses; @@ -68,7 +68,7 @@ public class FilteredAndGroupedTableModel < AS extends AbstractSpimData< ? > > e * @see gui.ISpimDataTableModel#getPanel() */ @Override - public ExplorerWindow< AS, ? > getPanel() { + public ExplorerWindow< AS > getPanel() { return panel; } @@ -155,7 +155,7 @@ public static ArrayList> defaultColumnClassesMV() return res; } - public FilteredAndGroupedTableModel( final ExplorerWindow< AS, ? > panel ) + public FilteredAndGroupedTableModel( final ExplorerWindow< AS > panel ) { groupingFactors = new HashSet<>(); filters = new HashMap<>(); @@ -170,12 +170,12 @@ public FilteredAndGroupedTableModel( final ExplorerWindow< AS, ? > panel ) elements(); } - protected List >> elements() + protected List >> elements() { return elements(false); } - protected List >> elements( boolean forceUpdate ) + protected List >> elements( boolean forceUpdate ) { if (!forceUpdate && elements != null) return elements; @@ -235,12 +235,12 @@ public boolean isCellEditable( final int row, final int column ) @Override public Object getValueAt( final int row, final int column ) { - final List> vds = elements().get( row ); + final List> vds = elements().get( row ); Class c = columnClasses.get(column); final HashSet entries = new HashSet<>(); - - for (BasicViewDescription< ? extends BasicViewSetup > vd : vds) + + for (BasicViewDescription< ? > vd : vds) { if ( c == TimePoint.class ) entries.add(vd.getTimePoint()); diff --git a/src/main/java/net/preibisch/mvrecon/fiji/spimdata/explorer/GroupedRowWindow.java b/src/main/java/net/preibisch/mvrecon/fiji/spimdata/explorer/GroupedRowWindow.java index 7f9de18d5..d1350f158 100644 --- a/src/main/java/net/preibisch/mvrecon/fiji/spimdata/explorer/GroupedRowWindow.java +++ b/src/main/java/net/preibisch/mvrecon/fiji/spimdata/explorer/GroupedRowWindow.java @@ -31,6 +31,6 @@ public interface GroupedRowWindow { - public Collection >> selectedRowsGroups(); + public Collection< List< BasicViewDescription< ? > > > selectedRowsGroups(); public List> selectedRowsViewIdGroups(); } diff --git a/src/main/java/net/preibisch/mvrecon/fiji/spimdata/explorer/ISpimDataTableModel.java b/src/main/java/net/preibisch/mvrecon/fiji/spimdata/explorer/ISpimDataTableModel.java index 205bae6c5..1961958b1 100644 --- a/src/main/java/net/preibisch/mvrecon/fiji/spimdata/explorer/ISpimDataTableModel.java +++ b/src/main/java/net/preibisch/mvrecon/fiji/spimdata/explorer/ISpimDataTableModel.java @@ -42,9 +42,9 @@ public enum SpecialColumnType{ } public int getSpecialColumn(SpecialColumnType type); - - public ExplorerWindow< AS, ? > getPanel(); - + + public ExplorerWindow< AS > getPanel(); + public Set> getGroupingFactors(); public void clearSortingFactors(); @@ -61,7 +61,7 @@ public enum SpecialColumnType{ public Map , List> getFilters(); - public List> > getElements(); + public List< List< BasicViewDescription< ? > > > getElements(); public void updateElements(); diff --git a/src/main/java/net/preibisch/mvrecon/fiji/spimdata/explorer/MissingViewsTableModelDecorator.java b/src/main/java/net/preibisch/mvrecon/fiji/spimdata/explorer/MissingViewsTableModelDecorator.java index 98584a621..e5a00ab81 100644 --- a/src/main/java/net/preibisch/mvrecon/fiji/spimdata/explorer/MissingViewsTableModelDecorator.java +++ b/src/main/java/net/preibisch/mvrecon/fiji/spimdata/explorer/MissingViewsTableModelDecorator.java @@ -117,7 +117,7 @@ public int getSpecialColumn(net.preibisch.mvrecon.fiji.spimdata.explorer.ISpimDa } @Override - public ExplorerWindow< AS, ? > getPanel() + public ExplorerWindow< AS > getPanel() { return decorated.getPanel(); } diff --git a/src/main/java/net/preibisch/mvrecon/fiji/spimdata/explorer/MultiViewTableModelDecorator.java b/src/main/java/net/preibisch/mvrecon/fiji/spimdata/explorer/MultiViewTableModelDecorator.java index 4ff169e3c..d1d07e7cd 100644 --- a/src/main/java/net/preibisch/mvrecon/fiji/spimdata/explorer/MultiViewTableModelDecorator.java +++ b/src/main/java/net/preibisch/mvrecon/fiji/spimdata/explorer/MultiViewTableModelDecorator.java @@ -124,7 +124,7 @@ public Object getValueAt(int rowIndex, int columnIndex) { if ( vds.size() == 1 ) { - final BasicViewDescription< ? extends BasicViewSetup > vd = vds.get( 0 ); + final BasicViewDescription< ? > vd = vds.get( 0 ); if ( vd.isPresent() ) { @@ -244,7 +244,7 @@ public void sortByColumn(int column) { } @Override - public ExplorerWindow getPanel() { return decorated.getPanel(); } + public ExplorerWindow getPanel() { return decorated.getPanel(); } @Override public void setValueAt(Object aValue, int rowIndex, int columnIndex) diff --git a/src/main/java/net/preibisch/mvrecon/fiji/spimdata/explorer/SelectedViewDescriptionListener.java b/src/main/java/net/preibisch/mvrecon/fiji/spimdata/explorer/SelectedViewDescriptionListener.java index f26043b5b..fffd00801 100644 --- a/src/main/java/net/preibisch/mvrecon/fiji/spimdata/explorer/SelectedViewDescriptionListener.java +++ b/src/main/java/net/preibisch/mvrecon/fiji/spimdata/explorer/SelectedViewDescriptionListener.java @@ -30,7 +30,7 @@ public interface SelectedViewDescriptionListener< AS extends AbstractSpimData< ? > > { //public void firstSelectedViewDescriptions( List< BasicViewDescription< ? extends BasicViewSetup > > viewDescriptions ); - public void selectedViewDescriptions( List< List< BasicViewDescription< ? extends BasicViewSetup > > > viewDescriptions ); + public void selectedViewDescriptions( List< List< BasicViewDescription< ? > > > viewDescriptions ); public void updateContent( final AS data ); public void save(); public void quit(); diff --git a/src/main/java/net/preibisch/mvrecon/fiji/spimdata/explorer/ViewSetupExplorer.java b/src/main/java/net/preibisch/mvrecon/fiji/spimdata/explorer/ViewSetupExplorer.java index b47734a56..8369fe8c7 100644 --- a/src/main/java/net/preibisch/mvrecon/fiji/spimdata/explorer/ViewSetupExplorer.java +++ b/src/main/java/net/preibisch/mvrecon/fiji/spimdata/explorer/ViewSetupExplorer.java @@ -34,17 +34,17 @@ import mpicbg.spim.data.generic.AbstractSpimData; import mpicbg.spim.data.generic.XmlIoAbstractSpimData; -public class ViewSetupExplorer< AS extends AbstractSpimData< ? >, X extends XmlIoAbstractSpimData< ?, AS > > extends FilteredAndGroupedExplorer< AS, X > +public class ViewSetupExplorer< AS extends AbstractSpimData< ? > > extends FilteredAndGroupedExplorer< AS > { public static final double xPos = 0.4; public static final double yPos = 0.4; public static final double xPosLog = 0.0; public static final double yPosLog = 0.8; - public ViewSetupExplorer( final AS data, final String xml, final X io ) + public ViewSetupExplorer( final AS data, final String xml, final XmlIoAbstractSpimData< ?, AS > io ) { frame = new JFrame( "ViewSetup Explorer" ); - panel = new ViewSetupExplorerPanel< AS, X >( this, data, xml, io, true ); + panel = new ViewSetupExplorerPanel< AS >( this, data, xml, io, true ); frame.add( panel, BorderLayout.CENTER ); frame.setSize( panel.getPreferredSize() ); diff --git a/src/main/java/net/preibisch/mvrecon/fiji/spimdata/explorer/ViewSetupExplorerPanel.java b/src/main/java/net/preibisch/mvrecon/fiji/spimdata/explorer/ViewSetupExplorerPanel.java index c6c3d6714..e959dc220 100644 --- a/src/main/java/net/preibisch/mvrecon/fiji/spimdata/explorer/ViewSetupExplorerPanel.java +++ b/src/main/java/net/preibisch/mvrecon/fiji/spimdata/explorer/ViewSetupExplorerPanel.java @@ -111,7 +111,7 @@ import net.preibisch.mvrecon.process.interestpointregistration.pairwise.constellation.grouping.Group; -public class ViewSetupExplorerPanel< AS extends AbstractSpimData< ? >, X extends XmlIoAbstractSpimData< ?, AS > > extends FilteredAndGroupedExplorerPanel< AS, X > implements ExplorerWindow< AS, X > +public class ViewSetupExplorerPanel< AS extends AbstractSpimData< ? > > extends FilteredAndGroupedExplorerPanel< AS > implements ExplorerWindow< AS > { private static final long serialVersionUID = -2512096359830259015L; @@ -145,7 +145,7 @@ public boolean illumsGrouped() @Override public boolean channelsGrouped() { return false; } - public ViewSetupExplorerPanel( final FilteredAndGroupedExplorer< AS, X > explorer, final AS data, final String xml, final X io, boolean requestStartBDV ) + public ViewSetupExplorerPanel( final FilteredAndGroupedExplorer< AS > explorer, final AS data, final String xml, final XmlIoAbstractSpimData< ?, AS > io, boolean requestStartBDV ) { super( explorer, data, xml, io ); @@ -344,9 +344,9 @@ public void valueChanged(final ListSelectionEvent arg0) selectedRows.add( tableModel.getElements().get( row ) ); } - - List>> selectedList = new ArrayList<>(); - for (List> selectedI : selectedRows) + + List>> selectedList = new ArrayList<>(); + for (List> selectedI : selectedRows) selectedList.add( selectedI ); for ( int i = 0; i < listeners.size(); ++i ) @@ -415,8 +415,8 @@ public void valueChanged(final ListSelectionEvent arg0) } public static void updateBDV(final BigDataViewer bdv, final boolean colorMode, final AbstractSpimData< ? > data, - BasicViewDescription< ? extends BasicViewSetup > firstVD, - final Collection< List< BasicViewDescription< ? extends BasicViewSetup >> > selectedRows) + BasicViewDescription< ? > firstVD, + final Collection< List< BasicViewDescription< ? >> > selectedRows) { // we always set the fused mode setFusedModeSimple( bdv, data ); diff --git a/src/main/java/net/preibisch/mvrecon/fiji/spimdata/explorer/bdv/BDVUtils.java b/src/main/java/net/preibisch/mvrecon/fiji/spimdata/explorer/bdv/BDVUtils.java new file mode 100644 index 000000000..a9d61dc8c --- /dev/null +++ b/src/main/java/net/preibisch/mvrecon/fiji/spimdata/explorer/bdv/BDVUtils.java @@ -0,0 +1,40 @@ +package net.preibisch.mvrecon.fiji.spimdata.explorer.bdv; + +import bdv.AbstractSpimSource; +import bdv.tools.transformation.TransformedSource; +import bdv.viewer.Source; +import bdv.viewer.SourceAndConverter; +import java.util.Collection; +import java.util.function.BiConsumer; + +public class BDVUtils +{ + public static void forEachAbstractSpimSource( + final Collection< ? extends SourceAndConverter< ? > > sources, + final BiConsumer< ? super SourceAndConverter< ? >, ? super AbstractSpimSource< ? > > action ) + { + for ( final SourceAndConverter< ? > soc : sources ) + { + Source< ? > source = soc.getSpimSource(); + + if ( source instanceof TransformedSource ) + source = ( ( TransformedSource< ? > ) source ).getWrappedSource(); + + if ( source instanceof AbstractSpimSource ) + action.accept( soc, ( AbstractSpimSource< ? > ) source ); + } + } + + public static void forEachTransformedSource( + final Collection< ? extends SourceAndConverter< ? > > sources, + final BiConsumer< ? super SourceAndConverter< ? >, ? super TransformedSource< ? > > action ) + { + for ( final SourceAndConverter< ? > soc : sources ) + { + Source< ? > source = soc.getSpimSource(); + + if ( source instanceof TransformedSource ) + action.accept( soc, ( TransformedSource< ? > ) source ); + } + } +} diff --git a/src/main/java/net/preibisch/mvrecon/fiji/spimdata/explorer/interestpoint/InterestPointExplorer.java b/src/main/java/net/preibisch/mvrecon/fiji/spimdata/explorer/interestpoint/InterestPointExplorer.java index ad903fc2f..f8481e8d7 100644 --- a/src/main/java/net/preibisch/mvrecon/fiji/spimdata/explorer/interestpoint/InterestPointExplorer.java +++ b/src/main/java/net/preibisch/mvrecon/fiji/spimdata/explorer/interestpoint/InterestPointExplorer.java @@ -46,15 +46,15 @@ import net.preibisch.mvrecon.fiji.spimdata.explorer.popup.BasicBDVPopup; import net.preibisch.mvrecon.fiji.spimdata.interestpoints.InterestPoints; -public class InterestPointExplorer< AS extends SpimData2, X extends XmlIoAbstractSpimData< ?, AS > > +public class InterestPointExplorer< AS extends SpimData2 > implements SelectedViewDescriptionListener< AS > { final String xml; final JFrame frame; final InterestPointExplorerPanel panel; - final FilteredAndGroupedExplorer< AS, X > viewSetupExplorer; + final FilteredAndGroupedExplorer< AS > viewSetupExplorer; - public InterestPointExplorer( final String xml, final X io, final FilteredAndGroupedExplorer< AS, X > viewSetupExplorer ) + public InterestPointExplorer( final String xml, final XmlIoAbstractSpimData< ?, AS > io, final FilteredAndGroupedExplorer< AS > viewSetupExplorer ) { this.xml = xml; this.viewSetupExplorer = viewSetupExplorer; @@ -91,12 +91,12 @@ public void windowClosing(WindowEvent e) public JFrame frame() { return frame; } @Override - public void selectedViewDescriptions( final List< List< BasicViewDescription< ? extends BasicViewSetup > > > viewDescriptions ) + public void selectedViewDescriptions( final List< List< BasicViewDescription< ? > > > viewDescriptions ) { - final ArrayList< BasicViewDescription< ? extends BasicViewSetup > > fullList = new ArrayList<>(); + final ArrayList< BasicViewDescription< ? > > fullList = new ArrayList<>(); - for ( final List< BasicViewDescription< ? extends BasicViewSetup > > list : viewDescriptions ) - for ( final BasicViewDescription< ? extends BasicViewSetup > vd : list ) + for ( final List< BasicViewDescription< ? > > list : viewDescriptions ) + for ( final BasicViewDescription< ? > vd : list ) if ( vd.isPresent() ) fullList.add( vd ); diff --git a/src/main/java/net/preibisch/mvrecon/fiji/spimdata/explorer/interestpoint/InterestPointExplorerPanel.java b/src/main/java/net/preibisch/mvrecon/fiji/spimdata/explorer/interestpoint/InterestPointExplorerPanel.java index 5f2252953..ebd8ba096 100644 --- a/src/main/java/net/preibisch/mvrecon/fiji/spimdata/explorer/interestpoint/InterestPointExplorerPanel.java +++ b/src/main/java/net/preibisch/mvrecon/fiji/spimdata/explorer/interestpoint/InterestPointExplorerPanel.java @@ -63,7 +63,7 @@ public class InterestPointExplorerPanel extends JPanel { private static final long serialVersionUID = -3767947754096099774L; - final FilteredAndGroupedExplorer< ?, ? > viewSetupExplorer; + final FilteredAndGroupedExplorer< ? > viewSetupExplorer; protected JTable table; protected InterestPointTableModel tableModel; @@ -73,7 +73,7 @@ public class InterestPointExplorerPanel extends JPanel //protected ArrayList< Pair< InterestPointList, ViewId > > save; protected ArrayList< Pair< InterestPoints, ViewId > > delete; - public InterestPointExplorerPanel( final ViewInterestPoints viewInterestPoints, final FilteredAndGroupedExplorer< ?, ? > viewSetupExplorer ) + public InterestPointExplorerPanel( final ViewInterestPoints viewInterestPoints, final FilteredAndGroupedExplorer< ? > viewSetupExplorer ) { //this.save = new ArrayList< Pair< InterestPointList, ViewId > >(); this.delete = new ArrayList< Pair< InterestPoints, ViewId > >(); @@ -84,12 +84,12 @@ public InterestPointExplorerPanel( final ViewInterestPoints viewInterestPoints, public InterestPointTableModel getTableModel() { return tableModel; } public JTable getTable() { return table; } - - public void updateViewDescription( final List< BasicViewDescription< ? extends BasicViewSetup > > viewDescriptionsUnfiltered ) + + public void updateViewDescription( final List< BasicViewDescription< ? > > viewDescriptionsUnfiltered ) { - final ArrayList< BasicViewDescription< ? extends BasicViewSetup > > viewDescriptions = new ArrayList<>(); + final ArrayList< BasicViewDescription< ? > > viewDescriptions = new ArrayList<>(); - for ( final BasicViewDescription< ? extends BasicViewSetup > vd : viewDescriptionsUnfiltered ) + for ( final BasicViewDescription< ? > vd : viewDescriptionsUnfiltered ) if ( vd.isPresent() ) viewDescriptions.add( vd ); diff --git a/src/main/java/net/preibisch/mvrecon/fiji/spimdata/explorer/popup/ApplyTransformationPopup.java b/src/main/java/net/preibisch/mvrecon/fiji/spimdata/explorer/popup/ApplyTransformationPopup.java index 4803b86ee..b11037837 100644 --- a/src/main/java/net/preibisch/mvrecon/fiji/spimdata/explorer/popup/ApplyTransformationPopup.java +++ b/src/main/java/net/preibisch/mvrecon/fiji/spimdata/explorer/popup/ApplyTransformationPopup.java @@ -39,8 +39,6 @@ import net.preibisch.mvrecon.fiji.spimdata.explorer.GroupedRowWindow; import mpicbg.spim.data.SpimData; -import mpicbg.spim.data.generic.AbstractSpimData; -import mpicbg.spim.data.generic.sequence.AbstractSequenceDescription; import mpicbg.spim.data.sequence.ViewDescription; import mpicbg.spim.data.sequence.ViewId; @@ -49,7 +47,7 @@ public class ApplyTransformationPopup extends JMenuItem implements ExplorerWindo private static final long serialVersionUID = 5234649267634013390L; public static boolean showWarning = true; - ExplorerWindow< ? extends AbstractSpimData< ? extends AbstractSequenceDescription< ?, ?, ? > >, ? > panel; + ExplorerWindow< ? > panel; public ApplyTransformationPopup() { @@ -59,20 +57,20 @@ public ApplyTransformationPopup() } @Override - public JMenuItem setExplorerWindow( final ExplorerWindow< ? extends AbstractSpimData< ? extends AbstractSequenceDescription< ?, ?, ? > >, ? > panel ) + public JMenuItem setExplorerWindow( final ExplorerWindow< ? > panel ) { this.panel = panel; return this; } - public static final List< ViewId > getSelectedViews( - final ExplorerWindow< ? extends AbstractSpimData< ? extends AbstractSequenceDescription< ?, ?, ? > >, ? > panel) + public static final List< ViewId > getSelectedViews( final ExplorerWindow< ? > panel ) { return getSelectedViews( panel, true ); } + public static final List< ViewId > getSelectedViews( - final ExplorerWindow< ? extends AbstractSpimData< ? extends AbstractSequenceDescription< ?, ?, ? > >, ? > panel, - final boolean filterMissing) + final ExplorerWindow< ? > panel, + final boolean filterMissing ) { final List< ViewId > viewIds = new ArrayList<>(); if (GroupedRowWindow.class.isInstance( panel )) diff --git a/src/main/java/net/preibisch/mvrecon/fiji/spimdata/explorer/popup/BDVPopup.java b/src/main/java/net/preibisch/mvrecon/fiji/spimdata/explorer/popup/BDVPopup.java index 83219fc2f..5ecdffa8f 100644 --- a/src/main/java/net/preibisch/mvrecon/fiji/spimdata/explorer/popup/BDVPopup.java +++ b/src/main/java/net/preibisch/mvrecon/fiji/spimdata/explorer/popup/BDVPopup.java @@ -9,12 +9,12 @@ * it under the terms of the GNU General Public License as * published by the Free Software Foundation, either version 2 of the * License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public * License along with this program. If not, see * . @@ -22,12 +22,16 @@ */ package net.preibisch.mvrecon.fiji.spimdata.explorer.popup; +import bdv.tools.brightness.ConverterSetup; +import bdv.util.Bounds; +import bdv.viewer.ConverterSetups; +import bdv.viewer.SourceAndConverter; +import bdv.viewer.ViewerFrame; +import bdv.viewer.ViewerState; import java.awt.Dimension; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; -import java.lang.reflect.Field; -import java.lang.reflect.Method; -import java.util.List; +import java.util.Collection; import javax.swing.JMenuItem; import javax.swing.JOptionPane; @@ -35,14 +39,10 @@ import bdv.AbstractSpimSource; import bdv.BigDataViewer; import bdv.tools.InitializeViewerState; -import bdv.tools.brightness.MinMaxGroup; -import bdv.tools.brightness.SetupAssignments; import bdv.tools.transformation.TransformedSource; import bdv.viewer.Source; import bdv.viewer.ViewerOptions; import bdv.viewer.ViewerPanel; -import bdv.viewer.state.SourceState; -import bdv.viewer.state.ViewerState; import mpicbg.spim.data.generic.AbstractSpimData; import mpicbg.spim.data.registration.ViewRegistration; import net.imglib2.Interval; @@ -52,6 +52,9 @@ import net.imglib2.histogram.Real1dBinMapper; import net.imglib2.realtransform.AffineTransform3D; import net.imglib2.type.numeric.RealType; +import net.imglib2.type.numeric.integer.UnsignedByteType; +import net.imglib2.type.numeric.integer.UnsignedShortType; +import net.imglib2.util.Cast; import net.imglib2.util.LinAlgHelpers; import net.imglib2.view.Views; import net.preibisch.legacy.io.IOFunctions; @@ -67,7 +70,7 @@ public class BDVPopup extends JMenuItem implements ExplorerWindowSetable, BasicB { private static final long serialVersionUID = 5234649267634013390L; - public ExplorerWindow< ?, ? > panel; + public ExplorerWindow< ? > panel; public BigDataViewer bdv = null; public BDVPopup() @@ -78,12 +81,13 @@ public BDVPopup() } @Override - public JMenuItem setExplorerWindow( final ExplorerWindow< ?, ? > panel ) + public JMenuItem setExplorerWindow( final ExplorerWindow< ? > panel ) { this.panel = panel; return this; } + // TODO (TP): replace with method and method reference public class MyActionListener implements ActionListener { @Override @@ -95,6 +99,7 @@ public void actionPerformed( final ActionEvent e ) return; } + // TODO (TP): replace with lambda new Thread( new Runnable() { @Override @@ -144,53 +149,36 @@ public void updateBDV() if ( bdv == null ) return; - for ( final ViewRegistration r : panel.getSpimData().getViewRegistrations().getViewRegistrationsOrdered() ) - r.updateModel(); + final Collection< ViewRegistration > regs = panel.getSpimData().getViewRegistrations().getViewRegistrations().values(); + regs.forEach( ViewRegistration::updateModel ); - final ViewerPanel viewerPanel = bdv.getViewer(); - final ViewerState viewerState = viewerPanel.getState(); - final List< SourceState< ? > > sources = viewerState.getSources(); - - for ( final SourceState< ? > state : sources ) - { - Source< ? > source = state.getSpimSource(); - - while ( TransformedSource.class.isInstance( source ) ) - { - source = ( ( TransformedSource< ? > ) source ).getWrappedSource(); - } + final ViewerPanel viewer = bdv.getViewer(); - if ( AbstractSpimSource.class.isInstance( source ) ) - { - final AbstractSpimSource< ? > s = ( AbstractSpimSource< ? > ) source; - - final int tpi = getCurrentTimePointIndex( s ); - callLoadTimePoint( s, tpi ); -// forceBDVReload( s ); - } + final ViewerState state = viewer.state().snapshot(); + state.getSources().forEach( BDVPopup::reloadTransformFromViewRegistrations ); + viewer.requestRepaint(); + } - if ( state.asVolatile() != null ) - { - source = state.asVolatile().getSpimSource(); - while ( TransformedSource.class.isInstance( source ) ) - { - source = ( ( TransformedSource< ? > ) source ).getWrappedSource(); - } + /** + * Calls {@link AbstractSpimSource#reload} on volatile and non-volatile + * versions nested under {@code source}. This reloads transformations from + * modified {@code ViewRegistrations}. + */ + private static void reloadTransformFromViewRegistrations( final SourceAndConverter< ? > source ) + { + Source< ? > s = source.getSpimSource(); - if ( AbstractSpimSource.class.isInstance( source ) ) - { - final AbstractSpimSource< ? > s = ( AbstractSpimSource< ? > ) source; + if ( s instanceof TransformedSource ) + s = ( ( TransformedSource ) s ).getWrappedSource(); - final int tpi = getCurrentTimePointIndex( s ); - callLoadTimePoint( s, tpi ); -// forceBDVReload( s ); - } - } - } + if ( s instanceof AbstractSpimSource ) + ( ( AbstractSpimSource< ? > ) s ).reload(); - bdv.getViewer().requestRepaint(); + if ( source.asVolatile() != null ) + reloadTransformFromViewRegistrations( source.asVolatile() ); } + @Override public boolean bdvRunning() { @@ -198,74 +186,102 @@ public boolean bdvRunning() return ( p != null && p.getBDV() != null && p.getBDV().getViewerFrame().isVisible() ); } - + public void setBDV(BigDataViewer bdv) { // close existing bdv if necessary if (bdvRunning()) new Thread(() -> {closeBDV();}).start(); - + this.bdv = bdv; ViewSetupExplorerPanel.updateBDV( this.bdv, panel.colorMode(), panel.getSpimData(), panel.firstSelectedVD(), ((GroupedRowWindow)panel).selectedRowsGroups() ); } - + /** * set BDV brightness by sampling the mid z plane (and 1/4 and 3/4 if z is large enough ) * of the currently selected source (typically the first source) and getting quantiles from intensity histogram * (slightly modified version of InitializeViewerState.initBrightness) * - * @param cumulativeMinCutoff - quantile of min - * @param cumulativeMaxCutoff - quantile of max - * @param state - Bdv's ViewerSate - * @param setupAssignments - Bdv's View assignments - * @param - type extending RealType + * @param cumulativeMinCutoff + * fraction of pixels that are allowed to be saturated at the lower end of the range. + * @param cumulativeMaxCutoff + * fraction of pixels that are allowed to be saturated at the upper end of the range. + * @param viewerFrame + * the ViewerFrame containing ViewerState and ConverterSetups */ - public static > void initBrightness( final double cumulativeMinCutoff, final double cumulativeMaxCutoff, final ViewerState state, final SetupAssignments setupAssignments ) + public static void initBrightness( final double cumulativeMinCutoff, final double cumulativeMaxCutoff, final ViewerFrame viewerFrame ) { - final Source< ? > source = state.getSources().get( state.getCurrentSource() ).getSpimSource(); - final int timepoint = state.getCurrentTimepoint(); - if ( !source.isPresent( timepoint ) ) - return; - if ( !RealType.class.isInstance( source.getType() ) ) - return; - @SuppressWarnings( "unchecked" ) - final RandomAccessibleInterval< T > img = ( RandomAccessibleInterval< T > ) source.getSource( timepoint, source.getNumMipmapLevels() - 1 ); - final long z = ( img.min( 2 ) + img.max( 2 ) + 1 ) / 2; - - final int numBins = 6535; - final Histogram1d< T > histogram = new Histogram1d< T >( Views.iterable( Views.hyperSlice( img, 2, z ) ), new Real1dBinMapper< T >( 0, 65535, numBins, false ) ); + initBrightness( cumulativeMinCutoff, cumulativeMaxCutoff, viewerFrame.getViewerPanel().state().snapshot(), viewerFrame.getConverterSetups() ); + } - // sample some more planes if we have enough - if ( (img.max( 2 ) + 1 - img.min( 2 ) ) > 4 ) + private static void initBrightness( final double cumulativeMinCutoff, final double cumulativeMaxCutoff, final ViewerState state, final ConverterSetups converterSetups ) + { + final SourceAndConverter< ? > current = state.getCurrentSource(); + if ( current == null ) + return; + final Source< ? > source = current.getSpimSource(); + final int timepoint = state.getCurrentTimepoint(); + final Bounds bounds = estimateSourceRange( source, timepoint, cumulativeMinCutoff, cumulativeMaxCutoff ); + for ( final SourceAndConverter< ? > s : state.getSources() ) { - final long z14 = ( img.min( 2 ) + img.max( 2 ) + 1 ) / 4; - final long z34 = ( img.min( 2 ) + img.max( 2 ) + 1 ) / 4 * 3; - histogram.addData( Views.iterable( Views.hyperSlice( img, 2, z14 ) ) ); - histogram.addData( Views.iterable( Views.hyperSlice( img, 2, z34 ) ) ); + final ConverterSetup setup = converterSetups.getConverterSetup( s ); + setup.setDisplayRange( bounds.getMinBound(), bounds.getMaxBound() ); } + } - final DiscreteFrequencyDistribution dfd = histogram.dfd(); - final long[] bin = new long[] { 0 }; - double cumulative = 0; - int i = 0; - for ( ; i < numBins && cumulative < cumulativeMinCutoff; ++i ) - { - bin[ 0 ] = i; - cumulative += dfd.relativeFrequency( bin ); - } - final int min = i * 65535 / numBins; - for ( ; i < numBins && cumulative < cumulativeMaxCutoff; ++i ) + /** + * @param cumulativeMinCutoff + * fraction of pixels that are allowed to be saturated at the lower end of the range. + * @param cumulativeMaxCutoff + * fraction of pixels that are allowed to be saturated at the upper end of the range. + */ + private static < T extends RealType< T > > Bounds estimateSourceRange( final Source< ? > source, final int timepoint, final double cumulativeMinCutoff, final double cumulativeMaxCutoff ) + { + final Object type = source.getType(); + if ( type instanceof UnsignedShortType && source.isPresent( timepoint ) ) { - bin[ 0 ] = i; - cumulative += dfd.relativeFrequency( bin ); + final RandomAccessibleInterval< T > img = Cast.unchecked( source.getSource( timepoint, source.getNumMipmapLevels() - 1 ) ); + final double sZ0 = img.min( 2 ); + final double sZ1 = img.max( 2 ); + final long z = ( img.min( 2 ) + img.max( 2 ) + 1 ) / 2; + + final int numBins = 6535; + final Histogram1d< T > histogram = new Histogram1d<>( Views.hyperSlice( img, 2, z ), new Real1dBinMapper<>( 0, 65535, numBins, false ) ); + + // sample some more planes if we have enough + if ( img.dimension( 2 ) > 4 ) + { + final long z14 = ( img.min( 2 ) + img.max( 2 ) + 1 ) / 4; + final long z34 = ( img.min( 2 ) + img.max( 2 ) + 1 ) / 4 * 3; + histogram.addData( Views.hyperSlice( img, 2, z14 ) ); + histogram.addData( Views.hyperSlice( img, 2, z34 ) ); + } + + final DiscreteFrequencyDistribution dfd = histogram.dfd(); + final long[] bin = new long[] { 0 }; + double cumulative = 0; + int i = 0; + for ( ; i < numBins && cumulative < cumulativeMinCutoff; ++i ) + { + bin[ 0 ] = i; + cumulative += dfd.relativeFrequency( bin ); + } + final int min = i * 65535 / numBins; + for ( ; i < numBins && cumulative < cumulativeMaxCutoff; ++i ) + { + bin[ 0 ] = i; + cumulative += dfd.relativeFrequency( bin ); + } + final int max = i * 65535 / numBins; + return new Bounds( min, max ); } - final int max = i * 65535 / numBins; - final MinMaxGroup minmax = setupAssignments.getMinMaxGroups().get( 0 ); - minmax.getMinBoundedValue().setCurrentValue( min ); - minmax.getMaxBoundedValue().setCurrentValue( max ); + else if ( type instanceof UnsignedByteType ) + return new Bounds( 0, 255 ); + else + return new Bounds( 0, 65535 ); } - public static BigDataViewer createBDV( final ExplorerWindow< ?, ? > panel ) + public static BigDataViewer createBDV( final ExplorerWindow< ? > panel ) { final BigDataViewer bdv = createBDV( panel.getSpimData(), panel.xml() ); @@ -276,7 +292,7 @@ public static BigDataViewer createBDV( final ExplorerWindow< ?, ? > panel ) return bdv; } - + public static BigDataViewer createBDV( final AbstractSpimData< ? > spimData, final String xml ) @@ -292,12 +308,9 @@ public static BigDataViewer createBDV( return null; } - BigDataViewer bdv = BigDataViewer.open( spimData, 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() ); - //initBrightness( 0.001, 0.999, bdv.getViewer().getState(), bdv.getSetupAssignments() ); + final BigDataViewer bdv = BigDataViewer.open( spimData, xml, IOFunctions.getProgressWriter(), ViewerOptions.options() ); + if ( !bdv.tryLoadSettings( xml ) ) + InitializeViewerState.initBrightness( 0.001, 0.999, bdv.getViewerFrame() ); // do not rotate BDV view by default BDVPopup.initTransform( bdv.getViewer() ); @@ -338,21 +351,25 @@ public static BigDataViewer createBDV( public static void initTransform( final ViewerPanel viewer ) { - final Dimension dim = viewer.getDisplay().getSize(); - final ViewerState state = viewer.getState(); - final AffineTransform3D viewerTransform = initTransform( dim.width, dim.height, false, state ); - viewer.setCurrentViewerTransform( viewerTransform ); + final Dimension dim = viewer.getDisplayComponent().getSize(); + final AffineTransform3D viewerTransform = initTransform( dim.width, dim.height, false, viewer.state().snapshot() ); + viewer.state().setViewerTransform( viewerTransform ); } + // TODO (TP) Add initTransform without rotation to bdv-core public static AffineTransform3D initTransform( final int viewerWidth, final int viewerHeight, final boolean zoomedIn, final ViewerState state ) { - final int cX = viewerWidth / 2; - final int cY = viewerHeight / 2; + final AffineTransform3D viewerTransform = new AffineTransform3D(); + final double cX = viewerWidth / 2.0; + final double cY = viewerHeight / 2.0; - final Source< ? > source = state.getSources().get( state.getCurrentSource() ).getSpimSource(); + final SourceAndConverter< ? > current = state.getCurrentSource(); + if ( current == null ) + return viewerTransform; + final Source< ? > source = current.getSpimSource(); final int timepoint = state.getCurrentTimepoint(); if ( !source.isPresent( timepoint ) ) - return new AffineTransform3D(); + return viewerTransform; final AffineTransform3D sourceTransform = new AffineTransform3D(); source.getSourceTransform( timepoint, 0, sourceTransform ); @@ -364,9 +381,9 @@ public static AffineTransform3D initTransform( final int viewerWidth, final int final double sY1 = sourceInterval.max( 1 ); final double sZ0 = sourceInterval.min( 2 ); final double sZ1 = sourceInterval.max( 2 ); - final double sX = ( sX0 + sX1 + 1 ) / 2; - final double sY = ( sY0 + sY1 + 1 ) / 2; - final double sZ = ( sZ0 != 0 || sZ1 != 0 ) ? ( sZ0 + sZ1 + 1 ) / 2 : 0; + final double sX = ( sX0 + sX1 ) / 2; + final double sY = ( sY0 + sY1 ) / 2; + final double sZ = Math.round( ( sZ0 + sZ1 ) / 2 ); // z-slice in the middle of a pixel final double[][] m = new double[ 3 ][ 4 ]; @@ -383,7 +400,6 @@ public static AffineTransform3D initTransform( final int viewerWidth, final int LinAlgHelpers.scale( translation, -1, translation ); LinAlgHelpers.setCol( 3, translation, m ); - final AffineTransform3D viewerTransform = new AffineTransform3D(); viewerTransform.set( m ); // scale @@ -402,12 +418,11 @@ public static AffineTransform3D initTransform( final int viewerWidth, final int viewerTransform.scale( scale ); // window center offset - viewerTransform.set( viewerTransform.get( 0, 3 ) + cX, 0, 3 ); - viewerTransform.set( viewerTransform.get( 1, 3 ) + cY, 1, 3 ); + viewerTransform.set( viewerTransform.get( 0, 3 ) + cX - 0.5, 0, 3 ); + viewerTransform.set( viewerTransform.get( 1, 3 ) + cY - 0.5, 1, 3 ); return viewerTransform; } - /* This does not work yet, because invalidateAll is not implemented yet. @@ -457,76 +472,4 @@ private static final void forceBDVReload(final AbstractSpimSource< ? > s) } */ - - private static final void callLoadTimePoint( final AbstractSpimSource< ? > s, final int timePointIndex ) - { - try - { - Class< ? > clazz = null; - boolean found = false; - - do - { - if ( clazz == null ) - clazz = s.getClass(); - else - clazz = clazz.getSuperclass(); - - if ( clazz != null ) - for ( final Method method : clazz.getDeclaredMethods() ) - if ( method.getName().equals( "loadTimepoint" ) ) - found = true; - } - while ( !found && clazz != null ); - - if ( !found ) - { - System.out.println( "Failed to find SpimSource.loadTimepoint method. Quiting." ); - return; - } - - final Method loadTimepoint = clazz.getDeclaredMethod( "loadTimepoint", Integer.TYPE ); - loadTimepoint.setAccessible( true ); - loadTimepoint.invoke( s, timePointIndex ); - } - catch ( Exception e ) { e.printStackTrace(); } - } - - private static final int getCurrentTimePointIndex( final AbstractSpimSource< ? > s ) - { - try - { - Class< ? > clazz = null; - Field currentTimePointIndex = null; - - do - { - if ( clazz == null ) - clazz = s.getClass(); - else - clazz = clazz.getSuperclass(); - - if ( clazz != null ) - for ( final Field field : clazz.getDeclaredFields() ) - if ( field.getName().equals( "currentTimePointIndex" ) ) - currentTimePointIndex = field; - } - while ( currentTimePointIndex == null && clazz != null ); - - if ( currentTimePointIndex == null ) - { - System.out.println( "Failed to find AbstractSpimSource.currentTimePointIndex. Quiting." ); - return -1; - } - - currentTimePointIndex.setAccessible( true ); - - return currentTimePointIndex.getInt( s ); - } - catch ( Exception e ) - { - e.printStackTrace(); - return -1; - } - } } diff --git a/src/main/java/net/preibisch/mvrecon/fiji/spimdata/explorer/popup/BakeManualTransformationPopup.java b/src/main/java/net/preibisch/mvrecon/fiji/spimdata/explorer/popup/BakeManualTransformationPopup.java index ac18e7180..24cbdef7a 100644 --- a/src/main/java/net/preibisch/mvrecon/fiji/spimdata/explorer/popup/BakeManualTransformationPopup.java +++ b/src/main/java/net/preibisch/mvrecon/fiji/spimdata/explorer/popup/BakeManualTransformationPopup.java @@ -24,7 +24,6 @@ import java.awt.event.ActionEvent; import java.util.ArrayList; -import java.util.List; import javax.swing.JComponent; import javax.swing.JMenuItem; @@ -33,8 +32,6 @@ import bdv.tools.transformation.TransformedSource; import bdv.viewer.state.SourceState; import bdv.viewer.state.ViewerState; -import mpicbg.spim.data.generic.AbstractSpimData; -import mpicbg.spim.data.generic.sequence.AbstractSequenceDescription; import mpicbg.spim.data.registration.ViewRegistration; import mpicbg.spim.data.registration.ViewRegistrations; import mpicbg.spim.data.registration.ViewTransform; @@ -44,14 +41,12 @@ import net.preibisch.legacy.io.IOFunctions; import net.preibisch.mvrecon.fiji.spimdata.SpimData2; import net.preibisch.mvrecon.fiji.spimdata.explorer.ExplorerWindow; -import net.preibisch.mvrecon.fiji.spimdata.explorer.ViewSetupExplorerPanel; -import net.preibisch.mvrecon.process.interestpointregistration.pairwise.constellation.grouping.Group; public class BakeManualTransformationPopup extends JMenuItem implements ExplorerWindowSetable { private static final long serialVersionUID = 4627408819269954486L; - ExplorerWindow< ?, ? > panel; + ExplorerWindow< ? > panel; public BakeManualTransformationPopup() { @@ -61,7 +56,7 @@ public BakeManualTransformationPopup() } @Override - public JComponent setExplorerWindow( ExplorerWindow>, ?> panel ) + public JComponent setExplorerWindow( ExplorerWindow< ? > panel ) { this.panel = panel; return this; diff --git a/src/main/java/net/preibisch/mvrecon/fiji/spimdata/explorer/popup/BoundingBoxPopup.java b/src/main/java/net/preibisch/mvrecon/fiji/spimdata/explorer/popup/BoundingBoxPopup.java index 531194425..41e0f1cae 100644 --- a/src/main/java/net/preibisch/mvrecon/fiji/spimdata/explorer/popup/BoundingBoxPopup.java +++ b/src/main/java/net/preibisch/mvrecon/fiji/spimdata/explorer/popup/BoundingBoxPopup.java @@ -42,7 +42,7 @@ public class BoundingBoxPopup extends JMenuItem implements ExplorerWindowSetable { private static final long serialVersionUID = 5234649267634013390L; - ExplorerWindow< ?, ? > panel; + ExplorerWindow< ? > panel; public BoundingBoxPopup() { @@ -52,7 +52,7 @@ public BoundingBoxPopup() } @Override - public JComponent setExplorerWindow( ExplorerWindow>, ?> panel ) + public JComponent setExplorerWindow( ExplorerWindow< ? > panel ) { this.panel = panel; return this; diff --git a/src/main/java/net/preibisch/mvrecon/fiji/spimdata/explorer/popup/DeconvolutionPopup.java b/src/main/java/net/preibisch/mvrecon/fiji/spimdata/explorer/popup/DeconvolutionPopup.java index b60c50d30..f29674463 100644 --- a/src/main/java/net/preibisch/mvrecon/fiji/spimdata/explorer/popup/DeconvolutionPopup.java +++ b/src/main/java/net/preibisch/mvrecon/fiji/spimdata/explorer/popup/DeconvolutionPopup.java @@ -39,7 +39,7 @@ public class DeconvolutionPopup extends JMenuItem implements ExplorerWindowSetab { private static final long serialVersionUID = 5234649267634013390L; - ExplorerWindow< ?, ? > panel; + ExplorerWindow< ? > panel; public DeconvolutionPopup() { @@ -49,7 +49,7 @@ public DeconvolutionPopup() } @Override - public JMenuItem setExplorerWindow( final ExplorerWindow< ?, ? > panel ) + public JMenuItem setExplorerWindow( final ExplorerWindow< ? > panel ) { this.panel = panel; return this; diff --git a/src/main/java/net/preibisch/mvrecon/fiji/spimdata/explorer/popup/DetectInterestPointsPopup.java b/src/main/java/net/preibisch/mvrecon/fiji/spimdata/explorer/popup/DetectInterestPointsPopup.java index 327fca94a..e4c51cc3b 100644 --- a/src/main/java/net/preibisch/mvrecon/fiji/spimdata/explorer/popup/DetectInterestPointsPopup.java +++ b/src/main/java/net/preibisch/mvrecon/fiji/spimdata/explorer/popup/DetectInterestPointsPopup.java @@ -39,7 +39,7 @@ public class DetectInterestPointsPopup extends JMenuItem implements ExplorerWind { private static final long serialVersionUID = 5234649267634013390L; - ExplorerWindow< ?, ? > panel; + ExplorerWindow< ? > panel; public DetectInterestPointsPopup() { @@ -49,7 +49,7 @@ public DetectInterestPointsPopup() } @Override - public JMenuItem setExplorerWindow( final ExplorerWindow< ?, ? > panel ) + public JMenuItem setExplorerWindow( final ExplorerWindow< ? > panel ) { this.panel = panel; return this; diff --git a/src/main/java/net/preibisch/mvrecon/fiji/spimdata/explorer/popup/DisplayFusedImagesPopup.java b/src/main/java/net/preibisch/mvrecon/fiji/spimdata/explorer/popup/DisplayFusedImagesPopup.java index 527963979..2e46f2bea 100644 --- a/src/main/java/net/preibisch/mvrecon/fiji/spimdata/explorer/popup/DisplayFusedImagesPopup.java +++ b/src/main/java/net/preibisch/mvrecon/fiji/spimdata/explorer/popup/DisplayFusedImagesPopup.java @@ -71,7 +71,7 @@ public class DisplayFusedImagesPopup extends JMenu implements ExplorerWindowSeta private static final long serialVersionUID = -4895470813542722644L; - ExplorerWindow< ?, ? > panel = null; + ExplorerWindow< ? > panel = null; public DisplayFusedImagesPopup() { @@ -162,7 +162,7 @@ public void menuCanceled( MenuEvent e ) {} } @Override - public JMenuItem setExplorerWindow( final ExplorerWindow< ?, ? > panel ) + public JMenuItem setExplorerWindow( final ExplorerWindow< ? > panel ) { this.panel = panel; diff --git a/src/main/java/net/preibisch/mvrecon/fiji/spimdata/explorer/popup/DisplayRawImagesPopup.java b/src/main/java/net/preibisch/mvrecon/fiji/spimdata/explorer/popup/DisplayRawImagesPopup.java index 27c01c300..23b121125 100644 --- a/src/main/java/net/preibisch/mvrecon/fiji/spimdata/explorer/popup/DisplayRawImagesPopup.java +++ b/src/main/java/net/preibisch/mvrecon/fiji/spimdata/explorer/popup/DisplayRawImagesPopup.java @@ -42,7 +42,7 @@ public class DisplayRawImagesPopup extends JMenu implements ExplorerWindowSetabl public static final int askWhenMoreThan = 5; private static final long serialVersionUID = 5234649262342301390L; - ExplorerWindow< ?, ? > panel = null; + ExplorerWindow< ? > panel = null; public DisplayRawImagesPopup() { @@ -59,7 +59,7 @@ public DisplayRawImagesPopup() } @Override - public JMenuItem setExplorerWindow( final ExplorerWindow< ?, ? > panel ) + public JMenuItem setExplorerWindow( final ExplorerWindow< ? > panel ) { this.panel = panel; diff --git a/src/main/java/net/preibisch/mvrecon/fiji/spimdata/explorer/popup/ExplorerWindowSetable.java b/src/main/java/net/preibisch/mvrecon/fiji/spimdata/explorer/popup/ExplorerWindowSetable.java index 70829c5e0..dc633deca 100644 --- a/src/main/java/net/preibisch/mvrecon/fiji/spimdata/explorer/popup/ExplorerWindowSetable.java +++ b/src/main/java/net/preibisch/mvrecon/fiji/spimdata/explorer/popup/ExplorerWindowSetable.java @@ -31,6 +31,6 @@ public interface ExplorerWindowSetable { - public JComponent setExplorerWindow( final ExplorerWindow< ? extends AbstractSpimData< ? extends AbstractSequenceDescription< ?, ?, ? > >, ? > panel ); + public JComponent setExplorerWindow( final ExplorerWindow< ? > panel ); } // AbstractSpimData< ? extends AbstractSequenceDescription< ?, ?, ? > > diff --git a/src/main/java/net/preibisch/mvrecon/fiji/spimdata/explorer/popup/FlatFieldCorrectionPopup.java b/src/main/java/net/preibisch/mvrecon/fiji/spimdata/explorer/popup/FlatFieldCorrectionPopup.java index 6f85b60a8..d169de4e4 100644 --- a/src/main/java/net/preibisch/mvrecon/fiji/spimdata/explorer/popup/FlatFieldCorrectionPopup.java +++ b/src/main/java/net/preibisch/mvrecon/fiji/spimdata/explorer/popup/FlatFieldCorrectionPopup.java @@ -35,8 +35,6 @@ import javax.swing.JMenuItem; import fiji.util.gui.GenericDialogPlus; -import mpicbg.spim.data.generic.AbstractSpimData; -import mpicbg.spim.data.generic.sequence.AbstractSequenceDescription; import mpicbg.spim.data.sequence.Channel; import mpicbg.spim.data.sequence.Illumination; import mpicbg.spim.data.sequence.ImgLoader; @@ -54,7 +52,7 @@ public class FlatFieldCorrectionPopup extends JMenuItem implements ExplorerWindo { private static final long serialVersionUID = 950277697000203629L; - private ExplorerWindow< ? extends AbstractSpimData< ? extends AbstractSequenceDescription< ?, ?, ? > >, ? > panel; + private ExplorerWindow< ? > panel; public FlatFieldCorrectionPopup() { @@ -63,8 +61,7 @@ public FlatFieldCorrectionPopup() } @Override - public JComponent setExplorerWindow( - ExplorerWindow< ? extends AbstractSpimData< ? extends AbstractSequenceDescription< ?, ?, ? > >, ? > panel) + public JComponent setExplorerWindow( ExplorerWindow< ? > panel ) { this.panel = panel; return this; diff --git a/src/main/java/net/preibisch/mvrecon/fiji/spimdata/explorer/popup/FusionPopup.java b/src/main/java/net/preibisch/mvrecon/fiji/spimdata/explorer/popup/FusionPopup.java index 55c008f47..020170cca 100644 --- a/src/main/java/net/preibisch/mvrecon/fiji/spimdata/explorer/popup/FusionPopup.java +++ b/src/main/java/net/preibisch/mvrecon/fiji/spimdata/explorer/popup/FusionPopup.java @@ -39,7 +39,7 @@ public class FusionPopup extends JMenuItem implements ExplorerWindowSetable { private static final long serialVersionUID = 5234649267634013390L; - ExplorerWindow< ?, ? > panel; + ExplorerWindow< ? > panel; public FusionPopup() { @@ -49,7 +49,7 @@ public FusionPopup() } @Override - public JMenuItem setExplorerWindow( final ExplorerWindow< ?, ? > panel ) + public JMenuItem setExplorerWindow( final ExplorerWindow< ? > panel ) { this.panel = panel; return this; diff --git a/src/main/java/net/preibisch/mvrecon/fiji/spimdata/explorer/popup/IntensityAdjustmentPopup.java b/src/main/java/net/preibisch/mvrecon/fiji/spimdata/explorer/popup/IntensityAdjustmentPopup.java index 96d9b6a6f..924919307 100644 --- a/src/main/java/net/preibisch/mvrecon/fiji/spimdata/explorer/popup/IntensityAdjustmentPopup.java +++ b/src/main/java/net/preibisch/mvrecon/fiji/spimdata/explorer/popup/IntensityAdjustmentPopup.java @@ -43,7 +43,7 @@ public class IntensityAdjustmentPopup extends JMenu implements ExplorerWindowSet { private static final long serialVersionUID = 1L; - ExplorerWindow< ?, ? > panel; + ExplorerWindow< ? > panel; protected static String[] types = new String[]{ "Compute ...", "List all", "Remove" }; @@ -65,7 +65,7 @@ public IntensityAdjustmentPopup() } @Override - public JMenuItem setExplorerWindow( final ExplorerWindow< ?, ? > panel ) + public JMenuItem setExplorerWindow( final ExplorerWindow< ? > panel ) { this.panel = panel; return this; diff --git a/src/main/java/net/preibisch/mvrecon/fiji/spimdata/explorer/popup/InterestPointsExplorerPopup.java b/src/main/java/net/preibisch/mvrecon/fiji/spimdata/explorer/popup/InterestPointsExplorerPopup.java index 76ca00198..054b40992 100644 --- a/src/main/java/net/preibisch/mvrecon/fiji/spimdata/explorer/popup/InterestPointsExplorerPopup.java +++ b/src/main/java/net/preibisch/mvrecon/fiji/spimdata/explorer/popup/InterestPointsExplorerPopup.java @@ -40,8 +40,8 @@ public class InterestPointsExplorerPopup extends JMenuItem implements ExplorerWi { private static final long serialVersionUID = 5234649267634013390L; - ViewSetupExplorerPanel< ?, ? > panel; - InterestPointExplorer< ?, ? > ipe = null; + ViewSetupExplorerPanel< ? > panel; + InterestPointExplorer< ? > ipe = null; public InterestPointsExplorerPopup() { @@ -52,9 +52,9 @@ public InterestPointsExplorerPopup() @Override - public JMenuItem setExplorerWindow( final ExplorerWindow< ?, ? > panel ) + public JMenuItem setExplorerWindow( final ExplorerWindow< ? > panel ) { - this.panel = (ViewSetupExplorerPanel< ?, ? >)panel; + this.panel = (ViewSetupExplorerPanel< ? >)panel; return this; } @@ -94,8 +94,8 @@ public void run() } } - private static final < AS extends SpimData2, X extends XmlIoAbstractSpimData< ?, AS > > InterestPointExplorer< AS, X > instanceFor( final FilteredAndGroupedExplorerPanel< AS, X > panel ) + private static < AS extends SpimData2 > InterestPointExplorer< AS > instanceFor( final FilteredAndGroupedExplorerPanel< AS > panel ) { - return new InterestPointExplorer< AS, X >( panel.xml(), panel.io(), panel.explorer() ); + return new InterestPointExplorer<>( panel.xml(), panel.io(), panel.explorer() ); } } diff --git a/src/main/java/net/preibisch/mvrecon/fiji/spimdata/explorer/popup/LabelPopUp.java b/src/main/java/net/preibisch/mvrecon/fiji/spimdata/explorer/popup/LabelPopUp.java index 8fc502a8b..90cb8ac6d 100644 --- a/src/main/java/net/preibisch/mvrecon/fiji/spimdata/explorer/popup/LabelPopUp.java +++ b/src/main/java/net/preibisch/mvrecon/fiji/spimdata/explorer/popup/LabelPopUp.java @@ -41,7 +41,7 @@ public LabelPopUp( final String text ) } @Override - public JLabel setExplorerWindow( final ExplorerWindow< ?, ? > panel ) + public JLabel setExplorerWindow( final ExplorerWindow< ? > panel ) { return this; } diff --git a/src/main/java/net/preibisch/mvrecon/fiji/spimdata/explorer/popup/MaxProjectPopup.java b/src/main/java/net/preibisch/mvrecon/fiji/spimdata/explorer/popup/MaxProjectPopup.java index 7481aa420..fe3572aca 100644 --- a/src/main/java/net/preibisch/mvrecon/fiji/spimdata/explorer/popup/MaxProjectPopup.java +++ b/src/main/java/net/preibisch/mvrecon/fiji/spimdata/explorer/popup/MaxProjectPopup.java @@ -44,7 +44,7 @@ public class MaxProjectPopup extends JMenuItem implements ExplorerWindowSetable private static final long serialVersionUID = 5234649267634013390L; public static boolean showWarning = true; - ExplorerWindow< ? extends AbstractSpimData< ? extends AbstractSequenceDescription< ?, ?, ? > >, ? > panel; + ExplorerWindow< ? > panel; public MaxProjectPopup() { @@ -54,7 +54,7 @@ public MaxProjectPopup() } @Override - public JMenuItem setExplorerWindow( final ExplorerWindow< ? extends AbstractSpimData< ? extends AbstractSequenceDescription< ?, ?, ? > >, ? > panel ) + public JMenuItem setExplorerWindow( final ExplorerWindow< ? > panel ) { this.panel = panel; return this; diff --git a/src/main/java/net/preibisch/mvrecon/fiji/spimdata/explorer/popup/PointSpreadFunctionsPopup.java b/src/main/java/net/preibisch/mvrecon/fiji/spimdata/explorer/popup/PointSpreadFunctionsPopup.java index f97763264..e90f1514a 100644 --- a/src/main/java/net/preibisch/mvrecon/fiji/spimdata/explorer/popup/PointSpreadFunctionsPopup.java +++ b/src/main/java/net/preibisch/mvrecon/fiji/spimdata/explorer/popup/PointSpreadFunctionsPopup.java @@ -50,10 +50,10 @@ public class PointSpreadFunctionsPopup extends JMenu implements ExplorerWindowSe { private static final long serialVersionUID = 1L; - ExplorerWindow< ?, ? > panel = null; + ExplorerWindow< ? > panel = null; @Override - public JMenuItem setExplorerWindow( final ExplorerWindow< ?, ? > panel ) + public JMenuItem setExplorerWindow( final ExplorerWindow< ? > panel ) { this.panel = panel; diff --git a/src/main/java/net/preibisch/mvrecon/fiji/spimdata/explorer/popup/QualityPopup.java b/src/main/java/net/preibisch/mvrecon/fiji/spimdata/explorer/popup/QualityPopup.java index 8dae96d7c..b0d28224d 100644 --- a/src/main/java/net/preibisch/mvrecon/fiji/spimdata/explorer/popup/QualityPopup.java +++ b/src/main/java/net/preibisch/mvrecon/fiji/spimdata/explorer/popup/QualityPopup.java @@ -40,7 +40,7 @@ public class QualityPopup extends JMenuItem implements ExplorerWindowSetable { private static final long serialVersionUID = 5234649267634013390L; - ExplorerWindow< ?, ? > panel; + ExplorerWindow< ? > panel; public QualityPopup() { @@ -50,7 +50,7 @@ public QualityPopup() } @Override - public JMenuItem setExplorerWindow( final ExplorerWindow< ?, ? > panel ) + public JMenuItem setExplorerWindow( final ExplorerWindow< ? > panel ) { this.panel = panel; return this; diff --git a/src/main/java/net/preibisch/mvrecon/fiji/spimdata/explorer/popup/RegisterInterestPointsPopup.java b/src/main/java/net/preibisch/mvrecon/fiji/spimdata/explorer/popup/RegisterInterestPointsPopup.java index 243dcbdf1..e255a36a7 100644 --- a/src/main/java/net/preibisch/mvrecon/fiji/spimdata/explorer/popup/RegisterInterestPointsPopup.java +++ b/src/main/java/net/preibisch/mvrecon/fiji/spimdata/explorer/popup/RegisterInterestPointsPopup.java @@ -39,7 +39,7 @@ public class RegisterInterestPointsPopup extends JMenuItem implements ExplorerWi { private static final long serialVersionUID = 5234649267634013390L; - ExplorerWindow< ?, ? > panel; + ExplorerWindow< ? > panel; public RegisterInterestPointsPopup() { @@ -49,7 +49,7 @@ public RegisterInterestPointsPopup() } @Override - public JMenuItem setExplorerWindow( final ExplorerWindow< ?, ? > panel ) + public JMenuItem setExplorerWindow( final ExplorerWindow< ? > panel ) { this.panel = panel; return this; diff --git a/src/main/java/net/preibisch/mvrecon/fiji/spimdata/explorer/popup/RegistrationExplorerPopup.java b/src/main/java/net/preibisch/mvrecon/fiji/spimdata/explorer/popup/RegistrationExplorerPopup.java index d6b4cfa1e..8002c2279 100644 --- a/src/main/java/net/preibisch/mvrecon/fiji/spimdata/explorer/popup/RegistrationExplorerPopup.java +++ b/src/main/java/net/preibisch/mvrecon/fiji/spimdata/explorer/popup/RegistrationExplorerPopup.java @@ -41,8 +41,8 @@ public class RegistrationExplorerPopup extends JMenuItem implements ExplorerWind { private static final long serialVersionUID = 5234649267634013390L; - FilteredAndGroupedExplorerPanel< ?, ? > panel; - RegistrationExplorer< ?, ? > re = null; + FilteredAndGroupedExplorerPanel< ? > panel; + RegistrationExplorer< ? > re = null; public RegistrationExplorerPopup() { @@ -52,9 +52,9 @@ public RegistrationExplorerPopup() } @Override - public JMenuItem setExplorerWindow( final ExplorerWindow< ?, ? > panel ) + public JMenuItem setExplorerWindow( final ExplorerWindow< ? > panel ) { - this.panel = (FilteredAndGroupedExplorerPanel< ?, ? >)panel; + this.panel = ( FilteredAndGroupedExplorerPanel< ? > ) panel; return this; } @@ -88,8 +88,8 @@ public void run() } } - private static final < AS extends AbstractSpimData< ? >, X extends XmlIoAbstractSpimData< ?, AS > > RegistrationExplorer< AS, X > instanceFor( final FilteredAndGroupedExplorerPanel< AS, X > panel ) + private static < AS extends AbstractSpimData< ? > > RegistrationExplorer< AS > instanceFor( final FilteredAndGroupedExplorerPanel< AS > panel ) { - return new RegistrationExplorer< AS, X >( panel.xml(), panel.io(), panel.explorer() ); + return new RegistrationExplorer<>( panel.xml(), panel.io(), panel.explorer() ); } } diff --git a/src/main/java/net/preibisch/mvrecon/fiji/spimdata/explorer/popup/RemoveDetectionsPopup.java b/src/main/java/net/preibisch/mvrecon/fiji/spimdata/explorer/popup/RemoveDetectionsPopup.java index 4417c075f..9db5f6b16 100644 --- a/src/main/java/net/preibisch/mvrecon/fiji/spimdata/explorer/popup/RemoveDetectionsPopup.java +++ b/src/main/java/net/preibisch/mvrecon/fiji/spimdata/explorer/popup/RemoveDetectionsPopup.java @@ -57,7 +57,7 @@ public class RemoveDetectionsPopup extends JMenu implements ExplorerWindowSetabl { private static final long serialVersionUID = 1L; - ExplorerWindow< ?, ? > panel = null; + ExplorerWindow< ? > panel = null; public static int defaultLabel = 0; public static String defaultNewLabel = "Manually removed"; @@ -141,7 +141,7 @@ public void menuCanceled( MenuEvent e ) {} } @Override - public JMenuItem setExplorerWindow( final ExplorerWindow< ?, ? > panel ) + public JMenuItem setExplorerWindow( final ExplorerWindow< ? > panel ) { this.panel = panel; diff --git a/src/main/java/net/preibisch/mvrecon/fiji/spimdata/explorer/popup/RemoveTransformationPopup.java b/src/main/java/net/preibisch/mvrecon/fiji/spimdata/explorer/popup/RemoveTransformationPopup.java index 1907f54ab..4eabbe4c0 100644 --- a/src/main/java/net/preibisch/mvrecon/fiji/spimdata/explorer/popup/RemoveTransformationPopup.java +++ b/src/main/java/net/preibisch/mvrecon/fiji/spimdata/explorer/popup/RemoveTransformationPopup.java @@ -42,7 +42,7 @@ public class RemoveTransformationPopup extends JMenu implements ExplorerWindowSe public static final int askWhenMoreThan = 5; private static final long serialVersionUID = 5234649267634013390L; - ExplorerWindow< ?, ? > panel; + ExplorerWindow< ? > panel; protected static String[] types = new String[]{ "Latest/Newest Transformation", "First/Oldest Transformation" }; @@ -61,7 +61,7 @@ public RemoveTransformationPopup() } @Override - public JMenuItem setExplorerWindow( final ExplorerWindow< ?, ? > panel ) + public JMenuItem setExplorerWindow( final ExplorerWindow< ? > panel ) { this.panel = panel; return this; diff --git a/src/main/java/net/preibisch/mvrecon/fiji/spimdata/explorer/popup/ReorientSamplePopup.java b/src/main/java/net/preibisch/mvrecon/fiji/spimdata/explorer/popup/ReorientSamplePopup.java index 2b2221382..df981c131 100644 --- a/src/main/java/net/preibisch/mvrecon/fiji/spimdata/explorer/popup/ReorientSamplePopup.java +++ b/src/main/java/net/preibisch/mvrecon/fiji/spimdata/explorer/popup/ReorientSamplePopup.java @@ -31,8 +31,6 @@ import bdv.BigDataViewer; import mpicbg.spim.data.SpimData; -import mpicbg.spim.data.generic.AbstractSpimData; -import mpicbg.spim.data.generic.sequence.AbstractSequenceDescription; import mpicbg.spim.data.sequence.ViewDescription; import mpicbg.spim.data.sequence.ViewId; import net.imglib2.realtransform.AffineTransform3D; @@ -48,7 +46,7 @@ public class ReorientSamplePopup extends JMenuItem implements ExplorerWindowSeta private static final long serialVersionUID = 5234649267634013390L; public static boolean showWarning = true; - ExplorerWindow< ? extends AbstractSpimData< ? extends AbstractSequenceDescription< ?, ?, ? > >, ? > panel; + ExplorerWindow< ? > panel; public ReorientSamplePopup() { @@ -58,7 +56,7 @@ public ReorientSamplePopup() } @Override - public JMenuItem setExplorerWindow( final ExplorerWindow< ? extends AbstractSpimData< ? extends AbstractSequenceDescription< ?, ?, ? > >, ? > panel ) + public JMenuItem setExplorerWindow( final ExplorerWindow< ? > panel ) { this.panel = panel; return this; diff --git a/src/main/java/net/preibisch/mvrecon/fiji/spimdata/explorer/popup/ResavePopup.java b/src/main/java/net/preibisch/mvrecon/fiji/spimdata/explorer/popup/ResavePopup.java index 7950f2616..05d98dd08 100644 --- a/src/main/java/net/preibisch/mvrecon/fiji/spimdata/explorer/popup/ResavePopup.java +++ b/src/main/java/net/preibisch/mvrecon/fiji/spimdata/explorer/popup/ResavePopup.java @@ -25,10 +25,7 @@ import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.io.File; -import java.io.IOException; import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collections; import java.util.Date; import java.util.List; import java.util.Map; @@ -38,22 +35,11 @@ import javax.swing.JMenuItem; import javax.swing.JOptionPane; -import org.janelia.saalfeldlab.n5.GzipCompression; - import bdv.export.ExportMipmapInfo; import bdv.export.ProgressWriter; -import bdv.export.ProposeMipmaps; -import bdv.export.WriteSequenceToHdf5; -import bdv.export.ExportScalePyramid; -import bdv.export.n5.WriteSequenceToN5; import bdv.img.n5.N5ImageLoader; -import mpicbg.spim.data.generic.AbstractSpimData; -import mpicbg.spim.data.generic.sequence.AbstractSequenceDescription; import mpicbg.spim.data.sequence.ViewId; import mpicbg.spim.data.sequence.ViewSetup; -import net.imglib2.img.array.ArrayImgFactory; -import net.imglib2.img.cell.CellImgFactory; -import net.imglib2.type.numeric.real.FloatType; import net.preibisch.legacy.io.IOFunctions; import net.preibisch.mvrecon.fiji.ImgLib2Temp.Pair; import net.preibisch.mvrecon.fiji.plugin.resave.Generic_Resave_HDF5; @@ -66,15 +52,13 @@ import net.preibisch.mvrecon.fiji.spimdata.SpimData2; import net.preibisch.mvrecon.fiji.spimdata.explorer.ExplorerWindow; import net.preibisch.mvrecon.fiji.spimdata.explorer.FilteredAndGroupedExplorerPanel; -import net.preibisch.mvrecon.fiji.spimdata.imgloaders.AbstractImgFactoryImgLoader; -import net.preibisch.mvrecon.fiji.spimdata.imgloaders.MicroManagerImgLoader; public class ResavePopup extends JMenu implements ExplorerWindowSetable { public static final int askWhenMoreThan = 5; private static final long serialVersionUID = 5234649267634013390L; - FilteredAndGroupedExplorerPanel< ?, ? > panel; + FilteredAndGroupedExplorerPanel< ? > panel; protected static String[] types = new String[]{ "As TIFF ...", "As compressed TIFF ...", "As HDF5 ...", "As compressed HDF5 ...", "As compressed N5 ..." }; @@ -102,9 +86,9 @@ public ResavePopup() } @Override - public JMenuItem setExplorerWindow(ExplorerWindow>, ?> panel ) + public JMenuItem setExplorerWindow( ExplorerWindow< ? > panel ) { - this.panel = (FilteredAndGroupedExplorerPanel< ?, ? >)panel; + this.panel = ( FilteredAndGroupedExplorerPanel< ? > ) panel; return this; } diff --git a/src/main/java/net/preibisch/mvrecon/fiji/spimdata/explorer/popup/Separator.java b/src/main/java/net/preibisch/mvrecon/fiji/spimdata/explorer/popup/Separator.java index c6049aca3..2db7e1615 100644 --- a/src/main/java/net/preibisch/mvrecon/fiji/spimdata/explorer/popup/Separator.java +++ b/src/main/java/net/preibisch/mvrecon/fiji/spimdata/explorer/popup/Separator.java @@ -31,7 +31,7 @@ public class Separator extends JSeparator implements ExplorerWindowSetable private static final long serialVersionUID = 5234649267634013390L; @Override - public JSeparator setExplorerWindow( final ExplorerWindow< ?, ? > panel ) + public JSeparator setExplorerWindow( final ExplorerWindow< ? > panel ) { return this; } diff --git a/src/main/java/net/preibisch/mvrecon/fiji/spimdata/explorer/popup/SimpleHyperlinkPopup.java b/src/main/java/net/preibisch/mvrecon/fiji/spimdata/explorer/popup/SimpleHyperlinkPopup.java index 77cc021ce..78d3a2412 100644 --- a/src/main/java/net/preibisch/mvrecon/fiji/spimdata/explorer/popup/SimpleHyperlinkPopup.java +++ b/src/main/java/net/preibisch/mvrecon/fiji/spimdata/explorer/popup/SimpleHyperlinkPopup.java @@ -34,10 +34,7 @@ import javax.swing.JLabel; import javax.swing.JMenuItem; -import mpicbg.spim.data.generic.AbstractSpimData; -import mpicbg.spim.data.generic.sequence.AbstractSequenceDescription; import net.preibisch.mvrecon.fiji.spimdata.explorer.ExplorerWindow; -import net.preibisch.mvrecon.fiji.spimdata.explorer.popup.ExplorerWindowSetable; public class SimpleHyperlinkPopup extends JMenuItem implements ExplorerWindowSetable { @@ -55,8 +52,7 @@ public SimpleHyperlinkPopup(String title, URI uri) } @Override - public JComponent setExplorerWindow( - ExplorerWindow< ? extends AbstractSpimData< ? extends AbstractSequenceDescription< ?, ?, ? > >, ? > panel) + public JComponent setExplorerWindow( ExplorerWindow< ? > panel ) { return this; } diff --git a/src/main/java/net/preibisch/mvrecon/fiji/spimdata/explorer/popup/SpecifyCalibrationPopup.java b/src/main/java/net/preibisch/mvrecon/fiji/spimdata/explorer/popup/SpecifyCalibrationPopup.java index 6ef51d2db..d3d0c1f22 100644 --- a/src/main/java/net/preibisch/mvrecon/fiji/spimdata/explorer/popup/SpecifyCalibrationPopup.java +++ b/src/main/java/net/preibisch/mvrecon/fiji/spimdata/explorer/popup/SpecifyCalibrationPopup.java @@ -45,7 +45,7 @@ public class SpecifyCalibrationPopup extends JMenuItem implements ExplorerWindow private static final long serialVersionUID = 5234649267634013390L; public static boolean showWarning = true; - ExplorerWindow< ? extends AbstractSpimData< ? extends AbstractSequenceDescription< ?, ?, ? > >, ? > panel; + ExplorerWindow< ? > panel; public SpecifyCalibrationPopup() { @@ -55,7 +55,7 @@ public SpecifyCalibrationPopup() } @Override - public JMenuItem setExplorerWindow( final ExplorerWindow< ? extends AbstractSpimData< ? extends AbstractSequenceDescription< ?, ?, ? > >, ? > panel ) + public JMenuItem setExplorerWindow( final ExplorerWindow< ? > panel ) { this.panel = panel; return this; diff --git a/src/main/java/net/preibisch/mvrecon/fiji/spimdata/explorer/popup/VisualizeDetectionsPopup.java b/src/main/java/net/preibisch/mvrecon/fiji/spimdata/explorer/popup/VisualizeDetectionsPopup.java index 2fa4892e4..3e9c905e9 100644 --- a/src/main/java/net/preibisch/mvrecon/fiji/spimdata/explorer/popup/VisualizeDetectionsPopup.java +++ b/src/main/java/net/preibisch/mvrecon/fiji/spimdata/explorer/popup/VisualizeDetectionsPopup.java @@ -34,15 +34,13 @@ import net.preibisch.mvrecon.fiji.spimdata.SpimData2; import net.preibisch.mvrecon.fiji.spimdata.explorer.ExplorerWindow; -import mpicbg.spim.data.generic.AbstractSpimData; -import mpicbg.spim.data.generic.sequence.AbstractSequenceDescription; import mpicbg.spim.data.sequence.ViewId; public class VisualizeDetectionsPopup extends JMenuItem implements ExplorerWindowSetable { private static final long serialVersionUID = 5234649267634013390L; - ExplorerWindow< ? extends AbstractSpimData< ? extends AbstractSequenceDescription< ?, ?, ? > >, ? > panel; + ExplorerWindow< ? > panel; public VisualizeDetectionsPopup() { @@ -52,7 +50,7 @@ public VisualizeDetectionsPopup() } @Override - public JMenuItem setExplorerWindow( final ExplorerWindow< ? extends AbstractSpimData< ? extends AbstractSequenceDescription< ?, ?, ? > >, ? > panel ) + public JMenuItem setExplorerWindow( final ExplorerWindow< ? > panel ) { this.panel = panel; return this; diff --git a/src/main/java/net/preibisch/mvrecon/fiji/spimdata/explorer/popup/VisualizeNonRigid.java b/src/main/java/net/preibisch/mvrecon/fiji/spimdata/explorer/popup/VisualizeNonRigid.java index 8c1a36704..9e40e8828 100644 --- a/src/main/java/net/preibisch/mvrecon/fiji/spimdata/explorer/popup/VisualizeNonRigid.java +++ b/src/main/java/net/preibisch/mvrecon/fiji/spimdata/explorer/popup/VisualizeNonRigid.java @@ -69,7 +69,7 @@ public class VisualizeNonRigid extends JMenuItem implements ExplorerWindowSetabl { private static final long serialVersionUID = -4858927229313796971L; - ExplorerWindow< ? extends AbstractSpimData< ? extends AbstractSequenceDescription< ?, ?, ? > >, ? > panel; + ExplorerWindow< ? > panel; final private static String[] displayOptions = new String[] { "Overlay all views affine vs. non-rigid", @@ -87,7 +87,7 @@ public VisualizeNonRigid() } @Override - public JMenuItem setExplorerWindow( final ExplorerWindow< ? extends AbstractSpimData< ? extends AbstractSequenceDescription< ?, ?, ? > >, ? > panel ) + public JMenuItem setExplorerWindow( final ExplorerWindow< ? > panel ) { this.panel = panel; return this; diff --git a/src/main/java/net/preibisch/mvrecon/fiji/spimdata/explorer/registration/RegistrationExplorer.java b/src/main/java/net/preibisch/mvrecon/fiji/spimdata/explorer/registration/RegistrationExplorer.java index 18eaa839c..2dd8f3056 100644 --- a/src/main/java/net/preibisch/mvrecon/fiji/spimdata/explorer/registration/RegistrationExplorer.java +++ b/src/main/java/net/preibisch/mvrecon/fiji/spimdata/explorer/registration/RegistrationExplorer.java @@ -40,15 +40,15 @@ import mpicbg.spim.data.generic.sequence.BasicViewDescription; import mpicbg.spim.data.generic.sequence.BasicViewSetup; -public class RegistrationExplorer< AS extends AbstractSpimData< ? >, X extends XmlIoAbstractSpimData< ?, AS > > +public class RegistrationExplorer< AS extends AbstractSpimData< ? > > implements SelectedViewDescriptionListener< AS > { final String xml; final JFrame frame; final RegistrationExplorerPanel panel; - final FilteredAndGroupedExplorer< AS, X > viewSetupExplorer; - - public RegistrationExplorer( final String xml, final X io, final FilteredAndGroupedExplorer< AS, X > viewSetupExplorer ) + final FilteredAndGroupedExplorer< AS > viewSetupExplorer; + + public RegistrationExplorer( final String xml, final XmlIoAbstractSpimData< ?, AS > io, final FilteredAndGroupedExplorer< AS > viewSetupExplorer ) { this.xml = xml; this.viewSetupExplorer = viewSetupExplorer; @@ -78,10 +78,10 @@ public RegistrationExplorer( final String xml, final X io, final FilteredAndGrou public void save() {} @Override - public void selectedViewDescriptions( final List >> viewDescriptions ) + public void selectedViewDescriptions( final List >> viewDescriptions ) { - List> vdsFlat = new ArrayList<>(); - for (List> vdsI : viewDescriptions) + List> vdsFlat = new ArrayList<>(); + for (List> vdsI : viewDescriptions) vdsFlat.addAll( vdsI ); panel.updateViewDescriptions( vdsFlat ); System.out.println( viewDescriptions ); diff --git a/src/main/java/net/preibisch/mvrecon/fiji/spimdata/explorer/registration/RegistrationExplorerPanel.java b/src/main/java/net/preibisch/mvrecon/fiji/spimdata/explorer/registration/RegistrationExplorerPanel.java index 99c51f36a..3a6ef3ac2 100644 --- a/src/main/java/net/preibisch/mvrecon/fiji/spimdata/explorer/registration/RegistrationExplorerPanel.java +++ b/src/main/java/net/preibisch/mvrecon/fiji/spimdata/explorer/registration/RegistrationExplorerPanel.java @@ -77,9 +77,9 @@ public class RegistrationExplorerPanel extends JPanel { private static final long serialVersionUID = -3767947754096099774L; - - final RegistrationExplorer< ?, ? > explorer; - + + final RegistrationExplorer< ? > explorer; + protected JTable table; protected RegistrationTableModel tableModel; protected JLabel label; @@ -89,8 +89,8 @@ public class RegistrationExplorerPanel extends JPanel protected List> lastSelectedVDs; protected ArrayList< ViewTransform > cache; - - public RegistrationExplorerPanel( final ViewRegistrations viewRegistrations, final RegistrationExplorer< ?, ? > explorer ) + + public RegistrationExplorerPanel( final ViewRegistrations viewRegistrations, final RegistrationExplorer< ? > explorer ) { this.cache = new ArrayList< ViewTransform >(); this.explorer = explorer; diff --git a/src/main/java/net/preibisch/mvrecon/fiji/spimdata/imgloaders/DHMImgLoader.java b/src/main/java/net/preibisch/mvrecon/fiji/spimdata/imgloaders/DHMImgLoader.java index a84867e68..bd43ac29d 100644 --- a/src/main/java/net/preibisch/mvrecon/fiji/spimdata/imgloaders/DHMImgLoader.java +++ b/src/main/java/net/preibisch/mvrecon/fiji/spimdata/imgloaders/DHMImgLoader.java @@ -43,7 +43,7 @@ public DHMImgLoader( final String extension, final int ampChannelId, final int phaseChannelId, - final AbstractSequenceDescription< ? extends BasicViewSetup, ? extends BasicViewDescription< ? >, ? > sd ) + final AbstractSequenceDescription< ?, ?, ? > sd ) { super( new LegacyDHMImgLoader( directory, stackDir, amplitudeDir, phaseDir, timepoints, zPlanes, extension, ampChannelId, phaseChannelId, sd ) ); } diff --git a/src/main/java/net/preibisch/mvrecon/fiji/spimdata/imgloaders/LegacyDHMImgLoader.java b/src/main/java/net/preibisch/mvrecon/fiji/spimdata/imgloaders/LegacyDHMImgLoader.java index b1950fdeb..7ee55a99d 100644 --- a/src/main/java/net/preibisch/mvrecon/fiji/spimdata/imgloaders/LegacyDHMImgLoader.java +++ b/src/main/java/net/preibisch/mvrecon/fiji/spimdata/imgloaders/LegacyDHMImgLoader.java @@ -51,7 +51,7 @@ public class LegacyDHMImgLoader extends AbstractImgLoader { final File directory; - final AbstractSequenceDescription< ? extends BasicViewSetup, ? extends BasicViewDescription< ? >, ? > sd; + final AbstractSequenceDescription< ?, ?, ? > sd; final List< String > timepoints; final List< String > zPlanes; final String stackDir; @@ -71,7 +71,7 @@ public LegacyDHMImgLoader( final String extension, final int ampChannelId, final int phaseChannelId, - final AbstractSequenceDescription< ? extends BasicViewSetup, ? extends BasicViewDescription< ? >, ? > sd ) + final AbstractSequenceDescription< ?, ?, ? > sd ) { this.directory = directory; this.stackDir = stackDir; diff --git a/src/main/java/net/preibisch/mvrecon/fiji/spimdata/imgloaders/LegacyMicroManagerImgLoader.java b/src/main/java/net/preibisch/mvrecon/fiji/spimdata/imgloaders/LegacyMicroManagerImgLoader.java index 78a06fdf3..d3f68cb77 100644 --- a/src/main/java/net/preibisch/mvrecon/fiji/spimdata/imgloaders/LegacyMicroManagerImgLoader.java +++ b/src/main/java/net/preibisch/mvrecon/fiji/spimdata/imgloaders/LegacyMicroManagerImgLoader.java @@ -53,11 +53,11 @@ public class LegacyMicroManagerImgLoader extends AbstractImgLoader { final File mmFile; - final AbstractSequenceDescription< ? extends BasicViewSetup, ? extends BasicViewDescription< ? >, ? > sequenceDescription; + final AbstractSequenceDescription< ?, ?, ? > sequenceDescription; public LegacyMicroManagerImgLoader( final File mmFile, - final AbstractSequenceDescription< ? extends BasicViewSetup, ? extends BasicViewDescription< ? >, ? > sequenceDescription ) + final AbstractSequenceDescription< ?, ?, ? > sequenceDescription ) { super(); this.mmFile = mmFile; diff --git a/src/main/java/net/preibisch/mvrecon/fiji/spimdata/imgloaders/MicroManagerImgLoader.java b/src/main/java/net/preibisch/mvrecon/fiji/spimdata/imgloaders/MicroManagerImgLoader.java index 8739523e1..77bf3d6be 100644 --- a/src/main/java/net/preibisch/mvrecon/fiji/spimdata/imgloaders/MicroManagerImgLoader.java +++ b/src/main/java/net/preibisch/mvrecon/fiji/spimdata/imgloaders/MicroManagerImgLoader.java @@ -34,7 +34,7 @@ public class MicroManagerImgLoader extends LegacyImgLoaderWrapper< UnsignedShort { public MicroManagerImgLoader( final File mmFile, - final AbstractSequenceDescription< ? extends BasicViewSetup, ? extends BasicViewDescription< ? >, ? > sequenceDescription ) + final AbstractSequenceDescription< ?, ?, ? > sequenceDescription ) { super( new LegacyMicroManagerImgLoader( mmFile, sequenceDescription ) ); } diff --git a/src/main/java/net/preibisch/mvrecon/headless/splitting/TestSplitting.java b/src/main/java/net/preibisch/mvrecon/headless/splitting/TestSplitting.java index d973cb432..70787f324 100644 --- a/src/main/java/net/preibisch/mvrecon/headless/splitting/TestSplitting.java +++ b/src/main/java/net/preibisch/mvrecon/headless/splitting/TestSplitting.java @@ -60,7 +60,7 @@ public static void main( String[] args ) throws SpimDataException SpimData2 newSD = SplittingTools.splitImages( spimData, new long[] { 30, 30, 10 }, new long[] { 200, 200, 40 } ); // drosophila with 1000 views - final ViewSetupExplorer< SpimData2, XmlIoSpimData2 > explorer = new ViewSetupExplorer( newSD, fileOut, new XmlIoSpimData2( "" ) ); + final ViewSetupExplorer< SpimData2 > explorer = new ViewSetupExplorer<>( newSD, fileOut, new XmlIoSpimData2( "" ) ); explorer.getFrame().toFront(); } diff --git a/src/main/java/net/preibisch/mvrecon/process/deconvolution/util/ProcessInputImages.java b/src/main/java/net/preibisch/mvrecon/process/deconvolution/util/ProcessInputImages.java index 004505b33..f8b1702a3 100644 --- a/src/main/java/net/preibisch/mvrecon/process/deconvolution/util/ProcessInputImages.java +++ b/src/main/java/net/preibisch/mvrecon/process/deconvolution/util/ProcessInputImages.java @@ -66,7 +66,7 @@ public class ProcessInputImages< V extends ViewId > { - final AbstractSpimData< ? extends AbstractSequenceDescription< ? extends BasicViewSetup, ? extends BasicViewDescription< ? >, ? extends BasicImgLoader > > spimData; + final AbstractSpimData< ? > spimData; final ArrayList< Group< V > > groups; final Interval bb; Interval downsampledBB; @@ -81,7 +81,7 @@ public class ProcessInputImages< V extends ViewId > final Map< ? extends ViewId, AffineModel1D > intensityAdjustments; public ProcessInputImages( - final AbstractSpimData< ? extends AbstractSequenceDescription< ? extends BasicViewSetup, ? extends BasicViewDescription< ? >, ? extends BasicImgLoader > > spimData, + final AbstractSpimData< ? > spimData, final Collection< Group< V > > groups, final ExecutorService service, final Interval bb, @@ -116,7 +116,7 @@ public ProcessInputImages( } public ProcessInputImages( - final AbstractSpimData< ? extends AbstractSequenceDescription< ? extends BasicViewSetup, ? extends BasicViewDescription< ? >, ? extends BasicImgLoader > > spimData, + final AbstractSpimData< ? > spimData, final Collection< Group< V > > groups, final ExecutorService service, final Interval bb, @@ -131,7 +131,7 @@ public ProcessInputImages( } public ProcessInputImages( - final AbstractSpimData< ? extends AbstractSequenceDescription< ? extends BasicViewSetup, ? extends BasicViewDescription< ? >, ? extends BasicImgLoader > > spimData, + final AbstractSpimData< ? > spimData, final Collection< Group< V > > groups, final ExecutorService service, final Interval bb, @@ -275,7 +275,7 @@ public static < V extends ViewId > void copyRandomAccessibleInterval( } public static < V extends ViewId > Interval fuseGroups( - final AbstractSpimData< ? extends AbstractSequenceDescription< ? extends BasicViewSetup, ? extends BasicViewDescription< ? >, ? extends BasicImgLoader > > spimData, + final AbstractSpimData< ? > spimData, final HashMap< Group< V >, RandomAccessibleInterval< FloatType > > tImgs, final HashMap< Group< V >, RandomAccessibleInterval< FloatType > > tWeights, final HashMap< V, AffineTransform3D > models, diff --git a/src/main/java/net/preibisch/mvrecon/process/fusion/FusionTools.java b/src/main/java/net/preibisch/mvrecon/process/fusion/FusionTools.java index d00cf694c..1cdca1b86 100644 --- a/src/main/java/net/preibisch/mvrecon/process/fusion/FusionTools.java +++ b/src/main/java/net/preibisch/mvrecon/process/fusion/FusionTools.java @@ -662,7 +662,7 @@ else if ( imgType == ImgDataType.PRECOMPUTED ) * @param border - the target blending border, e.g. 0 * @param transformationModel - the transformation model used to map from the (downsampled) input to the output */ - public static void adjustBlending( final BasicViewDescription< ? extends BasicViewSetup > vd, final float[] blending, final float[] border, final AffineTransform3D transformationModel ) + public static void adjustBlending( final BasicViewDescription< ? > vd, final float[] blending, final float[] border, final AffineTransform3D transformationModel ) { adjustBlending( vd.getViewSetup().getSize(), Group.pvid( vd ), blending, border, transformationModel ); } @@ -691,7 +691,7 @@ public static void adjustBlending( final Dimensions dim, final String name, fina * @param sigma2 - the target sigma2 for entropy approximation, e.g. 40 * @param usedDownsampleFactors - the downsampling factors used to load the input image */ - public static void adjustContentBased( final BasicViewDescription< ? extends BasicViewSetup > vd, final double[] sigma1, final double[] sigma2, final double[] usedDownsampleFactors ) + public static void adjustContentBased( final BasicViewDescription< ? > vd, final double[] sigma1, final double[] sigma2, final double[] usedDownsampleFactors ) { for ( int d = 0; d < sigma1.length; ++d ) { @@ -700,7 +700,7 @@ public static void adjustContentBased( final BasicViewDescription< ? extends Bas } } - public static double getMinRes( final BasicViewDescription< ? extends BasicViewSetup > desc ) + public static double getMinRes( final BasicViewDescription< ? > desc ) { final VoxelDimensions size = ViewSetupUtils.getVoxelSize( desc.getViewSetup() );