Tim is using MacOS, not Linux.
One issue (of several) with Java on MacOS is the "App Nap" problem. It
is still in the foreground. See this article:
> Hi Timothy, Jim,
>
> in my experience, Linux does not have a problem of slowing down
> processes unless other programs/processes are competing for CPU time.
> You could run 'top' in a terminal window in parallel to monitor CPU usage.
>
> Did you check that all windows are properly closed, so memory usage does
> not go up? You might print nImages() from time to time to make sure.
>
> Plugins>Utilites>Montor Memory might be also helpful to see whether memory
> is an issue. Click into the status line of ImageJ from time to time to
> enforce garbage collection (otherwise memory usage goes up gradually even
> if everything is properly closed).
>
> --
> Concerning the average between two different frames of a stack: In a
> macro, it would be enough to duplicate one of the frames, and set the stack
> slice to the other, then calculate the difference. In a java plugin or
> javascript you could get the two ImageProcessors and run the appropriate
> process/Blitter class, then get the mean of the pixels.
>
> Michael
> ________________________________________________________________
>
> On 12/01/2017 15:50, Ewing James wrote:
>
>> Timothy - This sounds like a unix/linux question. See the
>> documentation on priorities in linux processes.
>>
>> As a process ages, its priority for processing may slip downward.
>> Try using the ‘nice’ command with a negative setting (RTM before you
>> start fiddling).
>>
>> - Jim
>>
>> On Jan 12, 2017, at 9:19 AM, Feinstein, Timothy N <
[hidden email]>
>>> wrote:
>>>
>>> I hate to ping the list twice in two days, but this one is a
>>> puzzle. I wrote a macro that measures the difference between each
>>> frame of a time series with frame 1, with the ultimate goal of
>>> measuring the periodicity of the average difference value (with
>>> Fourier analysis in Excel) to measure ciliary beat frequency. The
>>> macro uses nested for() loops to open each file in a folder,
>>> process it framewise and build a results table.
>>>
>>> The macro runs pretty fast, but if I walk away from the computer
>>> for a while at some point it will slow down by almost ten fold,
>>> making it impractical to run through large data sets overnight.
>>> Each stack is about 200-500 kb and Fiji has 10 GB of RAM allocated,
>>> so I doubt that RAM is my problem. I quit all other programs,
>>> prevented sleep and Fiji remains foregrounded the whole time. I am
>>> using the latest Fiji update on OSX 10.10.5.
>>>
>>> It would be great to know what might cause the slowdown. At the
>>> same time, odds are my approach could be streamlined quite a bit.
>>> Right now the macro duplicates out frame 1 and frame n from the
>>> movie, makes an image of the difference and records the average
>>> pixel value of the difference image to a results table. Making the
>>> new images and closing them again seems to take time, even with
>>> batch mode on. Does anyone know how to measure the average
>>> difference between frame 1 and frame n of a stack without
>>> duplicating them out? I pasted the macro below.
>>>
>>> Thanks again,
>>>
>>>
>>> T
>>>
>>> Timothy Feinstein, Ph.D. Research Scientist University of
>>> Pittsburgh Department of Developmental Biology
>>>
>>> ------------------------------------------------------------
>>>
>>>
>>> //Analyze ciliary beat frequency using cropped movies
>>
>> //Requires stable movies. Use the stackreg plugin on
>> //uncropped originals if you can see sample or camera motion.
>>
>> setBatchMode(true);
>>
>> if(isOpen("diff_Quant")){
>> selectWindow("diff_Quant");
>> run("Close");
>> }
>>
>> if(isOpen("Results")) {
>> selectWindow("Results");
>> run("Close");
>> }
>>
>> run("Clear Results");
>>
>> run("Set Measurements...", "mean limit display redirect=None decimal=5");
>>
>> //Find the movies to analyze
>>
>> files = getDirectory("Movies");
>> count = 0;
>> list = getFileList(files);
>> n = lengthOf(list);
>>
>> //Set up the results table
>>
>> for (i=0; i < n; i++) {
>>
>> result = 0;
>> fileName = list[i];
>> setResult(fileName, result, 1);
>> updateResults();
>> }
>>
>> IJ.renameResults("diff_Quant");
>>
>> //Duplicate out the 1st and nth frame of each movie
>> //and measure the average difference
>>
>> for (i=0; i <= n; i++) {
>>
>> open(files+list[count]);
>> stack = getTitle();
>> time = 0;
>> fileName = list[i];
>> result = 0;
>> run("Gaussian Blur 3D...", "x=1 y=1 z=1");
>>
>> n = nSlices();
>>
>> for (slice=1; slice<=(300); slice++){
>>
>> selectWindow(stack);
>> setSlice(1);
>> run("Duplicate...", "use");
>> first = getTitle();
>>
>> selectWindow(stack);
>> setSlice(slice + 1);
>> run("Duplicate...", "use");
>> test = getTitle();
>>
>> imageCalculator("Difference create", first, test);
>> diff = getTitle();
>> run("Measure");
>> mean = getResult("Mean", 0);
>>
>> selectWindow("Results");
>> run("Clear Results");
>> run("Close");
>>
>> selectWindow("diff_Quant");
>> IJ.renameResults("Results");
>> result = slice;
>> setResult(fileName, result, mean);
>> updateResults();
>> IJ.renameResults("diff_Quant");
>>
>>
>> selectWindow(first);
>> run("Close");
>> selectWindow(test);
>> run("Close");
>> selectWindow(diff);
>> run("Close");
>> time = time + 0.005;
>>
>> }
>>
>> selectWindow(stack);
>> run("Close");
>> count++;
>> }
>>
>
> --
> ImageJ mailing list:
http://imagej.nih.gov/ij/list.html>