Skip to content

Commit

Permalink
keep largest
Browse files Browse the repository at this point in the history
  • Loading branch information
ElisabethKugler committed Mar 1, 2022
1 parent 27060c6 commit bea2216
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 2 deletions.
6 changes: 4 additions & 2 deletions AlternativeMacros/MGEndfeetCoverage.ijm
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,9 @@ for (e=0; e< filelistMGs.length; e++) {
saveAs("Tiff", OutDir + "MAX_" + name);

// smoothen and enhance before segmenting with Threshold
run("Median...", "radius=3");
run("Median...", "radius=2 stack");


run("Enhance Local Contrast (CLAHE)", "blocksize=127 histogram=256 maximum=3 mask=*None* fast_(less_accurate)");
// segmentation with Otsu Threshold
run("Threshold...");
Expand All @@ -95,7 +97,7 @@ for (e=0; e< filelistMGs.length; e++) {

run("Invert", "stack"); // it measures the white as MG endfeet
saveAs("Tiff", OutDir + "MAX_TH_" + name);
run("Invert", "stack");
// run("Invert", "stack");

// for timelapse - need to iterate over the individual timepoints
if (frames > 1){ // if more than one timeframe it is a timelapse
Expand Down
16 changes: 16 additions & 0 deletions Macros/step8_QuantificationTool.ijm
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ run("Set Measurements...", "area mean standard min centroid center perimeter bou
var imgName="";
var shortTitle = "";
var column_label = "";
var halfPos = 10;

///// open images from inputfolder for overall quantification, EDM, and skeletonization
for (i=0; i< sortedFilelist.length; i++) {
Expand All @@ -71,7 +72,17 @@ for (i=0; i< sortedFilelist.length; i++) {
print("processing ... " + sortedFilelist[i]);

open(path + sortedFilelist[i]);

getDimensions(width, height, channels, slices, frames);

halfPos = round(slices / 2);
setSlice(halfPos);

run("Make Binary", "method=Default background=Default");
run("Keep Largest Region"); // from MorpholibJ to keep largest region and remove anything unconnected
wait(3000);


Quantification(sortedFilelist[i]); // call function quantification

close("*");
Expand Down Expand Up @@ -138,6 +149,8 @@ function Quantification(title){
getDimensions(width, height, channels, slices, frames);
getPixelSize(unit,pixelWidth,pixelHeight,voxelDepth);
volVox = pixelWidth * pixelHeight * voxelDepth;
setSlice(halfPos);


run("Histogram", "stack");
// [255] is MG Vox
Expand All @@ -153,10 +166,13 @@ function Quantification(title){
// surface smoothing
run("Median 3D...", "x=6 y=6 z=6");
wait(3000);

setSlice(halfPos);
run("Make Binary", "method=Default background=Default"); // binarize after smoothing

// 3D EDM for thickness
run("Duplicate...", "title=For3DEDM duplicate");
wait(2000);
selectWindow("For3DEDM");
run("Geometry to Distance Map", "threshold=1");
run("Green Fire Blue"); // assign LUT green-fire-blue
Expand Down

0 comments on commit bea2216

Please sign in to comment.