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 ...
3415 * Peter Haub (@phaub), Oct 2021
3516 *
3617 *********************************/
37- package qupath .ext .imagecombinerwarpy ;
3818
3919import net .imglib2 .realtransform .RealTransformSerializer ;
40- import org .controlsfx .control .action .Action ;
4120import org .slf4j .Logger ;
4221import org .slf4j .LoggerFactory ;
4322
5534import qupath .lib .io .GsonTools ;
5635import 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+ }
0 commit comments