Login  Register

Re: Frame average plugin (4D HyperStack)

Posted by Cammer, Michael on Aug 02, 2013; 2:24pm
URL: http://imagej.273.s1.nabble.com/Frame-average-plugin-4D-HyperStack-tp5004203p5004285.html

I threw this together a few years ago-- only works on stacks (not hyperstacks) and does not deal with frames at the end well (simply ignores them).  For max projections we often add a bunch of blank frames to the beginning and end of stacks.
It is good for making trails and we've used it for running avg for noisy images taken at high speed with spinning disk confocal and find it useful for reconstructed images from SIM where single optical sections are too thin to interpret.
Regards,
Michael Cammer



//==================================================================
macro "Projections of variable width"{
  checkCurrentVersion();
  projtypes = newArray("Max Intensity", "Average Intensity", "Standard Deviation", "Min Intensity", "Median");
  Dialog.create("Projections of variable width");
  Dialog.addMessage("Each slice of the stack is replaced with a projection of the depth\ndefined.");
  Dialog.addChoice("Label", projtypes, "Max Intensity");
  Dialog.addNumber("Slices to project: ", projectiondepth);
  Dialog.show();
  projection = Dialog.getChoice();
  projectiondepth = projection;
  zdepth = Dialog.getNumber();
  projectStackVariableWidth(projection, zdepth);
}  // Projections of variable width

//==================================================================
function projectStackVariableWidth(projtype, zdepth) {
  setBatchMode(true);
  setPasteMode("Copy");
  original = getImageID();
  end = nSlices();
  for (i=1;i<(end-zdepth);i++){
    stop = i + zdepth;
    run("Z Project...", "start="+i+" stop="+stop+" projection=["+projtype+"]");
    run("Select All");
    run("Copy");
    run("Close");
    selectImage(original);
    run("Set Slice...", "slice="+i);
    run("Paste");
  }
  setBatchMode(false);
  run("Select None");
} // end projectStackVariableWidth()













-----Original Message-----
From: ImageJ Interest Group [mailto:[hidden email]] On Behalf Of Graeme Ball
Sent: Friday, August 02, 2013 8:28 AM
To: [hidden email]
Subject: Re: Frame average plugin (4D HyperStack)

Hi Jose,

I wrote something similar to average time frames over a window ("Trails"
plugin):-
https://github.com/graemeball/IJ_Temporal

It wasn't working properly with hyperstacks, so I fixed it up over the last few days - apologies for not mentioning it earlier, but I wanted to get it working properly first.

Regards,

Graeme


On Fri, Aug 2, 2013 at 11:58 AM, José María Mateos <[hidden email]>wrote:

> I ended up coding it. It is very fast, in case anyone wants to use it:
>
>
> https://github.com/HGGM-LIM/limtools/blob/master/src/main/java/limtool
> s/Average_Frames.java
>
> It is part of a .jar library that I am putting together with
> miscelaneous plugins that have been developed (or are being developed
> now) in the Medical Imaging Laboratory (http://image.hggm.es). It also
> includes the Dynamic Pixel Inspector that I announced some days ago.
> The JAR file can be downloaded from
> https://github.com/HGGM-LIM/limtools/releases
>
> Best,
>
> José.
>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html
>

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html