File: ConvertStackToBinary.txt

package info (click to toggle)
skyview 3.5.6%2Brepack-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 2,288 kB
  • sloc: java: 29,138; perl: 208; xml: 63; makefile: 19; sh: 1
file content (19 lines) | stat: -rw-r--r-- 484 bytes parent folder | download | duplicates (13)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
// Converts a stack to binary using locally calculated thresholds

  setBatchMode(true);
  run("Select None");
  run("8-bit");
  id = getImageID;
  for (i=1; i<=nSlices; i++) {
     setSlice(i);
     run("Duplicate...", "title=temp");
     run("Convert to Mask");
     invertingLUT = is("Inverting LUT");
     run("Copy");
     close;
     selectImage(id);
     run("Paste");
     if (i==1 && invertingLUT != is("Inverting LUT"))
         run("Invert LUT");
  }
  run("Select None");