Commit 597dcec0 authored by pietzsch's avatar pietzsch
Browse files

Don't show image selection dialog if only one image is open

parent 3b8e1125
...@@ -77,19 +77,35 @@ public class OpenImagePlusPlugIn implements Command ...@@ -77,19 +77,35 @@ public class OpenImagePlusPlugIn implements Command
return; return;
} }
final int[] idList = WindowManager.getIDList(); ArrayList< ImagePlus > inputImgList = new ArrayList<>();
final String[] nameList = new String[ nImages ]; if ( nImages > 1 )
GenericDialog gd = new GenericDialog( "Images to open" );
for ( int i = 0; i < nImages; i++ )
{ {
ImagePlus imp = WindowManager.getImage( idList[ i ] ); final int[] idList = WindowManager.getIDList();
nameList[ i ] = imp.getTitle(); final String[] nameList = new String[ nImages ];
gd.addCheckbox( nameList[ i ], imp == curr ); GenericDialog gd = new GenericDialog( "Images to open" );
} for ( int i = 0; i < nImages; i++ )
{
ImagePlus imp = WindowManager.getImage( idList[ i ] );
nameList[ i ] = imp.getTitle();
gd.addCheckbox( nameList[ i ], imp == curr );
}
gd.showDialog(); gd.showDialog();
if ( gd.wasCanceled() ) if ( gd.wasCanceled() )
return; return;
for ( int i = 0; i < nImages; i++ )
{
if ( !gd.getNextBoolean() )
continue;
ImagePlus imp = WindowManager.getImage( idList[ i ] );
inputImgList.add( imp );
}
}
else
{
inputImgList.add( curr );
}
final ArrayList< ConverterSetup > converterSetups = new ArrayList<>(); final ArrayList< ConverterSetup > converterSetups = new ArrayList<>();
final ArrayList< SourceAndConverter< ? > > sources = new ArrayList<>(); final ArrayList< SourceAndConverter< ? > > sources = new ArrayList<>();
...@@ -99,12 +115,8 @@ public class OpenImagePlusPlugIn implements Command ...@@ -99,12 +115,8 @@ public class OpenImagePlusPlugIn implements Command
int nTimepoints = 1; int nTimepoints = 1;
int setup_id_offset = 0; int setup_id_offset = 0;
ArrayList< ImagePlus > imgList = new ArrayList<>(); ArrayList< ImagePlus > imgList = new ArrayList<>();
for ( int i = 0; i < nImages; i++ ) for ( ImagePlus imp : inputImgList )
{ {
if ( !gd.getNextBoolean() )
continue;
ImagePlus imp = WindowManager.getImage( idList[ i ] );
spimData = load( imp, converterSetups, sources, setup_id_offset ); spimData = load( imp, converterSetups, sources, setup_id_offset );
if ( spimData != null ) if ( spimData != null )
{ {
......
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