-
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
Closed
Closed
Changes from all commits
Commits
Show all changes
29 commits
Select commit
Hold shift + click to select a range
adf9b61
create panel
mzouink 25d1b64
add button
mzouink 28ef43f
movie producer view
mzouink f5927ec
add ij dependency
mzouink c627208
add VNCMovie from hotknife
mzouink 3890a77
adjust view
mzouink bc9fa1e
video export
mzouink 8e375ff
fix translation problem
mzouink f811191
clean
mzouink 93a0d61
use movie frame instance
mzouink b736d15
export pngs
mzouink 9477d0d
organize
mzouink 54f6565
add dependency gson
mzouink 7de17db
save json and import json
mzouink 2e30ea6
accel field
mzouink 74f40eb
frame snapshot import
mzouink 3336e0b
working on preview
mzouink 5a0e002
preview works
mzouink b60dbc3
preview with pause, restart and sleep, downsampling params
mzouink 659adfc
fix player stop
mzouink 25558ee
update view
mzouink 297b07d
fix
mzouink f4b97d9
Readme
mzouink 1d10dbf
add install
mzouink 40a6143
update readme
mzouink d8cd717
Update README.md
mzouink d7c07ce
Merge branch 'bigdataviewer:master' into master
mzouink 3173a1b
pull from main bdv repo
mzouink 39b11f4
Merge branch 'bigdataviewer-master'
mzouink File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,32 @@ | ||
# 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` | ||
======= | ||
[![developer chat](https://img.shields.io/badge/zulip-join_chat-brightgreen.svg)](https://imagesc.zulipchat.com/#narrow/stream/327326-BigDataViewer) | ||
|
||
ImgLib2-based viewer for registered SPIM stacks and more | ||
|
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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." |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -149,6 +149,10 @@ | |
</repositories> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>net.imagej</groupId> | ||
<artifactId>ij</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>net.imglib2</groupId> | ||
<artifactId>imglib2</artifactId> | ||
|
@@ -197,6 +201,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> | ||
<dependency> | ||
<groupId>com.formdev</groupId> | ||
<artifactId>flatlaf</artifactId> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
package bdv.tools.movie; | ||
|
||
import net.imglib2.realtransform.AffineTransform3D; | ||
|
||
import java.io.Serializable; | ||
|
||
public class MovieFrame implements Serializable { | ||
private AffineTransform3D transform; | ||
|
||
private int position; | ||
private int frames; | ||
private int accel; | ||
private final static int DEFAULT_FRAMES = 120; | ||
private final static int DEFAULT_ACCEL = 0; | ||
|
||
|
||
public MovieFrame(int position, AffineTransform3D transform) { | ||
this(position, transform, ((position == 0) ? 0 : DEFAULT_FRAMES), ((position == 0) ? 0 : DEFAULT_ACCEL)); | ||
} | ||
|
||
public MovieFrame(int position, AffineTransform3D transform, int frames, int accel) { | ||
this.position = position; | ||
this.transform = transform; | ||
this.frames = frames; | ||
this.accel = accel; | ||
} | ||
|
||
public AffineTransform3D getTransform() { | ||
return transform; | ||
} | ||
|
||
public void setTransform(AffineTransform3D transform) { | ||
this.transform = transform; | ||
} | ||
|
||
public int getPosition() { | ||
return position; | ||
} | ||
|
||
public void setPosition(int position) { | ||
this.position = position; | ||
} | ||
|
||
public int getFrames() { | ||
return frames; | ||
} | ||
|
||
public void setFrames(int frames) { | ||
this.frames = frames; | ||
} | ||
|
||
public int getAccel() { | ||
return accel; | ||
} | ||
|
||
public void setAccel(int accel) { | ||
this.accel = accel; | ||
} | ||
|
||
public static int getDefaultFrames() { | ||
return DEFAULT_FRAMES; | ||
} | ||
|
||
public static int getDefaultAccel() { | ||
return DEFAULT_ACCEL; | ||
} | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.