http://imagej.273.s1.nabble.com/question-on-stack-histogram-macro-tp5017654p5017663.html
I have not tested this but you can save the settings in a file. When you start ImageJ you check if the file exists or if there is a file in a specific directory and if it does, you delete it using File.delete(path). This code to check for the file you can run via the option Edit > Option > Startup... what runs this macro code when ImageJ starts up.
You could also just delete the file in the Startup code and make for the first time an empty file so you don't get an error that the file does not exist.
Dr Ir K.R. Straatman
I've would like to save some settings of an imagej macro until ImageJ is restarted.
I want to apply a macro and safe the settings. If the macro is applied again then it uses the saved settings. When ImageJ is restarted the saved settings should be dismissed.
> Thanks for everyone's input.
>
> The getHistogram() can only get info from a single slice. For the
> stack image, I realize the sample code of "StackHistogramLister" can
> be modified for my purpose.
>
>
https://imagej.nih.gov/ij/macros/StackHistogramLister.txt>
> However, I feel since the run("Histogram", "stack") already have the
> histogram of the whole stack, there may be a simple way to retrieve
> the information rather than redo the whole thing through macro codes.
>
> Best
> Lai
>
> -----Original Message-----
> From: ImageJ Interest Group [mailto:
[hidden email]] On Behalf Of
> Cammer, Michael
> Sent: Tuesday, November 29, 2016 9:40 PM
> To:
[hidden email]
> Subject: Re: question on stack histogram macro
>
> Look at the getHistogram command at
https://imagej.nih.gov/ij/develop
> er/macro/functions.html#G .
>
> Instead of run("Histogram", "stack"); use the getHistogram command.
>
> _________________________________________
> Michael Cammer, Optical Microscopy Specialist
http://ocs.med.nyu.edu/
> microscopy
http://microscopynotes.com/> Cell: (914) 309-3270
>
> ________________________________________
> From: ImageJ Interest Group [
[hidden email]] on behalf of Lai
> Ding [
[hidden email]]
> Sent: Tuesday, November 29, 2016 9:32 PM
> To:
[hidden email]
> Subject: question on stack histogram macro
>
> Hello There,
>
> I have a simple question on acquiring stack histogram.
>
> If I have a stack image named "raw", I can use "Analyze" -->
> "Histogram" to get the stack histogram. the ImageJ will show the
> histogram in a new window named "Histogram of raw". once I click the
> "List" button in the new window, it will show all the bins and counts
> in a table, then I can save teh table as a xls file.
>
> My question is how to achieve this in macro language. once I run
>
> selectImage("raw");
> run("Histogram", "stack");
>
> how do I open the stack histogram table ( as manully click the "List"
> button)?
>
> Thanks
> Lai
>
> --
> ImageJ mailing list:
https://urldefense.proofpoint.com/v2/url?u=http-> 3A__imagej.nih.gov_ij_list.html&d=DgIFaQ&c=j5oPpO0eBH1iio48DtsedbOBGm
> uw5jHLjgvtN2r4ehE&r=oU_05LztNstAydlbm5L5GDu_vAdjXk3frDLx_CqKkuo&m=AHN
> 5osRHyOzQygzzFuvZwdLQvPqIKmsjnoUGd8iVVsk&s=ZsBAYErVU7YKf7UKzTQ5M19kKJ
> zb2hUcUyO18IYVaMw&e=
>
> ------------------------------------------------------------
> This email message, including any attachments, is for the sole use of
> the intended recipient(s) and may contain information that is
> proprietary, confidential, and exempt from disclosure under applicable
> law. Any unauthorized review, use, disclosure, or distribution is
> prohibited. If you have received this email in error please notify the
> sender by return email and delete the original message. Please note,
> the recipient should check this email and any attachments for the
> presence of viruses. The organization accepts no liability for any
> damage caused by any virus transmitted by this email.
> =================================
>
> --
> ImageJ mailing list:
http://imagej.nih.gov/ij/list.html>
> --
> ImageJ mailing list:
http://imagej.nih.gov/ij/list.html