-
Notifications
You must be signed in to change notification settings - Fork 1
/
mask_creation_varun.ijm
53 lines (45 loc) · 1.26 KB
/
mask_creation_varun.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
//manual segmentation helper
// Choose the save directory for ROI SET
TargetDir = getDirectory("Choose Destination Directory To Save RoiSet ");
//pour chaque tranche
for(slice=1;slice<=nSlices;slice++)
{
if(slice==1)
{
run("Select None");
setTool("freehand");
getDimensions(width, height, channels, slices, frames);
raw=getTitle();
newImage("mask_"+raw, "8-bit black", width, height, slices);
selectWindow(raw);
waitForUser("please draw the first ROI and click OK");
selectWindow("mask_"+raw);
setSlice(1);
run("Restore Selection");
setForegroundColor(255, 255, 255);
run("Fill", "slice");
selectWindow(raw);
roiManager("Add");
}
else
{
selectWindow(raw);
setSlice(slice);
size = 15;
setTool("brush");
call("ij.gui.Toolbar.setBrushSize", size);
run("Restore Selection");
waitForUser("["+slice+"] please adjust ROI with brush tool and click OK");
selectWindow("mask_"+raw);
setSlice(slice);
run("Restore Selection");
setForegroundColor(255, 255, 255);
run("Fill", "slice");
selectWindow(raw);
roiManager("Add");
}
}
roiManager("Deselect");
roiManager("Save", TargetDir+ raw + "RoiSet" + ".zip");
print(TargetDir +replace(raw, ".tif","" ) + "RoiSet");
waitForUser("DONE");