Skip to content

Commit

Permalink
Version 5.3.8
Browse files Browse the repository at this point in the history
  • Loading branch information
tischi committed Sep 14, 2024
1 parent f899110 commit f7cdd1d
Show file tree
Hide file tree
Showing 11 changed files with 251 additions and 9 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

<groupId>org.embl.mobie</groupId>
<artifactId>mobie-viewer-fiji</artifactId>
<version>5.3.7</version>
<version>5.3.8</version>
<!-- mvn clean install -Dmaven.test.skip=true -Dscijava.app.directory=/Users/tischer/Desktop/Fiji/Fiji-MoBIE.app -->

<!-- ../scijava-scripts/release-version.sh - -skip-version-check - -skip-license-update -->
Expand Down
14 changes: 8 additions & 6 deletions src/main/java/org/embl/mobie/lib/table/TableView.java
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
import org.embl.mobie.lib.select.SelectionModel;
import org.embl.mobie.ui.ColumnColoringModelDialog;
import net.imglib2.type.numeric.ARGBType;
import org.embl.mobie.ui.StringArraySelectorDialog;
import org.embl.mobie.ui.UserInterfaceHelper;

import javax.swing.*;
Expand Down Expand Up @@ -371,12 +372,13 @@ private JMenuItem createColumnSearchMenuItem()
menuItem.addActionListener( e ->
SwingUtilities.invokeLater( () ->
{
final String[] columnNames = Tables.getColumnNamesAsArray( jTable );
final GenericDialog gd = new GenericDialog( "Focus Column" );
gd.addChoice( "Column", columnNames, columnNames[ 0 ] );
gd.showDialog();
if ( gd.wasCanceled() ) return;
final String columnName = gd.getNextChoice();
StringArraySelectorDialog dialog =
new StringArraySelectorDialog(
"Column Selector",
Tables.getColumnNamesAsArray( jTable )
);
if ( ! dialog.show() ) return;
final String columnName = dialog.getSelectedItem();
int columnIndex = jTable.getColumnModel().getColumnIndex( columnName );
JViewport viewport = (JViewport) jTable.getParent();
Rectangle rect = jTable.getCellRect(0, columnIndex, true);
Expand Down
89 changes: 89 additions & 0 deletions src/main/java/org/embl/mobie/ui/StringArraySelectorDialog.java
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();
}
}

2 changes: 1 addition & 1 deletion src/main/java/org/embl/mobie/ui/UserInterfaceHelper.java
Original file line number Diff line number Diff line change
Expand Up @@ -1237,7 +1237,7 @@ public static JButton createFocusButton( AbstractDisplay< ? > sourceDisplay,
BdvHandle bdvHandle,
List< Source< ? > > sources )
{
JButton button = getIconButton( "focus.png" );
JButton button = getIconButton( "focus.png" );
button.setToolTipText( "Fit image to viewer" );

button.addActionListener( e ->
Expand Down
Binary file modified src/main/resources/focus.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@

import java.io.File;

public class OpenIlastik2DImageAndSegmentationCommandTest
public class Open2DTIFFImageAndIlastikSegmentationCommandTest
{
static { net.imagej.patcher.LegacyInjector.preinit(); }

Expand Down
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();
}
}
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();
}
}
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 added src/test/resources/ilastik-2d/probabilities.h5
Binary file not shown.

0 comments on commit f7cdd1d

Please sign in to comment.