Skip to content

Commit

Permalink
Merge pull request #163 from saalfeldlab/dev
Browse files Browse the repository at this point in the history
Bigwarp 9.0.0
  • Loading branch information
bogovicj authored Oct 9, 2023
2 parents 2570d2e + 76f766b commit 8a8befc
Show file tree
Hide file tree
Showing 128 changed files with 22,342 additions and 2,415 deletions.
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,10 @@ hs_err_pid*
/bin/
/target/

# ignore files generated during test
/src/test/resources/bigwarp/url/imgDir3d/img3d0000.tif
/src/test/resources/bigwarp/url/imgDir3d/img3d0001.tif
/src/test/resources/bigwarp/url/imgDir3d/img3d0002.tif
/src/test/resources/bigwarp/url/imgDir3d/img3d0003.tif
/src/test/resources/bigwarp/url/img.tif
/src/test/resources/bigwarp/url/img2d.png
83 changes: 77 additions & 6 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

<groupId>sc.fiji</groupId>
<artifactId>bigwarp_fiji</artifactId>
<version>8.0.1-SNAPSHOT</version>
<version>9.0.0-SNAPSHOT</version>

<name>BigWarp plugin for Fiji</name>
<description>A tool for manual pointwise deformable registration using bigdataviewer.</description>
Expand Down Expand Up @@ -118,16 +118,25 @@
<license.projectName>BigWarp plugin for Fiji.</license.projectName>
<license.excludes>**/resources/*.xml</license.excludes>

<imglib2.version>6.2.0</imglib2.version>
<imglib2-realtransform.version>4.0.1</imglib2-realtransform.version>

<jcommander.version>1.48</jcommander.version>
<alphanumeric-comparator.version>1.4.1</alphanumeric-comparator.version>
<jitk-tps.version>3.0.3</jitk-tps.version>

<!-- NB: Deploy releases to the SciJava Maven repository. -->
<releaseProfiles>sign,deploy-to-scijava</releaseProfiles>

<n5.version>3.0.0</n5.version>
<n5-ij.version>3.2.4</n5-ij.version>
<n5.version>3.0.2</n5.version>
<n5-ij.version>3.2.6</n5-ij.version>
<n5-hdf5.version>2.0.1</n5-hdf5.version>
<n5-aws-s3.version>4.0.1</n5-aws-s3.version>
<n5-google-cloud.version>4.0.0</n5-google-cloud.version>
<n5-imglib2.version>7.0.0</n5-imglib2.version>
<n5-universe.version>1.0.1</n5-universe.version>
<n5-universe.version>1.2.0</n5-universe.version>
<n5-viewer_fiji.version>5.3.1</n5-viewer_fiji.version>
<n5-zarr.version>1.0.1</n5-zarr.version>
<bigdataviewer-core.version>10.4.8</bigdataviewer-core.version>

</properties>
Expand All @@ -145,6 +154,10 @@
<groupId>net.imagej</groupId>
<artifactId>ij</artifactId>
</dependency>
<dependency>
<groupId>net.imagej</groupId>
<artifactId>imagej</artifactId>
</dependency>

<!-- ImgLib2 dependencies -->
<dependency>
Expand Down Expand Up @@ -236,13 +249,27 @@
<groupId>org.janelia.saalfeldlab</groupId>
<artifactId>n5-imglib2</artifactId>
</dependency>
<dependency>
<groupId>org.janelia.saalfeldlab</groupId>
<artifactId>n5-aws-s3</artifactId>
</dependency>
<dependency>
<groupId>org.janelia.saalfeldlab</groupId>
<artifactId>n5-google-cloud</artifactId>
</dependency>
<dependency>
<groupId>org.janelia.saalfeldlab</groupId>
<artifactId>n5-viewer_fiji</artifactId>
</dependency>
<dependency>
<groupId>org.janelia.saalfeldlab</groupId>
<artifactId>n5-zarr</artifactId>
</dependency>
<dependency>
<groupId>org.janelia.saalfeldlab</groupId>
<artifactId>n5-universe</artifactId>
<version>${n5-universe.version}</version>
</dependency>


<!-- OME dependencies -->
<dependency>
<groupId>ome</groupId>
Expand Down Expand Up @@ -306,12 +333,56 @@
<artifactId>alphanumeric-comparator</artifactId>
<version>${alphanumeric-comparator.version}</version>
</dependency>
<dependency>
<groupId>com.formdev</groupId>
<artifactId>flatlaf</artifactId>
</dependency>

<!-- Test scope dependencies -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>xmlunit</groupId>
<artifactId>xmlunit</artifactId>
<version>1.5</version>
</dependency>

</dependencies>

<profiles>
<profile>
<id>default</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<excludes>
<exclude>**/SerializationTest.java</exclude>
</excludes>
</configuration>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>uiTests</id>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
</plugin>
</plugins>
</build>
</profile>
</profiles>

</project>
184 changes: 184 additions & 0 deletions src/main/java/bdv/gui/AutosaveOptionsPanel.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,184 @@
package bdv.gui;

import bigwarp.BigWarp;
import bigwarp.BigWarpAutoSaver;
import java.awt.Container;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.Insets;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
import java.io.File;
import javax.swing.JButton;
import javax.swing.JCheckBox;
import javax.swing.JFileChooser;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JSpinner;
import javax.swing.JSpinner.DefaultEditor;
import javax.swing.JTextField;
import javax.swing.SpinnerNumberModel;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;

public class AutosaveOptionsPanel extends JPanel
{
private static final long serialVersionUID = 2449704984531905538L;

private final BigWarp< ? > bw;

private final SpinnerNumberModel savePeriodModel;
private final JSpinner autoSavePeriodSpinner;
private final JCheckBox doAutoSaveBox;
private final JTextField autoSaveFolderText;

private int lastAutoSaveFreq = 5;
private boolean updating = false;

public AutosaveOptionsPanel( final BigWarp< ? > bw, final Container content )
{
super( new GridBagLayout() );
this.bw = bw;

doAutoSaveBox = new JCheckBox( "Auto-save landmarks" );

final JLabel autoSavePeriodLabel = new JLabel( "Frequency (minutes)" );
autoSavePeriodSpinner = new JSpinner();
savePeriodModel = new SpinnerNumberModel( 0, 0, 0, 1 );
getAutoSavePeriodSpinner().setModel( savePeriodModel );
((DefaultEditor)getAutoSavePeriodSpinner().getEditor()).getTextField().setEditable( false );
((DefaultEditor)getAutoSavePeriodSpinner().getEditor()).getTextField().setEnabled( false );
getAutoSavePeriodSpinner().addChangeListener( new ChangeListener()
{
@Override
public void stateChanged( ChangeEvent e )
{
if ( getDoAutoSaveBox().isSelected() && !updating )
{
long periodMillis = ((Integer) savePeriodModel.getValue()).longValue() * 60000;
BigWarpAutoSaver autoSaver = bw.getAutoSaver();
if ( autoSaver != null )
autoSaver.stop();

bw.setAutoSaver( new BigWarpAutoSaver( bw, periodMillis ));
}
}
} );

getDoAutoSaveBox().addItemListener( new ItemListener()
{
@Override
public void itemStateChanged( ItemEvent e )
{
bw.stopAutosave();
if ( getDoAutoSaveBox().isSelected() )
{
updating = true;
((DefaultEditor)getAutoSavePeriodSpinner().getEditor()).getTextField().setEditable( true );
((DefaultEditor)getAutoSavePeriodSpinner().getEditor()).getTextField().setEnabled( true );
savePeriodModel.setMinimum( 1 );
savePeriodModel.setMaximum( 5000 );
savePeriodModel.setValue( lastAutoSaveFreq );

long periodMillis = ((Integer) savePeriodModel.getValue()).longValue() * 60000;
bw.setAutoSaver( new BigWarpAutoSaver( bw, periodMillis ));
updating = false;
}
else
{
lastAutoSaveFreq = ((Integer) savePeriodModel.getValue());
savePeriodModel.setMinimum( 0 );
savePeriodModel.setMaximum( 0 );
savePeriodModel.setValue( 0 );
((DefaultEditor)getAutoSavePeriodSpinner().getEditor()).getTextField().setEditable( false );
((DefaultEditor)getAutoSavePeriodSpinner().getEditor()).getTextField().setEnabled( false );
}
}
} );

final JLabel destDirLabel = new JLabel( "Directory" );
final File startingFolder = bw.getBigwarpSettingsFolder();
autoSaveFolderText = new JTextField();
getAutoSaveFolderText().setText( startingFolder.getAbsolutePath() );

final JButton browseBtn = new JButton( "Browse" );
browseBtn.addActionListener( e -> {

final JFileChooser fileChooser = new JFileChooser();
fileChooser.setFileSelectionMode( JFileChooser.DIRECTORIES_ONLY );
fileChooser.setCurrentDirectory( startingFolder );

final int ret = fileChooser.showOpenDialog( content );
if ( ret == JFileChooser.APPROVE_OPTION )
{
final File folder = fileChooser.getSelectedFile();
getAutoSaveFolderText().setText( folder.getAbsolutePath() );
bw.getAutoSaver().setAutosaveFolder( folder );
}
} );

final GridBagConstraints gbc = new GridBagConstraints();
gbc.gridx = 1;
gbc.gridy = 0;
gbc.gridwidth = 1;
gbc.gridheight = 1;
gbc.weightx = 1.0;
gbc.anchor = GridBagConstraints.LINE_END;
gbc.fill = GridBagConstraints.NONE;
gbc.insets = new Insets( 5, 5, 5, 5 );

add( getDoAutoSaveBox(), gbc );

gbc.weightx = 1.0;
gbc.gridx = 2;
gbc.gridwidth = 1;
gbc.gridy = 0;
gbc.anchor = GridBagConstraints.LINE_END;
add( autoSavePeriodLabel, gbc );

gbc.gridx = 3;
gbc.gridwidth = 1;
gbc.weightx = 1.0;
gbc.anchor = GridBagConstraints.LINE_START;
gbc.fill = GridBagConstraints.HORIZONTAL;
add( getAutoSavePeriodSpinner(), gbc );

gbc.gridy = 2;
gbc.gridx = 0;
gbc.gridwidth = 1;
gbc.weightx = 0.0;
gbc.anchor = GridBagConstraints.LINE_START;
gbc.fill = GridBagConstraints.NONE;
add( destDirLabel, gbc );

gbc.gridy = 2;
gbc.gridx = 1;
gbc.gridwidth = 3;
gbc.weightx = 1.0;
gbc.anchor = GridBagConstraints.LINE_START;
gbc.fill = GridBagConstraints.HORIZONTAL;
add( getAutoSaveFolderText(), gbc );

gbc.gridx = 4;
gbc.weightx = 0.0;
gbc.anchor = GridBagConstraints.LINE_END;
gbc.fill = GridBagConstraints.NONE;
add( browseBtn, gbc );
}

public JSpinner getAutoSavePeriodSpinner()
{
return autoSavePeriodSpinner;
}

public JCheckBox getDoAutoSaveBox()
{
return doAutoSaveBox;
}

public JTextField getAutoSaveFolderText()
{
return autoSaveFolderText;
}

}
Loading

0 comments on commit 8a8befc

Please sign in to comment.