-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCavalieriPointMask_.ijm
73 lines (67 loc) · 2.12 KB
/
CavalieriPointMask_.ijm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
// CavalieriPointMask
//
// V01.01
//
// Generate image files for regional area approximations
// Copyright (C) 2021 Dylan Terstege
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details
//
// Your should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.
//
// Created 12-09-2019 Dylan Terstege
// Epp Lab, University of Calgary
// Contact: [email protected]
setOption("JFileChooser",true);
path=getDirectory("Choose Parent Directory for your Images");
list=getFileList(path);
count=list.length;
Dialog.create("Cavalieri Point Mask");
Dialog.addMessage("Parent folder:");
Dialog.addMessage(path);
Dialog.addChoice("Raw Subfolder",list);
Dialog.addChoice("Mask Output Subfolder",list);
Dialog.show();
file1 = path+Dialog.getChoice;
list1 = getFileList(file1);
n1 = lengthOf(list1);
//
file2 = path+Dialog.getChoice;
list2 = getFileList(file2);
n2 = lengthOf(list2);
//
condition1 = n1;
condition2 = n2;
macro "batch_merge_channels"{
setBatchMode(true);
//Generate Masks
for(i = n2; i < condition1; i++) {
open(file1 + list1[i]);
title2=File.nameWithoutExtension;
run("Gaussian Blur...","sigma=200");
setAutoThreshold("Triangle dark");
run("Convert to Mask");
run("Fill Holes");
run("Invert LUT");
run("Grid...", "grid=Lines area=1156 color=Black");
run("Flatten");
run("Find Maxima...", "noise=10 output=[Single Points]");
run("Dilate");
run("Dilate");
run("Dilate");
run("Invert LUT");
saveAs("tiff", file2+title2+"_mask"+".tif");
close("*");
}
}
setOption("JFileChooser", false);
waitForUser("Processing Complete");