Skip to content

Commit 5274aec

Browse files
committed
script name changes and fix for script location
1 parent 409181d commit 5274aec

5 files changed

Lines changed: 11 additions & 60 deletions

File tree

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ plugins {
88

99
repositories {
1010
// Use this only for local development!
11-
// mavenLocal()
11+
mavenLocal()
1212
mavenCentral()
1313

1414
maven{

src/main/java/qupath/ext/imagecombinerwarpy/ImageCombinerWarpyExtension.java

Lines changed: 2 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,4 @@
1-
/*-
2-
* #%L
3-
* This file is part of QuPath.
4-
* %%
5-
* Copyright (C) 2018 - 2020 QuPath developers, The University of Edinburgh
6-
* %%
7-
* QuPath is free software: you can redistribute it and/or modify
8-
* it under the terms of the GNU General Public License as
9-
* published by the Free Software Foundation, either version 3 of the
10-
* License, or (at your option) any later version.
11-
*
12-
* QuPath is distributed in the hope that it will be useful,
13-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
14-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15-
* GNU General Public License for more details.
16-
*
17-
* You should have received a copy of the GNU General Public License
18-
* along with QuPath. If not, see <https://www.gnu.org/licenses/>.
19-
* #L%
20-
*/
1+
package qupath.ext.imagecombinerwarpy;
212

223
/*********************************
234
* This file is part of ImageCombinerWarpy ...
@@ -34,10 +15,8 @@
3415
* Peter Haub (@phaub), Oct 2021
3516
*
3617
*********************************/
37-
package qupath.ext.imagecombinerwarpy;
3818

3919
import net.imglib2.realtransform.RealTransformSerializer;
40-
import org.controlsfx.control.action.Action;
4120
import org.slf4j.Logger;
4221
import org.slf4j.LoggerFactory;
4322

@@ -55,10 +34,6 @@
5534
import qupath.lib.io.GsonTools;
5635
import qupath.lib.io.GsonTools.SubTypeAdapterFactory;
5736

58-
import java.io.InputStream;
59-
import java.nio.charset.StandardCharsets;
60-
import java.util.LinkedHashMap;
61-
6237
/**
6338
* Extension to make more experimental commands present in the GUI.
6439
*/
@@ -70,10 +45,6 @@ public class ImageCombinerWarpyExtension implements QuPathExtension, GitHubProje
7045

7146
private static final Version minimumVersion = Version.parse("0.3.0-SNAPSHOT");
7247

73-
private static final LinkedHashMap<String, String> SCRIPTS = new LinkedHashMap<>() {{
74-
put("Warpy transfer annotations and detections to current entry", "scripts/Warpy_transfer_annotations_and_detections_to_current_entry.groovy");
75-
put("Warpy transfer TMA to current entry", "scripts/Warpy_transfer_TMA_to_current_entry.groovy");
76-
}};
7748
@Override
7849
public void installExtension(QuPathGUI qupath) {
7950
if (alreadyInstalled || !checkCompatibility())
@@ -97,20 +68,6 @@ public void installExtension(QuPathGUI qupath) {
9768
MenuTools.addMenuItems(qupath.getMenu("Analyze", false),
9869
imageCombinerWarpy);
9970

100-
SCRIPTS.entrySet().forEach(entry -> {
101-
String name = entry.getValue();
102-
String command = entry.getKey();
103-
try (InputStream stream = ImageCombinerWarpyExtension.class.getClassLoader().getResourceAsStream(name)) {
104-
String script = new String(stream.readAllBytes(), StandardCharsets.UTF_8);
105-
if (script != null) {
106-
MenuTools.addMenuItems(
107-
qupath.getMenu("Extensions>Cellpose", true),
108-
new Action(command, e -> openScript(qupath, script)));
109-
}
110-
} catch (Exception e) {
111-
logger.error(e.getLocalizedMessage(), e);
112-
}
113-
});
11471
alreadyInstalled = true;
11572

11673
} catch (Throwable t) {
@@ -160,14 +117,4 @@ public GitHubRepo getRepository() {
160117
public Version getQuPathVersion() {
161118
return QuPathExtension.super.getQuPathVersion();
162119
}
163-
164-
private static void openScript(QuPathGUI qupath, String script) {
165-
var editor = qupath.getScriptEditor();
166-
if (editor == null) {
167-
logger.error("No script editor is available!");
168-
return;
169-
}
170-
qupath.getScriptEditor().showScript("Warpy", script);
171-
}
172-
173-
}
120+
}

src/main/java/qupath/ext/warpy/WarpyExtension.java

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,13 @@ public class WarpyExtension implements QuPathExtension, GitHubProject {
2626
private boolean isInstalled = false;
2727

2828
private static final Map<String, String> SCRIPTS = Map.of(
29-
"Warpy transfer annotations and detections to current entry", "scripts/Warpy_transfer_annotations_and_detections_to_current_entry.groovy",
30-
"Warpy transfer TMAs to current entry", "scripts/Warpy_transfer_TMA_to_current_entry.groovy"
29+
"Warpy transfer annotations and detections to current entry", "scripts/Transfer_annotations_and_detections_to_current_entry.groovy",
30+
"Warpy transfer TMAs to current entry", "scripts/Transfer_TMA_to_current_entry.groovy"
3131
);
3232

3333
@Override
3434
public GitHubRepo getRepository() {
35-
return GitHubRepo.create("QuPath Warpy Extension", "biop", "qupath-extension-warpy");
35+
return GitHubRepo.create("Warpy Extension", "biop", "qupath-extension-warpy");
3636
}
3737

3838
@Override
@@ -50,6 +50,9 @@ public void installExtension(QuPathGUI qupath) {
5050
qupath.getMenu("Extensions>Warpy", true),
5151
new Action(command, e -> openScript(qupath, script)));
5252
}
53+
54+
isInstalled = true;
55+
5356
} catch (Exception e) {
5457
logger.error(e.getLocalizedMessage(), e);
5558
}
@@ -77,6 +80,7 @@ public static String getWarpyVersion() {
7780
return Version.parse(packageVersion).toString();
7881
}
7982

83+
8084
private static void openScript(QuPathGUI qupath, String script) {
8185
var editor = qupath.getScriptEditor();
8286
if (editor == null) {
@@ -85,4 +89,4 @@ private static void openScript(QuPathGUI qupath, String script) {
8589
}
8690
qupath.getScriptEditor().showScript("Warpy", script);
8791
}
88-
}
92+
}

src/main/resources/scripts/Warpy_transfer_TMA_to_current_entry.groovy renamed to src/main/resources/scripts/Transfer_TMA_to_current_entry.groovy

File renamed without changes.

src/main/resources/scripts/Warpy_transfer_annotations_and_detections_to_current_entry.groovy renamed to src/main/resources/scripts/Transfer_annotations_and_detections_to_current_entry.groovy

File renamed without changes.

0 commit comments

Comments
 (0)