@@ -197,12 +197,13 @@ public void run()
197197 gui .setAvailableZProjection (ZProjector .METHODS );
198198 gui .setZProjection (ZProjector .METHODS [ZProjector .AVG_METHOD ]);
199199 gui .setVisible (true );
200- gui .setAlwaysOnTop (false );
200+ gui .setAlwaysOnTop (false );
201+ gui .setBatchMode (batchMode );
201202
202203 gui .addBrowseBtnListener ((ActionEvent evt )->
203204 {
204205 gui .setStatus ("Browsing folder ..." );
205-
206+ gui . setProgress ( 0 );
206207 askSourceDirectoryToUser ();
207208
208209 if (sourceFolder != null )
@@ -213,8 +214,6 @@ public void run()
213214 sourceFolder .toString ()
214215 )
215216 );
216- gui .setProgress (10 );
217-
218217 gui .setSourceDirectory (sourceFolder .toString ());
219218
220219 scannedFiles = FileHelper .getFiles (sourceFolder , true );
@@ -226,7 +225,6 @@ public void run()
226225 else
227226 {
228227 gui .setStatus ("Browsing aborted." );
229- gui .setProgress (0 );
230228 gui .clearFileList ();
231229 }
232230 });
@@ -335,7 +333,15 @@ public void windowDeactivated(WindowEvent e)
335333
336334 if ( !presetName .equals ("Custom" ) )
337335 {
338- gui .setColorPreset ( colorPresets .get (presetName ), true );
336+ MColorPreset presetSelected = colorPresets .get (presetName );
337+ gui .setColorPreset ( presetSelected , true );
338+
339+ // We choose a unique event for color item selection changed
340+ // We need to update the selectedColorPreset entirely
341+ for ( int i =0 ; i < 4 ; i ++ )
342+ {
343+ selectedColors .setMetaColorAt (i , presetSelected .getMetaColorAt (i ) );
344+ }
339345 }
340346 });
341347
@@ -418,6 +424,10 @@ private void processFiles()
418424 int channel = 0 ;
419425 for (ImagePlus channelImg : allChannels )
420426 {
427+ if ( !batchMode )
428+ {
429+ channelImg .show ();
430+ }
421431
422432 if ( channelImg .getNSlices () > 1 )
423433 {
@@ -440,9 +450,23 @@ private void processFiles()
440450 );
441451
442452 ImagePlus out = new ImagePlus ("out" , p .createImage ());
453+
454+ if ( !batchMode )
455+ {
456+ channelImg .close ();
457+ out .show ();
458+ }
459+
443460 FileSaver saver = new FileSaver (out );
444461 saver .saveAsTiff (outputPath );
445462 channel ++;
463+
464+
465+ if ( !batchMode )
466+ {
467+ out .close ();
468+
469+ }
446470 }
447471 serie ++;
448472 }
@@ -462,31 +486,6 @@ private void processFiles()
462486 }
463487
464488 gui .setStatus ("Processing DONE" );
465-
466- if ( !batchMode && !allImages .isEmpty () )
467- {
468- DialogPrompt .Result response =
469- ui .showDialog (
470- "Would you like to open the images?" ,
471- MessageType .QUESTION_MESSAGE ,
472- OptionType .YES_NO_OPTION
473- );
474-
475- if ( response .equals ( DialogPrompt .Result .YES_OPTION ) )
476- {
477- allImages .forEach ( (ImagePlus [] imgs )->
478- {
479- for (ImagePlus img : imgs )
480- {
481- img .show ();
482- }
483- });
484- }
485- }
486- else
487- {
488- gui .setStatus ("No images were loaded :(" );
489- }
490489 }
491490 else
492491 {
0 commit comments