1+
2+
3+ //define file suffix here, can be different, czi, lif, xml, etc
4+ suffix = ".tif";
5+ //define autotrace min intensity start
6+ dMinIntStart = 30000.;
7+ //minimum lenght for autotrace
8+ nMinLength = 100;
9+
10+ // Choose input directory
11+ input = getDirectory("Input directory");
12+
13+ //clear the log window
14+ print("\\Clear");
15+
16+ // Create timestamp to save log later
17+ timestamp = getTimeStamp_sec();
18+
19+ // Get file list
20+ list = getFileList(input);
21+
22+ nCount = 0;
23+ bFirst = true;
24+
25+ for (nFile = 0; nFile < list.length; nFile++)
26+ {
27+ if(endsWith(list[nFile], suffix))
28+ {
29+ basecurr = input + list[nFile];
30+ //in case you need only filename without extension somewhere later
31+ noExtFilename = substring(list[nFile], 0, lengthOf(list[nFile])-lengthOf(suffix));
32+ nCount++;
33+ if(bFirst)
34+ {
35+ run("Open 3D image", "open=[" + basecurr + "]");
36+ bFirst = false;
37+ }
38+ else
39+ {
40+ Ext.btOpenNext(basecurr);
41+ }
42+
43+ //make a folder to store things
44+ saveDir = input + toString(nCount) + "/";
45+ File.makeDirectory(saveDir);
46+
47+ //process image in BigTrace
48+ ///set active channel for tracing (if multichannel)
49+ Ext.btSetActiveChannel(1);
50+ //maybe set other parameters, otherwise current stored (last used) will be used
51+ //....
52+
53+ //run auto-trace (all frames)
54+ Ext.btRunFullAutoTrace(dMinIntStart, nMinLength);
55+ //save ROIs in CSV
56+ Ext.btSaveROIs(saveDir + "rois.csv", "CSV");
57+ //obtain and save measurements
58+ Ext.btMeasureAndSave (saveDir + "Results.csv");
59+ //save straightened versions of ROIs
60+ //Ext.btStraighten(0, saveDir, "Round");
61+ //can save log file here too, after each volume, in case something goes wrong
62+ }
63+
64+ }
65+ Ext.btClose();
66+ selectWindow("Log");
67+ saveAs("Text", input + "BigTrace_IJmacro_" + timestamp + ".txt");
68+
69+ function getTimeStamp_sec()
70+ {
71+ // returns timestamp: yearmonthdayhourminutesecond
72+ getDateAndTime(year, month, dayOfWeek, dayOfMonth, hour, minute, second, msec);
73+
74+ TimeStamp = toString(year) + "-" + IJ.pad(month+1,2) + "-" + IJ.pad(dayOfMonth,2) + "-";
75+ TimeStamp = TimeStamp + IJ.pad(hour,2) + "-" + IJ.pad(minute,2) + "-" + IJ.pad(second,2);
76+ return TimeStamp;
77+ }
0 commit comments