Skip to content
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

Feat/1.5.0 #549

Merged
merged 47 commits into from
Oct 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
7d7be7a
chore: remove unused files
cmhulbert Aug 14, 2024
49bad3a
fix: don't select `0` label with `next()`
cmhulbert Aug 14, 2024
13a98b9
refactor: Application config directory to use ProjectDirectories; con…
cmhulbert Aug 20, 2024
940cd77
Rename .java to .kt
cmhulbert Aug 20, 2024
8c21643
refactor: Source Opener dialog and logic
cmhulbert Aug 20, 2024
1fc35bd
feat: convenience function to to get N5Writer/Reader/null without exc…
cmhulbert Aug 21, 2024
b117de2
chore: remove old serialization logic
cmhulbert Aug 21, 2024
c25273c
fix: switch tool off main thread, wait for it with SAM
cmhulbert Sep 10, 2024
b416bc2
perf: don't recursively generate biconverters for shape interpolation…
cmhulbert Sep 10, 2024
fb6eb4e
feat: shift click in orthogonal views to trigger auto-SAM in shape in…
cmhulbert Sep 10, 2024
6190f70
refactor: small changes to open source dialog
cmhulbert Sep 11, 2024
ad40676
feat: wip initial crop support
cmhulbert Sep 12, 2024
74d0b91
fix: navigation after saving
cmhulbert Sep 12, 2024
65bbabb
fix: more robust tool switching logic
cmhulbert Sep 20, 2024
f6c6608
refactor: wrap setCurrentLabel
cmhulbert Sep 20, 2024
8d3ad14
feat: predict from click in disabled view; request future embedding f…
cmhulbert Sep 20, 2024
9966db3
refactor: miscellaneous
cmhulbert Sep 20, 2024
c097d14
fix: update multiresolution renderer when increasing number of screen…
cmhulbert Sep 20, 2024
6054a7f
fix: update on source change
cmhulbert Sep 23, 2024
ce28919
refactor: color empty lists as `0`
cmhulbert Sep 23, 2024
54a0541
refactor: fix mesh refresh logic
cmhulbert Sep 23, 2024
8b38005
refactor: listen, don't bind, status property for tools
cmhulbert Sep 23, 2024
769b450
chore: remove dead code
cmhulbert Sep 23, 2024
6b0de65
fix: navigation tool during SI
cmhulbert Sep 23, 2024
12b98ce
fix: disabled view auto-sam point based on click location
cmhulbert Sep 23, 2024
1788f66
refactor: don't use STR interpolation preview, it was removed in newe…
cmhulbert Oct 2, 2024
5abe108
refactor: some safety checks and misc
cmhulbert Oct 2, 2024
d6bfc65
chore: clean unused code
cmhulbert Oct 2, 2024
51e66ca
refactor: improve type compatibility with convenience converter exten…
cmhulbert Oct 2, 2024
a7480ae
feat: parallel forEachBlockExists for iterating over datasets
cmhulbert Oct 2, 2024
d2b077a
feat: add export source functionality
cmhulbert Oct 2, 2024
b1985f8
fix: remove invalid preview features
cmhulbert Oct 2, 2024
c8f1446
refactor: clean up export source logic
cmhulbert Oct 3, 2024
cd8ba28
refactor: don't automatically close window after export source
cmhulbert Oct 8, 2024
19ab92c
feat: toggle to redraw overlays
cmhulbert Oct 8, 2024
885e274
refactor: rename to virtual crop; move logic to metadata config node,…
cmhulbert Oct 8, 2024
2bb0aa8
chore: serialize units, misc
cmhulbert Oct 8, 2024
124ac8e
build: bump label multiset
cmhulbert Oct 8, 2024
d370fda
chore: cleanup some incorrect pom and code commits
cmhulbert Oct 9, 2024
dd122c5
build: windows packaging can't have -SNAPSHOT in version
cmhulbert Oct 9, 2024
e1951bd
fix: small improvements
cmhulbert Oct 10, 2024
dff4a10
perf: memory improvements, especially related to LMT
cmhulbert Oct 10, 2024
d530362
fix: intersect painting, randomTempId
cmhulbert Oct 11, 2024
4664ca4
fix: setting activeTool triggers listeners. Make sure tool is active …
cmhulbert Oct 11, 2024
ce8b1fd
fix: existing slice masks not being provided during `getMask()`
cmhulbert Oct 11, 2024
b804625
fix: commit canvas over integer types handles outOfBounds
cmhulbert Oct 11, 2024
95f13c2
fix: don't hang when trying to Fill3D on non-visible source
cmhulbert Oct 11, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 6 additions & 8 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

<groupId>org.janelia.saalfeldlab</groupId>
<artifactId>paintera</artifactId>
<version>1.4.4-SNAPSHOT</version>
<version>1.5.0-SNAPSHOT</version>

<name>Paintera</name>
<description>New Era Painting and annotation tool</description>
Expand Down Expand Up @@ -68,7 +68,7 @@
<main-class>org.janelia.saalfeldlab.paintera.Paintera</main-class>
<app.name>Paintera</app.name>
<app.package>paintera</app.package>
<app.version>1.4.1</app.version>
<app.version>1.5.0</app.version>

<jvm.modules>javafx.base,javafx.controls,javafx.fxml,javafx.media,javafx.swing,javafx.web,javafx.graphics,java.naming,java.management,java.sql</jvm.modules>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
Expand All @@ -81,7 +81,9 @@
<n5-aws-s3.version>4.2.1</n5-aws-s3.version>
<n5-google-cloud>4.1.1</n5-google-cloud>
<n5-zarr.version>1.3.5</n5-zarr.version>
<imglib2-label-multisets.version>0.15.0</imglib2-label-multisets.version>
<imglib2-label-multisets.version>0.15.1</imglib2-label-multisets.version>
<imglib2.version>6.1.0</imglib2.version>
<imglib2-realtransform.version>4.0.1</imglib2-realtransform.version>

<maven-compiler-plugin.version>3.13.0</maven-compiler-plugin.version>
<enforcer.skip>true</enforcer.skip>
Expand Down Expand Up @@ -185,7 +187,6 @@
<dependency>
<groupId>net.imglib2</groupId>
<artifactId>imglib2</artifactId>
<version>6.1.0</version>
</dependency>
<dependency>
<groupId>net.imglib2</groupId>
Expand All @@ -194,7 +195,6 @@
<dependency>
<groupId>net.imglib2</groupId>
<artifactId>imglib2-realtransform</artifactId>
<version>4.0.1</version>
</dependency>
<dependency>
<groupId>net.imglib2</groupId>
Expand Down Expand Up @@ -687,7 +687,7 @@
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<forkCount>1</forkCount>
<argLine>-Dtestfx.robot=glass -Dglass.platform=Monocle -Dmonocle.platform=Headless -Dprism.order=sw --enable-preview</argLine>
<argLine>-Dtestfx.robot=glass -Dglass.platform=Monocle -Dmonocle.platform=Headless -Dprism.order=sw</argLine>
</configuration>
</plugin>
</plugins>
Expand All @@ -709,7 +709,6 @@
</annotationProcessors>
<source>21</source>
<target>21</target>
<compilerArgs>--enable-preview</compilerArgs>
</configuration>
</plugin>
<plugin>
Expand Down Expand Up @@ -919,7 +918,6 @@
<version>${kotlin.version}</version>
<configuration>
<javacOptions>
<javacOption>--enable-preview</javacOption>
</javacOptions>
</configuration>
</plugin>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ public interface ImageGenerator<T> {
/**
* @param display The canvas that will display the images we render.
* @param painterThread Thread that triggers repainting of the display. Requests for repainting are send there.
* @param screenScales Scale factors from the viewer canvas to screen images of different resolutions. A scale factor of 1 means 1
* @param initialScreenScales Scale factors from the viewer canvas to screen images of different resolutions. A scale factor of 1 means 1
* pixel in the screen image is displayed as 1 pixel on the canvas, a scale factor of 0.5 means 1 pixel in the
* screen image is displayed as 2 pixel on the canvas, etc.
* @param targetRenderNanos Target rendering time in nanoseconds. The rendering time for the coarsest rendered scale should be below
Expand All @@ -271,7 +271,7 @@ public interface ImageGenerator<T> {
MultiResolutionRendererGeneric(
final TransformAwareRenderTargetGeneric<T> display,
final PainterThreadFx painterThread,
final double[] screenScales,
final double[] initialScreenScales,
final long targetRenderNanos,
final boolean doubleBuffered,
final TaskExecutor renderingTaskExecutor,
Expand All @@ -287,7 +287,7 @@ public interface ImageGenerator<T> {
this.painterThread = painterThread;
projector = null;
currentScreenScaleIndex = -1;
this.screenScales = screenScales.clone();
this.screenScales = initialScreenScales.clone();
this.doubleBuffered = doubleBuffered;
createVariables();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,10 @@ public void requestRepaint(final RealInterval intervalInGlobalSpace) {
this.applyToAll(v -> v.requestRepaint(intervalInGlobalSpace));
}

public void drawOverlays() {
applyToAll(it -> it.getDisplay().drawOverlays());
}

/**
* {@link ViewerPanelFX#setAllSources(Collection)}} for all {@link ViewerPanelFX viewer children} (top left, top right, bottom left)
*
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package org.janelia.saalfeldlab.paintera;

import com.pivovarit.function.ThrowingSupplier;
import org.janelia.saalfeldlab.paintera.config.PainteraDirectoriesConfig;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.yaml.snakeyaml.Yaml;
Expand All @@ -14,50 +15,63 @@
import java.nio.file.Paths;
import java.util.HashMap;
import java.util.Map;
import java.util.function.Function;
import java.util.function.Supplier;

public class PainteraConfigYaml {

private static final Logger LOG = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());

private static final String USER_HOME = System.getProperty("user.home");
private static final String PAINTERA_YAML = "paintera.yml";

private static final Path PAINTERA_YAML = Paths.get(USER_HOME, ".config", "paintera.yml");
public static <T> T getConfig(final Supplier<T> fallBack, final String... segments) {

public static Object getConfig(final Supplier<Object> fallBack, final String... segments) {

Object currentConfig = getConfig();
for (final String segment : segments) {
if (!(currentConfig instanceof Map<?, ?>))
return fallBack.get();
final Map<?, ?> map = (Map<?, ?>)currentConfig;
if (!map.containsKey(segment))
Map<?, ?> currentConfig = getConfig();

final Function<Object, T> getOrFallback = (config) -> {
try {
return (T) config;
} catch (ClassCastException e) {
return fallBack.get();
currentConfig = map.get(segment);
}
};

for (int i = 0; i < segments.length; i++) {
final String segment = segments[i];
if (currentConfig.containsKey(segment)) {
final Object config = currentConfig.get(segment);
if (i == segments.length - 1)
return getOrFallback.apply(config);
if (config instanceof Map<?, ?>)
currentConfig = (Map<?, ?>) config;
else
return fallBack.get();
}
}
return currentConfig;
return fallBack.get();
}

// TODO should this return copy?
public static Map<?, ?> getConfig() {

return CONFIG;
String appConfigDir;
try {
appConfigDir = Paintera.getPaintera().getProperties().getPainteraDirectoriesConfig().getAppConfigDir();
} catch (Exception e) {
appConfigDir = PainteraDirectoriesConfig.APPLICATION_DIRECTORIES.configDir;
}
return readConfigUnchecked(Paths.get(appConfigDir, PAINTERA_YAML));
}

private static final Map<?, ?> CONFIG = readConfigUnchecked();

private static Map<?, ?> readConfigUnchecked() {

return ThrowingSupplier.unchecked(PainteraConfigYaml::readConfig).get();
}
private static Map<?, ?> readConfigUnchecked(Path painteraYaml) {
return ThrowingSupplier.unchecked(() -> readConfig(painteraYaml)).get();
};

private static Map<?, ?> readConfig() throws IOException {
private static Map<?, ?> readConfig(Path painteraYaml) throws IOException {

final Yaml yaml = new Yaml();
try (final InputStream fis = new FileInputStream(PAINTERA_YAML.toFile())) {
// TODO is this cast always safe?
// TODO make this type safe, maybe create config class
final Map<?, ?> data = (Map<?, ?>)yaml.load(fis);
try (final InputStream fis = new FileInputStream(painteraYaml.toFile())) {
final Map<?, ?> data = yaml.load(fis);
LOG.debug("Loaded paintera info: {}", data);
return data;
} catch (final FileNotFoundException e) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ public enum MenuActionType implements ActionType {
LoadProject,
DetachViewer,

OpenProject;
OpenProject,
ExportSource;

public static EnumSet<MenuActionType> of(final MenuActionType first, final MenuActionType... rest) {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@

import java.util.function.Consumer;

import static java.util.FormatProcessor.FMT;

public class CoordinateDisplayListener {

private final ViewerPanelFX viewer;
Expand Down Expand Up @@ -93,7 +91,7 @@ public static String realPointToString(final RealPoint p) {
final double d0 = p.getDoublePosition(0);
final double d1 = p.getDoublePosition(1);
final double d2 = p.getDoublePosition(2);
return FMT."(%8.3f\{d0}, %8.3f\{d1}, %8.3f\{d2})";
return String.format("(%8.3f, %8.3f, %8.3f)", d0, d1, d2);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -40,23 +40,32 @@ public void translate(final double dX, final double dY, final double dZ, final D

manager.getTransform(globalTransform);
globalToViewerTransformListener.getTransformCopy(globalToViewerTransform);
/* undo global transform, left with only scale, rotation, translation in viewer space */
globalToViewerTransform.concatenate(globalTransform.inverse());
globalToViewerTransform.setTranslation(0.0, 0.0, 0.0);


delta[0] = dX;
delta[1] = dY;
delta[2] = dZ;

globalToViewerTransform.applyInverse(delta, delta);
globalTransform.translate(delta);
translateFromViewer(globalTransform, globalToViewerTransform, delta);

manager.setTransform(globalTransform, duration != null ? duration : Duration.ZERO);
}

}

public static void translateFromViewer(
final AffineTransform3D globalTransform,
final AffineTransform3D globalToViewerTransform,
final double[] delta
) {

/* undo global transform, left with only scale, rotation, translation in viewer space */
globalToViewerTransform.concatenate(globalTransform.inverse());
globalToViewerTransform.setTranslation(0.0, 0.0, 0.0);

globalToViewerTransform.applyInverse(delta, delta);
globalTransform.translate(delta);
}

/*TODO: Move this to somewhere else*/
public static final class TransformTracker implements TransformListener<AffineTransform3D> {

Expand Down
Loading
Loading