Commit 76d8e30d authored by Amandine  TOURNAY's avatar Amandine TOURNAY
Browse files

Update parent POM version + fix warning in Java files (use lambda functions...

Update parent POM version + fix warning in Java files (use lambda functions when calling abstract methods)
parent d7ca4f3f
......@@ -8,7 +8,7 @@
<parent>
<groupId>org.bioimageanalysis.icy</groupId>
<artifactId>pom-icy</artifactId>
<version>1.0.2</version>
<version>1.0.3</version>
</parent>
<!-- Project Information -->
......
......@@ -46,7 +46,7 @@ public class MyEzPlugIcyPlugin extends EzPlug
{
final String str = "This plugin start button does not do anything useful.\n "
+ "You say you are " + age.getValue() + " years old and you "
+ ( yummy.getValue().booleanValue() ? "like" : "don't like" )
+ (yummy.getValue() ? "like" : "don't like" )
+ " chocolate.";
MessageDialog.showDialog( str );
}
......@@ -56,27 +56,20 @@ public class MyEzPlugIcyPlugin extends EzPlug
final String imagePath = "samples/Cont1.lsm";
// Load in a separate thread.
ThreadUtil.bgRun( new Runnable()
{
@Override
public void run()
{
ThreadUtil.bgRun(() -> {
final Sequence sequence = Loader.loadSequence( imagePath, 0, true );
final Sequence sequence = Loader.loadSequence( imagePath, 0, true );
// Display the images.
try
{
SwingUtilities.invokeAndWait( () -> {
new Viewer( sequence );
} );
}
catch ( InvocationTargetException | InterruptedException e )
{
e.printStackTrace();
}
// Display the images.
try
{
SwingUtilities.invokeAndWait( () -> new Viewer( sequence ));
}
catch ( InvocationTargetException | InterruptedException e )
{
e.printStackTrace();
}
} );
});
}
public static void main( final String[] args )
......
......@@ -42,76 +42,71 @@ public class MyIcyPlugin extends PluginActionable
* does not prevent the EDT to deal with the user-interface.
*/
ThreadUtil.bgRun( new Runnable()
{
@Override
public void run()
{
ThreadUtil.bgRun(() -> {
/*
* We are are not the EDT anymore. Now we can do heavy-lifting
* operations and the Icy UI won't be blocked.
*/
/*
* We are are not the EDT anymore. Now we can do heavy-lifting
* operations and the Icy UI won't be blocked.
*/
final Sequence sequence = getActiveSequence();
final Sequence sequence = getActiveSequence();
// Check if a sequence is opened.
if ( sequence == null )
{
MessageDialog.showDialog( "This plugin needs an opened sequence." );
return;
}
// Check if a sequence is opened.
if ( sequence == null )
{
MessageDialog.showDialog( "This plugin needs an opened sequence." );
return;
}
final int width = sequence.getSizeX();
final int height = sequence.getSizeY();
final int nChannel = sequence.getSizeC();
final int width = sequence.getSizeX();
final int height = sequence.getSizeY();
final int nChannel = sequence.getSizeC();
// Iterate over all the planes of the image, through C and Z.
for ( final IcyBufferedImage plane : sequence.getAllImage() )
// Iterate over all the planes of the image, through C and Z.
for ( final IcyBufferedImage plane : sequence.getAllImage() )
{
try
{
try
/*
* We put the pixel edit between a beginUpdate() and an
* endUpdate (all in a try/finally block), so that we
* only display the display (which takes time) once the
* edits of a plane are over.
*
* We could also have chosen to put the beginUpdate()
* before editing the sequence to have only one display
* update.
*/
plane.beginUpdate();
/*
* We pedestriantly iterate pixel by pixel and recopy
* the value of the every 7th pixel on the 2 that
* follows.
*/
for ( int c = 0; c < nChannel; c++ )
{
/*
* We put the pixel edit between a beginUpdate() and an
* endUpdate (all in a try/finally block), so that we
* only display the display (which takes time) once the
* edits of a plane are over.
*
* We could also have chosen to put the beginUpdate()
* before editing the sequence to have only one display
* update.
*/
plane.beginUpdate();
/*
* We pedestriantly iterate pixel by pixel and recopy
* the value of the every 7th pixel on the 2 that
* follows.
*/
for ( int c = 0; c < nChannel; c++ )
for ( int y = 0; y < height; y++ )
{
for ( int y = 0; y < height; y++ )
double val = 0;
for ( int x = 0; x < width; x++ )
{
double val = 0;
for ( int x = 0; x < width; x++ )
{
if ( x % 7 == 0 )
val = plane.getData( x, y, c );
plane.setData( x, y, c, val );
}
if ( x % 7 == 0 )
val = plane.getData( x, y, c );
plane.setData( x, y, c, val );
}
}
}
finally
{
plane.endUpdate();
}
}
finally
{
plane.endUpdate();
}
}
} );
});
}
/*
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment