Skip to content
Snippets Groups Projects
Commit 1e532a76 authored by Marius Hintsche's avatar Marius Hintsche
Browse files

remove contrast stretching of projections

parent 4b1b2d8b
No related branches found
No related tags found
No related merge requests found
...@@ -31,10 +31,8 @@ stackMem = getWidth()*getHeight()*bitDepth()/8*subStackSize; ...@@ -31,10 +31,8 @@ stackMem = getWidth()*getHeight()*bitDepth()/8*subStackSize;
if (stackMem > maxMem) { if (stackMem > maxMem) {
exit("Substack is too large for available memory"); exit("Substack is too large for available memory");
} }
//FIXME calculate iMax correctly for overlaps //FIXME calculate iMax correctly for non zero overlaps
iMax = floor(nSlices()/subStackSize)+1; iMax = floor(nSlices()/subStackSize)+1;
//TODO allocate stack memory before running the loop. The programm will then
// fail right in the beginning if not enough memory is available.
methodPrefix = replace(method,' ','-'); methodPrefix = replace(method,' ','-');
resultName = methodPrefix; resultName = methodPrefix;
inputInfo = getImageInfo; inputInfo = getImageInfo;
...@@ -87,7 +85,7 @@ for (i=0; i<iMax; i++) { ...@@ -87,7 +85,7 @@ for (i=0; i<iMax; i++) {
} }
selectImage(resultName); selectImage(resultName);
setSlice(1); setSlice(1);
run("Enhance Contrast...", "saturated=0.4 process_all"); //run("Enhance Contrast...", "saturated=0.4 process_all");
if (saveToDisk) { if (saveToDisk) {
saveAs("Tiff",basePath+inputName+"_"+resultName+"-grouped"); saveAs("Tiff",basePath+inputName+"_"+resultName+"-grouped");
} }
...@@ -98,6 +96,7 @@ walltime = (tStop-tStart)/1000/60; ...@@ -98,6 +96,7 @@ walltime = (tStop-tStart)/1000/60;
print("Done! (took "+d2s(walltime,1)+" min to process "+i+" substacks."); print("Done! (took "+d2s(walltime,1)+" min to process "+i+" substacks.");
print(progressTitle, "\\Close"); print(progressTitle, "\\Close");
//Subfunctions
function calculateProjection(iStart,iStop,resultTitle,method) { function calculateProjection(iStart,iStop,resultTitle,method) {
run("Duplicate...", "title="+resultTitle+" duplicate range="+iStart+"-"+iStop); run("Duplicate...", "title="+resultTitle+" duplicate range="+iStart+"-"+iStop);
if (nSlices>1) { if (nSlices>1) {
...@@ -105,12 +104,14 @@ function calculateProjection(iStart,iStop,resultTitle,method) { ...@@ -105,12 +104,14 @@ function calculateProjection(iStart,iStop,resultTitle,method) {
} }
} }
//add projection in2 to existing result stack in2
function addSlice(resultTitle,in1,in2) { function addSlice(resultTitle,in1,in2) {
run("Concatenate...", " title=["+resultTitle+"] image1="+in1+" image2="+in2); run("Concatenate...", " title=["+resultTitle+"] image1="+in1+" image2="+in2);
showStatus("Grouped Stack Proj. ("+i+"/"+iMax+"):"); showStatus("Grouped Stack Proj. ("+i+"/"+iMax+"):");
showProgress(i/iMax); showProgress(i/iMax);
} }
//get string representation of progress bar with p1 out of p2 done
function getBar(p1, p2) { function getBar(p1, p2) {
n = 20; n = 20;
bar1 = "--------------------"; bar1 = "--------------------";
...@@ -120,4 +121,4 @@ function getBar(p1, p2) { ...@@ -120,4 +121,4 @@ function getBar(p1, p2) {
if (index>n-1) index = n-1; if (index>n-1) index = n-1;
return substring(bar2, 0, index) + substring(bar1, index+1, n); return substring(bar2, 0, index) + substring(bar1, index+1, n);
} }
} }
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment