-
Notifications
You must be signed in to change notification settings - Fork 37
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Video producer tool using benchmarks in BDV #136
Changes from 27 commits
adf9b61
25d1b64
28ef43f
f5927ec
c627208
3890a77
bc9fa1e
8e375ff
f811191
93a0d61
b736d15
9477d0d
54f6565
7de17db
2e30ea6
74f40eb
3336e0b
5a0e002
b60dbc3
659adfc
25558ee
297b07d
f4b97d9
1d10dbf
40a6143
d8cd717
d7c07ce
3173a1b
39b11f4
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,25 @@ | ||
# bigdataviewer-core | ||
[![](https://api.github.com/bigdataviewer/bigdataviewer-core/actions/workflows/build-main.yml/badge.svg)](https://github.com/bigdataviewer/bigdataviewer-core/actions/workflows/build-main.yml) | ||
[![Join the chat at https://gitter.im/bigdataviewer/bigdataviewer-core](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/bigdataviewer/bigdataviewer-core?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) ImgLib2-based viewer for registered SPIM stacks and more | ||
--- | ||
Feature added in this fork: **Interactive Video producing using Spline interpolation** | ||
|
||
### Install: | ||
`$ ./install.sh` | ||
|
||
### Run: | ||
`$ ./bdv INPUT_PATH` | ||
|
||
### How to use: | ||
|
||
1- **Video producer panel** can be opened by clicking `F7` or via `Tools -> Produce Movie` | ||
![](img/1.png) | ||
|
||
2- By opening Video Producer you get this panel | ||
![](img/2.png) | ||
- `+` To add current frame | ||
- `-` To delete last frame | ||
- Preview with a frame down-sampling and sleep time between frames | ||
- Accel: you select the interpolation: `Slow start` , `slow end` , `Symmetric` ... | ||
- Export: Can be in `Json` or `PNG sequence` | ||
- Import saved `Json` |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
#!/bin/bash | ||
|
||
# This script is shamelessly adapted from https://github.com/saalfeldlab/n5-utils, thanks @axtimwalde & co! | ||
|
||
VERSION="10.3.2-SNAPSHOT" | ||
INSTALL_DIR=${1:-$(pwd)} | ||
|
||
echo "" | ||
echo "Installing into $INSTALL_DIR" | ||
|
||
# check for operating system | ||
if [[ "$OSTYPE" == "linux-gnu" ]]; then | ||
echo "Assuming on Linux operating system" | ||
MEM=$(cat /proc/meminfo | grep MemTotal | sed s/^MemTotal:\\\s*\\\|\\\s\\+[^\\\s]*$//g) | ||
MEMGB=$(($MEM/1024/1024)) | ||
MEM=$((($MEMGB/5)*4)) | ||
elif [[ "$OSTYPE" == "darwin"* ]]; then | ||
echo "Assuming on MacOS X operating system" | ||
# sysctl returns total hardware memory size in bytes | ||
MEM=$(sysctl hw.memsize | grep hw.memsize | sed s/hw.memsize://g) | ||
MEMGB=$(($MEM/1024/1024/1024)) | ||
MEM=$((($MEMGB/5)*4)) | ||
else | ||
echo "ERROR - Operating system (arg2) must be either linux or osx - EXITING (on windows please run as a normal Java class from e.g. Eclipse)" | ||
exit | ||
fi | ||
|
||
echo "Available memory:" $MEMGB "GB, setting Java memory limit to" $MEM "GB" | ||
|
||
mvn clean install | ||
mvn -Dmdep.outputFile=cp.txt -Dmdep.includeScope=runtime dependency:build-classpath | ||
|
||
echo "" | ||
echo "Installing 'bdv' command into" $INSTALL_DIR | ||
|
||
echo '#!/bin/bash' > bdv | ||
echo '' >> bdv | ||
echo "JAR=\$HOME/.m2/repository/sc/fiji/bigdataviewer-core/${VERSION}/bigdataviewer-core-${VERSION}.jar" >> bdv | ||
echo 'java \' >> bdv | ||
echo " -Xmx${MEM}g \\" >> bdv | ||
echo ' -XX:+UseConcMarkSweepGC \' >> bdv | ||
echo -n ' -cp $JAR:' >> bdv | ||
echo -n $(cat cp.txt) >> bdv | ||
echo ' \' >> bdv | ||
echo ' bdv.BigDataViewer "$@"' >> bdv | ||
|
||
|
||
chmod a+x bdv | ||
|
||
if [ $(pwd) == "$INSTALL_DIR" ]; then | ||
echo "Installation directory equals current directory, we are done." | ||
else | ||
echo "Creating directory $INSTALL_DIR and moving files..." | ||
mkdir -p $INSTALL_DIR | ||
mv bdv $INSTALL_DIR/ | ||
fi | ||
|
||
rm cp.txt | ||
|
||
echo "Installation finished." |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -150,6 +150,10 @@ | |
</repositories> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>net.imagej</groupId> | ||
<artifactId>ij</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>net.imglib2</groupId> | ||
<artifactId>imglib2</artifactId> | ||
|
@@ -198,6 +202,11 @@ | |
<groupId>com.miglayout</groupId> | ||
<artifactId>miglayout-swing</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>com.google.code.gson</groupId> | ||
<artifactId>gson</artifactId> | ||
<version>2.8.5</version> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could we make the version a property? Any reason not to use 2.8.6 like in parent POM? |
||
</dependency> | ||
|
||
<!-- test dependencies --> | ||
<dependency> | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -28,41 +28,6 @@ | |
*/ | ||
package bdv; | ||
|
||
import bdv.viewer.ConverterSetups; | ||
import bdv.viewer.ViewerState; | ||
import java.io.File; | ||
import java.io.FileNotFoundException; | ||
import java.io.FileWriter; | ||
import java.io.IOException; | ||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
import javax.swing.ActionMap; | ||
import javax.swing.JFileChooser; | ||
import javax.swing.JMenu; | ||
import javax.swing.JMenuBar; | ||
import javax.swing.JMenuItem; | ||
import javax.swing.filechooser.FileFilter; | ||
|
||
import net.imglib2.Volatile; | ||
import net.imglib2.converter.Converter; | ||
import net.imglib2.display.ColorConverter; | ||
import net.imglib2.display.RealARGBColorConverter; | ||
import net.imglib2.display.ScaledARGBConverter; | ||
import net.imglib2.type.numeric.ARGBType; | ||
import net.imglib2.type.numeric.NumericType; | ||
import net.imglib2.type.numeric.RealType; | ||
import net.imglib2.type.volatiles.VolatileARGBType; | ||
|
||
import org.jdom2.Document; | ||
import org.jdom2.Element; | ||
import org.jdom2.JDOMException; | ||
import org.jdom2.input.SAXBuilder; | ||
import org.jdom2.output.Format; | ||
import org.jdom2.output.XMLOutputter; | ||
import org.scijava.ui.behaviour.io.InputTriggerConfig; | ||
import org.scijava.ui.behaviour.io.yaml.YamlConfigIO; | ||
|
||
import bdv.cache.CacheControl; | ||
import bdv.export.ProgressWriter; | ||
import bdv.export.ProgressWriterConsole; | ||
|
@@ -82,22 +47,51 @@ | |
import bdv.tools.brightness.RealARGBColorConverterSetup; | ||
import bdv.tools.brightness.SetupAssignments; | ||
import bdv.tools.crop.CropDialog; | ||
import bdv.tools.movie.ProduceMovieDialog; | ||
import bdv.tools.transformation.ManualTransformation; | ||
import bdv.tools.transformation.ManualTransformationEditor; | ||
import bdv.tools.transformation.TransformedSource; | ||
import bdv.viewer.ConverterSetups; | ||
import bdv.viewer.NavigationActions; | ||
import bdv.viewer.SourceAndConverter; | ||
import bdv.viewer.ViewerFrame; | ||
import bdv.viewer.ViewerOptions; | ||
import bdv.viewer.ViewerPanel; | ||
import bdv.viewer.ViewerState; | ||
import mpicbg.spim.data.SpimDataException; | ||
import mpicbg.spim.data.generic.AbstractSpimData; | ||
import mpicbg.spim.data.generic.sequence.AbstractSequenceDescription; | ||
import mpicbg.spim.data.generic.sequence.BasicViewSetup; | ||
import mpicbg.spim.data.sequence.Angle; | ||
import mpicbg.spim.data.sequence.Channel; | ||
import net.imglib2.Volatile; | ||
import net.imglib2.converter.Converter; | ||
import net.imglib2.display.ColorConverter; | ||
import net.imglib2.display.RealARGBColorConverter; | ||
import net.imglib2.display.ScaledARGBConverter; | ||
import net.imglib2.type.numeric.ARGBType; | ||
import net.imglib2.type.numeric.NumericType; | ||
import net.imglib2.type.numeric.RealType; | ||
import net.imglib2.type.volatiles.VolatileARGBType; | ||
import org.jdom2.Document; | ||
import org.jdom2.Element; | ||
import org.jdom2.JDOMException; | ||
import org.jdom2.input.SAXBuilder; | ||
import org.jdom2.output.Format; | ||
import org.jdom2.output.XMLOutputter; | ||
import org.scijava.ui.behaviour.io.InputTriggerConfig; | ||
import org.scijava.ui.behaviour.io.yaml.YamlConfigIO; | ||
import org.scijava.ui.behaviour.util.Actions; | ||
|
||
import javax.swing.*; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Are we doing wildcards in the imports now? |
||
import javax.swing.filechooser.FileFilter; | ||
import java.io.File; | ||
import java.io.FileNotFoundException; | ||
import java.io.FileWriter; | ||
import java.io.IOException; | ||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
public class BigDataViewer | ||
{ | ||
protected final ViewerFrame viewerFrame; | ||
|
@@ -116,6 +110,8 @@ public class BigDataViewer | |
|
||
protected final RecordMovieDialog movieDialog; | ||
|
||
protected final ProduceMovieDialog produceMovieDialog; | ||
|
||
protected final RecordMaxProjectionDialog movieMaxProjectDialog; | ||
|
||
protected final VisibilityAndGroupingDialog activeSourcesDialog; | ||
|
@@ -373,6 +369,8 @@ public BigDataViewer( | |
cropDialog = ( spimData == null ) ? null : new CropDialog( viewerFrame, viewer, spimData.getSequenceDescription() ); | ||
|
||
movieDialog = new RecordMovieDialog( viewerFrame, viewer, progressWriter ); | ||
|
||
produceMovieDialog = new ProduceMovieDialog( viewerFrame, viewer, progressWriter ); | ||
// this is just to get updates of window size: | ||
viewer.getDisplay().overlays().add( movieDialog ); | ||
|
||
|
@@ -458,6 +456,10 @@ public boolean accept( final File f ) | |
miMovie.setText( "Record Movie" ); | ||
menu.add( miMovie ); | ||
|
||
final JMenuItem miMovieProducer = new JMenuItem( actionMap.get( BigDataViewerActions.PRODUCE_MOVIE ) ); | ||
miMovieProducer.setText( "Produce Movie" ); | ||
menu.add( miMovieProducer ); | ||
|
||
final JMenuItem miMaxProjectMovie = new JMenuItem( actionMap.get( BigDataViewerActions.RECORD_MAX_PROJECTION_MOVIE ) ); | ||
miMaxProjectMovie.setText( "Record Max-Projection Movie" ); | ||
menu.add( miMaxProjectMovie ); | ||
|
@@ -744,18 +746,25 @@ public static void main( final String[] args ) | |
// final String fn = "/Users/pietzsch/Desktop/data/fibsem-remote.xml"; | ||
// final String fn = "/Users/pietzsch/Desktop/url-valia.xml"; | ||
// final String fn = "/Users/pietzsch/Desktop/data/clusterValia/140219-1/valia-140219-1.xml"; | ||
final String fn = "/Users/pietzsch/workspace/data/111010_weber_full.xml"; | ||
// final String fn = "/Users/pietzsch/workspace/data/111010_weber_full.xml"; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should we keep this for @tpietzsch ? |
||
// final String fn = "/Volumes/projects/tomancak_lightsheet/Mette/ZeissZ1SPIM/Maritigrella/021013_McH2BsGFP_CAAX-mCherry/11-use/hdf5/021013_McH2BsGFP_CAAX-mCherry-11-use.xml"; | ||
|
||
// final String fn = "/Users/Marwan/Downloads/drosophila_his-yfp/dataset.xml"; | ||
|
||
try | ||
{ | ||
final String fn = args[0]; | ||
System.setProperty( "apple.laf.useScreenMenuBar", "true" ); | ||
|
||
final BigDataViewer bdv = open( fn, new File( fn ).getName(), new ProgressWriterConsole(), ViewerOptions.options() ); | ||
|
||
// PanelSnapshot.showPanel(bdv.getViewer()); | ||
// DumpInputConfig.writeToYaml( System.getProperty( "user.home" ) + "/.bdv/bdvkeyconfig.yaml", bdv.getViewerFrame() ); | ||
} | ||
catch ( final Exception e ) | ||
{ | ||
if (args.length==0) | ||
System.out.println("Please specify the input"); | ||
e.printStackTrace(); | ||
} | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
package bdv.tools.movie; | ||
|
||
import javax.swing.*; | ||
import java.awt.*; | ||
Comment on lines
+3
to
+4
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Wildcards? |
||
import java.awt.image.BufferedImage; | ||
|
||
public class ImagePanel extends JPanel { | ||
private final BufferedImage image; | ||
|
||
public ImagePanel(BufferedImage image) { | ||
super(); | ||
setPreferredSize(new Dimension(90, 90)); | ||
this.image = scale(image, 90, 90); | ||
} | ||
|
||
public static ImagePanel snapshotOf(JPanel panel) { | ||
return new ImagePanel(takeSnapShot(panel)); | ||
} | ||
|
||
@Override | ||
protected void paintComponent(Graphics g) { | ||
super.paintComponent(g); | ||
g.drawImage(image, 0, 0, this); | ||
} | ||
|
||
public static BufferedImage scale(BufferedImage src, int w, int h) { | ||
BufferedImage img = new BufferedImage(w, h, BufferedImage.TYPE_INT_RGB); | ||
int x, y; | ||
int ww = src.getWidth(); | ||
int hh = src.getHeight(); | ||
int[] ys = new int[h]; | ||
for (y = 0; y < h; y++) | ||
ys[y] = y * hh / h; | ||
for (x = 0; x < w; x++) { | ||
int newX = x * ww / w; | ||
for (y = 0; y < h; y++) { | ||
int col = src.getRGB(newX, ys[y]); | ||
img.setRGB(x, y, col); | ||
} | ||
} | ||
return img; | ||
} | ||
|
||
public static BufferedImage takeSnapShot(JPanel panel){ | ||
BufferedImage bufImage = new BufferedImage(panel.getSize().width, panel.getSize().height,BufferedImage.TYPE_INT_RGB); | ||
panel.paint(bufImage.createGraphics()); | ||
return bufImage; | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mention Windows install instructions or recommend WSL2.