-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
251 additions
and
9 deletions.
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
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
89 changes: 89 additions & 0 deletions
89
src/main/java/org/embl/mobie/ui/StringArraySelectorDialog.java
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,89 @@ | ||
package org.embl.mobie.ui; | ||
|
||
import org.embl.mobie.MoBIE; | ||
import org.embl.mobie.lib.io.FileLocation; | ||
import org.embl.mobie.lib.serialize.View; | ||
import org.jetbrains.annotations.NotNull; | ||
|
||
import javax.swing.*; | ||
import java.awt.*; | ||
import java.awt.event.ActionEvent; | ||
import java.awt.event.ActionListener; | ||
import java.awt.event.ItemEvent; | ||
import java.awt.event.ItemListener; | ||
import java.io.File; | ||
import java.util.Arrays; | ||
|
||
import static org.embl.mobie.lib.view.save.ViewSaver.CREATE_SELECTION_GROUP; | ||
|
||
public class StringArraySelectorDialog | ||
{ | ||
private final String title; | ||
private final String[] array; | ||
|
||
private JComboBox< String > arrayComboBox; | ||
|
||
private boolean isOkPressed; | ||
|
||
private JDialog dialog; | ||
|
||
public StringArraySelectorDialog( String title, String[] array ) | ||
{ | ||
this.title = title; | ||
this.array = array; | ||
} | ||
|
||
public boolean show() | ||
{ | ||
dialog = new JDialog( ( Frame ) null, title, true ); | ||
dialog.setLayout( new BoxLayout( dialog.getContentPane(), BoxLayout.Y_AXIS ) ); | ||
|
||
// Array item selection | ||
// | ||
JPanel selectionPanel = SwingHelper.horizontalLayoutPanel(); | ||
arrayComboBox = new JComboBox<>( array ); | ||
Dimension maximumSize = new Dimension( 300, 20 ); | ||
arrayComboBox.setMaximumSize( maximumSize ); | ||
selectionPanel.add( new JLabel("Select item: ") ); | ||
selectionPanel.add( arrayComboBox ); | ||
|
||
dialog.add( selectionPanel ); | ||
|
||
// OK and Cancel button | ||
// | ||
JPanel buttonPanel = new JPanel(); | ||
JButton okButton = new JButton( "OK" ); | ||
JButton cancelButton = new JButton( "Cancel" ); | ||
buttonPanel.add( okButton ); | ||
buttonPanel.add( cancelButton ); | ||
dialog.add( buttonPanel ); | ||
|
||
okButton.addActionListener( e -> | ||
{ | ||
isOkPressed = true; | ||
dialog.setVisible( false ); | ||
} ); | ||
|
||
cancelButton.addActionListener( e -> | ||
{ | ||
isOkPressed = false; | ||
dialog.setVisible( false ); | ||
} ); | ||
|
||
dialog.setPreferredSize( new Dimension( 250, 120 ) ); | ||
dialog.setLocation( | ||
Toolkit.getDefaultToolkit().getScreenSize().width / 2 - 200, | ||
Toolkit.getDefaultToolkit().getScreenSize().height / 2 - 200 | ||
); | ||
dialog.pack(); | ||
dialog.setVisible( true ); | ||
|
||
return isOkPressed; | ||
} | ||
|
||
public String getSelectedItem() | ||
{ | ||
return (String) arrayComboBox.getSelectedItem(); | ||
} | ||
} | ||
|
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
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
49 changes: 49 additions & 0 deletions
49
src/test/java/org/embl/mobie/command/open/OpenIlastik2ChannelImageCommandTest.java
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 @@ | ||
/*- | ||
* #%L | ||
* Fiji viewer for MoBIE projects | ||
* %% | ||
* Copyright (C) 2018 - 2024 EMBL | ||
* %% | ||
* Redistribution and use in source and binary forms, with or without | ||
* modification, are permitted provided that the following conditions are met: | ||
* | ||
* 1. Redistributions of source code must retain the above copyright notice, | ||
* this list of conditions and the following disclaimer. | ||
* 2. Redistributions in binary form must reproduce the above copyright notice, | ||
* this list of conditions and the following disclaimer in the documentation | ||
* and/or other materials provided with the distribution. | ||
* | ||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" | ||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE | ||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | ||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | ||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | ||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | ||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | ||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | ||
* POSSIBILITY OF SUCH DAMAGE. | ||
* #L% | ||
*/ | ||
package org.embl.mobie.command.open; | ||
|
||
import net.imagej.ImageJ; | ||
import org.junit.jupiter.api.Test; | ||
|
||
import java.io.File; | ||
|
||
public class OpenIlastik2ChannelImageCommandTest | ||
{ | ||
static { net.imagej.patcher.LegacyInjector.preinit(); } | ||
|
||
@Test | ||
public void test( ) | ||
{ | ||
new ImageJ().ui().showUI(); // initialise SciJava Services | ||
|
||
final OpenImageAndLabelsCommand command = new OpenImageAndLabelsCommand(); | ||
command.image = new File( "src/test/resources/ilastik-2d/probabilities-2channels.h5" ); | ||
command.run(); | ||
} | ||
} |
51 changes: 51 additions & 0 deletions
51
src/test/java/org/embl/mobie/command/open/OpenIlastik2ChannelImagesCommandTest.java
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,51 @@ | ||
/*- | ||
* #%L | ||
* Fiji viewer for MoBIE projects | ||
* %% | ||
* Copyright (C) 2018 - 2024 EMBL | ||
* %% | ||
* Redistribution and use in source and binary forms, with or without | ||
* modification, are permitted provided that the following conditions are met: | ||
* | ||
* 1. Redistributions of source code must retain the above copyright notice, | ||
* this list of conditions and the following disclaimer. | ||
* 2. Redistributions in binary form must reproduce the above copyright notice, | ||
* this list of conditions and the following disclaimer in the documentation | ||
* and/or other materials provided with the distribution. | ||
* | ||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" | ||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE | ||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | ||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | ||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | ||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | ||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | ||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | ||
* POSSIBILITY OF SUCH DAMAGE. | ||
* #L% | ||
*/ | ||
package org.embl.mobie.command.open; | ||
|
||
import net.imagej.ImageJ; | ||
import org.embl.mobie.lib.transform.GridType; | ||
import org.junit.jupiter.api.Test; | ||
|
||
import java.io.File; | ||
|
||
public class OpenIlastik2ChannelImagesCommandTest | ||
{ | ||
static { net.imagej.patcher.LegacyInjector.preinit(); } | ||
|
||
@Test | ||
public void test( ) | ||
{ | ||
new ImageJ().ui().showUI(); // initialise SciJava Services | ||
|
||
final OpenMultipleImagesAndLabelsCommand command = new OpenMultipleImagesAndLabelsCommand(); | ||
command.image0 = new File( "src/test/resources/ilastik-2d/probabilities-2channels.h5;0" ); | ||
command.image1 = new File( "src/test/resources/ilastik-2d/probabilities-2channels.h5;1" ); | ||
command.run(); | ||
} | ||
} |
51 changes: 51 additions & 0 deletions
51
src/test/java/org/embl/mobie/command/open/OpenIlastikImageAndSegmentationCommandTest.java
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,51 @@ | ||
/*- | ||
* #%L | ||
* Fiji viewer for MoBIE projects | ||
* %% | ||
* Copyright (C) 2018 - 2024 EMBL | ||
* %% | ||
* Redistribution and use in source and binary forms, with or without | ||
* modification, are permitted provided that the following conditions are met: | ||
* | ||
* 1. Redistributions of source code must retain the above copyright notice, | ||
* this list of conditions and the following disclaimer. | ||
* 2. Redistributions in binary form must reproduce the above copyright notice, | ||
* this list of conditions and the following disclaimer in the documentation | ||
* and/or other materials provided with the distribution. | ||
* | ||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" | ||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE | ||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | ||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | ||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | ||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | ||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | ||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | ||
* POSSIBILITY OF SUCH DAMAGE. | ||
* #L% | ||
*/ | ||
package org.embl.mobie.command.open; | ||
|
||
import net.imagej.ImageJ; | ||
import org.junit.jupiter.api.Test; | ||
|
||
import java.io.File; | ||
|
||
public class OpenIlastikImageAndSegmentationCommandTest | ||
{ | ||
static { net.imagej.patcher.LegacyInjector.preinit(); } | ||
|
||
@Test | ||
public void test( ) | ||
{ | ||
new ImageJ().ui().showUI(); // initialise SciJava Services | ||
|
||
final OpenImageAndLabelsCommand command = new OpenImageAndLabelsCommand(); | ||
command.image = new File( "src/test/resources/ilastik-2d/probabilities.h5" ); | ||
command.labels = new File( "src/test/resources/ilastik-2d/labels.h5" ); | ||
command.table = new File( "src/test/resources/ilastik-2d/table.csv" ); | ||
command.run(); | ||
} | ||
} |
Binary file not shown.
Binary file not shown.