NOTICE! This is a static HTML version of a legacy Fiji BugZilla bug.

The Fiji project now uses GitHub Issues for issue tracking.

Please file all new issues there.

Bug 827 - Fiji and macro never really ended
Fiji and macro never really ended
Status: ASSIGNED
Product: ImageJ
Classification: Unclassified
Component: Legacy
unspecified
PC Windows
: P5 enhancement
Assigned To: Mark Hiner
Depends on:
Blocks:
 
Reported: 2014-07-01 07:39 CDT by Quentin
Modified: 2015-04-06 16:10 CDT
2 users (show)

See Also:

Description Quentin 2014-07-01 07:39:57 CDT
hello,

Today in use the "kill" button in macro windows, I seen the button "kill" is turn grey and the button "run" is turn on. but when I looked in my output directory for results, I seen that the macro continue. And she continue always then as I closed Fiji.

For really stop the macro I need kill the process fiji in the task manager Windows.
I re-tested after reboot, daily updates and an over reboot. The result is same, the macro never stop.

I'm here if you need more details.
Regards.
Quentin Le Rouzic
Comment 1 Curtis Rueden 2014-07-01 14:09:22 CDT
We just fixed a related bug, #805. Can you please update your Fiji and test again? Hopefully Fiji will now actually quit when you quit the program, and your macro will terminate.

The Kill button being grayed out is a separate issue, which is why this bug report is not a duplicate of 805.
Comment 2 Quentin 2014-07-28 05:29:06 CDT
Hello,

this bug is be back, but not with all macros.
The macro who bug is just a macro with "analyze particles" and "save results".
And macro occupies more memory to each loop. 

You have an idea to fix this?
Thank you in advance. 
best regards, 
Quentin
Comment 3 Mark Hiner 2014-07-28 07:44:03 CDT
> The macro who bug is just a macro with "analyze particles" and "save results".

I can not reproduce this by running analyze particles and saving the results. You said that your macro runs a loop so I am wondering if the loop is not terminating, or running a significant number of times and the UI is just not updating properly.

Can you please share the exact contents of your macro?

> And macro occupies more memory to each loop.

Assuming you are opening multiple datasets in your loop and then calling close(), there is at least one known memory leak. See http://fiji.sc/bugzilla/﷒0﷓ and related discussion.
Comment 4 Quentin 2014-07-28 08:51:16 CDT
827 comments bug helped me and the solution is indeed uncheck "Use SCIFIO When opening files". macro becomes much faster and occupies only the memory that is required. 

Thank you very much for your help. 
Quentin
Comment 5 Mark Hiner 2014-07-28 09:00:05 CDT
Quentin,

> the solution is indeed uncheck "Use SCIFIO When opening files"

This is a quick fix but not a true solution. It does not address the underlying bug that you discovered. You can read more about ImageJ2 and SCIFIO here: http://imagej.net/ImageJ2

There is clearly still a bug on the SCIFIO/ImageJ2 side of things, and it will need to be resolved eventually. So it would be very helpful if you would post your macro code so we can test, reproduce and fix the issue (and of course you can continue to run without using SCIFIO until the problem is resolved).

Thanks,
Mark
Comment 6 Quentin 2014-07-28 09:38:12 CDT
My entire project uses two macro. The first was running perfectly smoothly and continuously. The second was blocking and now execute perfectly.

MACRO 1:

dossierOut_2 = getDirectory("Dossier pour les images avec les segmentations");
//Dossier enregistrement de la segmentations

setBatchMode(true);
x=1

		//chemin d'access
		path = "C:\\Users\\Quentin\\Desktop\\Images Zeiss + macros\\dossier 1_ stock image\\J2 1Fe 3x3 20x R1P2.zvi";
				for (i=50; i>=5; i-=5)
				{
					for (j=200; j>=0; j-=10)
					{
						for (k=200; k>=0; k-=10)
						{	
						//importation des fichiers ZIV, séparation des tuilles
						run("Bio-Formats Importer", 
						"open=path autoscale color_mode=Default view=Hyperstack stack_order=XYCZT series_2");
						NOMx=getTitle();
						
						//duplicat
						run("Duplicate...", "title="+NOMx+"_"+i+" duplicate range=1-7");
						NOMx_1= getTitle();
				
						//stack focuser (EFI)
						run("Stack Focuser ", "enter="+i);
										
						//run("Brightness/Contrast...");			
						setMinAndMax(j, 4095);
						run("8-bit");
						
						
						//treshold pour la segmentation
						setAutoThreshold("Yen dark");
						setThreshold(k, 4095);
						run("Convert to Mask");
				
						saveAs("Tiff", dossierOut_2+NOMx_1+"_"+i+"_"+j+"_"+k+".tif");
						close();
						close();
						close();

						//Fenetre_mémoire
						print("traitement ",x,"sur 4410  ",IJ.freeMemory());
						x=x+1;
						
						}			
						
					}
				}
						
		print("...");
		print("traitement accompli");
		print("...");

................................................................................
................................................................................

MACRO 2:

dossierIn = getDirectory("Images"); //Dossier dans lequel les photos sont
dossierOut = getDirectory("Excel"); //Dossier dans lequel les données sont enregistrées
fichiers = getFileList(dossierIn);
setBatchMode(true);

	for (Z=0; Z<fichiers.length; Z++)
	{
				
		open(dossierIn+fichiers[Z]);
		run("Analyze Particles...", "size=40-Infinity display exclude");

			if (isOpen("Results")) 
			{ 
		       selectWindow("Results");
		       saveAs("Results", dossierOut+fichiers[Z]+"_Results.txt");
		       run("Clear Results");
		       run("Close"); 
		  	}

		  	if (isOpen("ROI Manager")) 
			{ 
		       selectWindow("ROI Manager");
		       run("Close"); 
		  	}
			
		close();
		//Fenetre_d'avancement
		print(Z+1 +"/"+fichiers.length+"     "+IJ.freeMemory());
	}
		print("...");
		print("traitement accompli");
		print("...");
Comment 7 Mark Hiner 2014-07-28 10:31:51 CDT
Thanks for this, Quentin. We'll look into it.
Comment 8 Quentin 2014-07-29 04:15:46 CDT
Hello, just a little question: if I find a new "bug" I make a new post ?
thanks,
Quentin
Comment 9 Mark Hiner 2014-07-29 07:58:05 CDT
Yep, one bug per post. The easiest way is to use Help > Report a Bug from within Fiji.

See also http://fiji.sc/Bug_reporting_best_practices