Skip to content

Commit

Permalink
Improve image name overlay
Browse files Browse the repository at this point in the history
  • Loading branch information
tischi committed Jun 11, 2024
1 parent 65dc0b4 commit a068ddf
Show file tree
Hide file tree
Showing 6 changed files with 110 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.0.1</version>
<version>5.0.3-SNAPSHOT</version>

<!-- force javadoc generation to fetch errors: -->
<!-- mvn javadoc:javadoc | grep error -->
Expand Down
10 changes: 7 additions & 3 deletions src/main/java/org/embl/mobie/lib/bdv/ImageNameOverlay.java
Original file line number Diff line number Diff line change
Expand Up @@ -68,17 +68,18 @@ public class ImageNameOverlay extends BdvOverlay implements TransformListener< A
protected final Listeners.SynchronizedList< ActiveListener > listeners
= new Listeners.SynchronizedList< ActiveListener >( );


public ImageNameOverlay( BdvHandle bdvHandle, boolean isActive, SliceViewer sliceViewer )
public ImageNameOverlay( BdvHandle bdvHandle, SliceViewer sliceViewer )
{
this.bdvHandle = bdvHandle;
this.sliceViewer = sliceViewer;
bdvHandle.getViewerPanel().transformListeners().add( this );
setActive( isActive );
}

public void setActive( boolean isActive )
{
if ( this.isActive == isActive )
return;

this.isActive = isActive;

if ( isActive && overlaySource == null )
Expand Down Expand Up @@ -106,6 +107,9 @@ public void setActive( boolean isActive )
{
activeListener.isActive( isActive );
}

updateImages();
bdvHandle.getViewerPanel().requestRepaint();
}

public boolean isActive()
Expand Down
5 changes: 2 additions & 3 deletions src/main/java/org/embl/mobie/lib/bdv/view/SliceViewer.java
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ public class SliceViewer

private SourceAndConverterContextMenuClickBehaviour contextMenu;
private final SourceAndConverterService sacService;
private ImageNameOverlay imageNameOverlay;
private final ImageNameOverlay imageNameOverlay;

public SliceViewer( MoBIE moBIE, boolean is2D )
{
Expand All @@ -100,12 +100,11 @@ public SliceViewer( MoBIE moBIE, boolean is2D )
tileRenderOverlay = false; // don't show twice
}

imageNameOverlay = new ImageNameOverlay( bdvHandle, false, this );
imageNameOverlay = new ImageNameOverlay( bdvHandle, this );

installContextMenuAndKeyboardShortCuts();

WindowArrangementHelper.rightAlignWindow( moBIE.getUserInterface().getWindow(), SwingUtilities.getWindowAncestor( bdvHandle.getViewerPanel() ), true, true );

}

public ImageNameOverlay getImageNameOverlay()
Expand Down
6 changes: 4 additions & 2 deletions src/main/java/org/embl/mobie/ui/UserInterfaceHelper.java
Original file line number Diff line number Diff line change
Expand Up @@ -928,9 +928,11 @@ private JPanel createClearAndSourceNamesOverlayPanel( MoBIE moBIE )
} );
} );

overlayNamesCheckbox =new JCheckBox( "overlay names" );
overlayNamesCheckbox = new JCheckBox( "overlay names" );
overlayNamesCheckbox.setSelected( false );
overlayNamesCheckbox.addActionListener( e -> new Thread( () -> moBIE.getViewManager().getSliceViewer().getImageNameOverlay().setActive( overlayNamesCheckbox.isSelected() ) ).start() );
overlayNamesCheckbox.addActionListener( e -> new Thread( () ->
moBIE.getViewManager().getSliceViewer()
.getImageNameOverlay().setActive( overlayNamesCheckbox.isSelected() ) ).start() );

panel.add( overlayNamesCheckbox );
panel.add( space() );
Expand Down
47 changes: 47 additions & 0 deletions src/test/java/projects/OpenGiulia.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
/*-
* #%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 projects;

import net.imagej.ImageJ;
import org.embl.mobie.MoBIE;
import org.embl.mobie.MoBIESettings;
import org.embl.mobie.command.open.OpenHCSDatasetCommand;

import java.io.IOException;

public class OpenGiulia
{
public static void main( String[] args ) throws IOException
{
final ImageJ imageJ = new ImageJ();
imageJ.ui().showUI();

new MoBIE("/Volumes/emcf/mizzon/projects/2024/HEV_vCLEM/HEV_D7-1_oRblended_sec5-8/mobie_backup", MoBIESettings.settings() );
}
}
49 changes: 49 additions & 0 deletions src/test/java/projects/OpenLocalThomasMolDev.java
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 projects;

import net.imagej.ImageJ;
import org.embl.mobie.MoBIE;
import org.embl.mobie.MoBIESettings;
import org.embl.mobie.command.open.OpenHCSDatasetCommand;

import java.io.IOException;

public class OpenLocalThomasMolDev
{
public static void main( String[] args )
{
final ImageJ imageJ = new ImageJ();
imageJ.ui().showUI();

OpenHCSDatasetCommand command = new OpenHCSDatasetCommand();
command.hcsDirectory = "/Users/tischer/Downloads/TBO-Test31-01-2024-10x-TL-DAPI_Plate_260/TimePoint_1";
command.run();
}
}

0 comments on commit a068ddf

Please sign in to comment.