setTool("polyline"); waitForUser("Draw a line along the shaft of the dendrite. Change Line Width as needed to cover dendrite."); //get current positions and return later getDisplayedArea(x, y, dwidth, dheight); getSelectionCoordinates(xp, yp);//save selected area Stack.getPosition(channel, slice, frame);// - Returns the current position. print(channel, slice, frame); zoom=getZoom(); // get mean in each channel for branch if (selectionType==-1) exit("Area selection required"); Stack.setChannel(1); getStatistics(area, ch1Mean, min, max, std, histogram); print(ch1Mean+" ch1 Mean"); Stack.setChannel(2); getStatistics(area, ch2Mean, min, max, std, histogram); print(ch2Mean+" ch2 Mean"); Stack.setChannel(3); getStatistics(area, ch3Mean, min, max, std, histogram); print(ch3Mean+" ch3 Mean"); print(ch1Mean/ch2Mean+" Ch1:Ch2 ratio"); print(ch1Mean/ch3Mean+" Ch2:Ch3 ratio"); origTitle=getTitle(); //if exists delete the normalized channel //Stack.getDimensions(width, height, channels, slices, frames) ; //if (channels>3){ // Stack.setChannel(5); // run("Delete Slice", "delete=channel"); // Stack.setChannel(4); // run("Delete Slice", "delete=channel"); //} Stack.getDimensions(width, height, channels, slices, frames) ; //if(bitDepth()!=16 || channels==3){ //The below is for a first run case. ObjectJ needs to be closed for this to work. waitForUser("Close ObjectJ before proceeding. This will note make it happy.");// Next time, you should be able to leave it open."); //modify and create new synaptic channels run("Split Channels"); //16 bit cov here bc crashes in entire stack up there selectImage("C1-"+origTitle); run("16-bit"); selectImage("C2-"+origTitle); run("16-bit"); run("Duplicate...", "duplicate"); rename("C4-"+origTitle); run("Multiply...", "value="+ch1Mean/ch2Mean+" stack"); imageCalculator("Subtract stack", "C4-"+origTitle, "C1-"+origTitle); setMinAndMax(ch1Mean/ch2Mean*2,ch1Mean/ch2Mean*15); selectImage("C3-"+origTitle); run("16-bit"); run("Duplicate...", "duplicate"); rename("C5-"+origTitle); run("Multiply...", "value="+ch1Mean/ch3Mean+" stack"); imageCalculator("Subtract stack", "C5-"+origTitle, "C1-"+origTitle); run("Merge Channels...", "c1=[C1-"+origTitle+"] c2=[C2-"+origTitle+"] c3=[C3-"+origTitle+"] c4=[C4-"+origTitle+"] c5=[C5-"+origTitle+"] create"); /** }else{ print("in option 2"); autoUpdate(false); //Stack.setPosition(channel, slice, frame); Stack.getDimensions(width, height, channels, slices, frames) ; for (i=1;i<=slices;i++){ ch1P=newArray(width*height); ch2P=ch1P; ch3P=ch1P; setSlice(i*5+0); //Stack.setPosition(1,i,1); c=0; for (w=0;w