Login  Register

Re: Screening of images in stack import - ignoring certain

Posted by Rasband, Wayne (NIH/NIMH) [E] on Jan 04, 2016; 2:33am
URL: http://imagej.273.s1.nabble.com/Screening-of-images-in-stack-import-ignoring-certain-tp5015306p5015313.html

> On Jan 2, 2016, at 8:15 AM, burt46 <[hidden email]> wrote:
>
> Hi,
>
> I am importing timelapse images as a stack from a folder, all images were
> taken at a fixed camera position. However, i have a problem whereby the sun
> position at a certain time of day generates a white out on some images.
> Rather than manually delete these before importing the stack is there a way
> that ImageJ can pre-filter images of a certain threshold and chose not to
> import them or not to include them in a post process analysis?

You can do this using a macro like the one below. It asks the user to choose a folder, imports all the images in the folder as a stack and then deletes the images in the stack that have a threshold exceeding a specified value.

-wayne

  threshold = 1000;
  dir = getDirectory("Choose folder");
  run("Image Sequence...", "open=&dir sort");
  for (i=nSlices; i>=1; i--) {
    setSlice(i);
    setAutoThreshold("Default dark");
    getThreshold(t1, t2);
    msg = "";
    if (t1>threshold) {
       run("Delete Slice");
       msg = "(deleted)";
    }
    print(i, t1, msg);
  }
  resetThreshold;


> --
> View this message in context: http://imagej.1557.x6.nabble.com/Screening-of-images-in-stack-import-ignoring-certain-tp5015306.html
> Sent from the ImageJ mailing list archive at Nabble.com.

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