//Kalen edits //12/1/14 added option for Nothing Markers in previous images //12/2/14 changed //Vars have to be defined at the top of the file, else some hard to fix errors occur. //variable below saves Z state var Zext = 0; var ALock = 0; var tempSave = 0; //Variables here are for Emad's functions below var alignMe = newArray(); var theOrigin = -1; var alignmentOption = ""; var applyMarkersToPrevious = "Yes"; //Gets the toolbar ready for objectJ analysis macro "Lock Alt Key On or Off for Scrolling ESC aborts Action Tool - C037T0b11AT8b09cTcb09t" { run("Action Bar","/plugins/ActionBar/_Kalensbar.txt"); } macro "Go to Object Action Tool - C037O00aaL99ff" { //This finds markers based on what they are labeled as on an image //if (isKeyDown("shift")) ojnum=getNumber("Go to Object # on all sessions ", 0); currentimage=ojImageLink(); firstoncurrentimage=ojFirstObject(currentimage); zoom=getZoom(); print("after get zoom"); totalimages=ojNImages(); for (n=1; n<=totalimages; n=n+1){ if (n != currentimage) { firstonimage=ojFirstObject(n); relativeid=ojnum+firstonimage-1; ojShowImage(n); ojShowObject(relativeid); yoj=ojYPos(1); xoj=ojXPos(1); ojZoom(zoom,xoj,yoj); } } // To return the view to the start ojShowImage(currentimage); ojShowObject(ojnum+firstoncurrentimage-1); yoj=ojYPos(1); xoj=ojXPos(1); ojZoom(zoom,xoj,yoj); } macro "Set all channels Action Tool - C059T3e16C" { //This finds markers based on what they are labeled as on an image currentimage=ojImageLink(); var min=newArray(3); var max=newArray(3); ok = getBoolean("The display range of the current\n" +"image will be propagated to all open images."); if (!ok) exit(); for (i=0; i<3; i++){ Stack.setChannel(i+1); getMinAndMax(min[i], max[i]); } totalimages=ojNImages(); for (n=1; n<=totalimages; n=n+1){ if (n != currentimage) { ojShowImage(n); for (i=0; i<3; i++){ Stack.setChannel(i+1); setMinAndMax(min[i], max[i]); } } } // To return the view to the start ojShowImage(currentimage); Stack.setChannel(2) ; } //These are EMADS tools to do alignment inside ImageJ //These are EMADS tools to do alignment inside ImageJ macro "Align select images Action Tool - C059T3e16A " { var alignMeStr = "" while (alignMe.length == 0 || theOrigin == -1) { // turn alignMe into a string for (anI = 0; anI < alignMe.length-1; anI++) { alignMeStr = alignMeStr + alignMe[anI] + ","; } if (alignMe.length != 0) { alignMeStr = alignMeStr + alignMe[alignMe.length-1]; } showMessage("Error", "You haven't designated images that you want to align, or you haven't chosen an origin. Fix that."); // prompt for values //KB removed need for 0 indexing var alignChoices = newArray("No", "Yes"); Dialog.create("Set origin and images to align"); Dialog.addNumber("Number of origin image", theOrigin); Dialog.addString("Comma separated values of images to align ie 1,2,3,4", alignMeStr, 24); Dialog.addChoice("Overwrite non Landmark points in non Origin images above?", alignChoices, alignmentOption); Dialog.addChoice("Place empty markers in previous sessions?", alignChoices, applyMarkersToPrevious); Dialog.show(); theOrigin = Dialog.getNumber(); alignMe = split(Dialog.getString(), ","); alignmentOption = Dialog.getChoice(); applyMarkersToPrevious = Dialog.getChoice(); } // turn alignMe into a string for (anI = 0; anI < alignMe.length-1; anI++) { alignMeStr = alignMeStr + alignMe[anI] + ","; } if (alignMe.length != 0) { alignMeStr = alignMeStr + alignMe[alignMe.length-1]; } // ask the user for some confirmation var alignMeStr = ""; for (anI = 0; anI < alignMe.length-1; anI++) { alignMeStr = alignMeStr + alignMe[anI] + ","; } if (alignMe.length != 0) { alignMeStr = alignMeStr + alignMe[alignMe.length-1]; } if (getBoolean("You are about to align the following images: [" + alignMeStr + "] with image number " + theOrigin + " as the origin. Are you sure?")) { run("ptReg ", "command=doAlign align="+ alignMeStr + " origin=" + theOrigin + " overwrite=" + alignmentOption+ " emptyMarkers="+ applyMarkersToPrevious); showMessage("done"); } //for (anI = 0; anI < alignMe.length; anI++) //{ // toAlign = parseInt(alignMe[anI]); // if (theOrigin != toAlign) // { // showMessage("aligning " + toAlign + " with origin " + theOrigin); //call("PtRegger.class.registerTwo", toAlign, theOrigin); //call("PtRegger.class.applyPoints", toAlign, theOrigin); // } //} } macro "Align select images Action Tool Options" { // turn alignMe into a string var alignMeStr = ""; for (anI = 0; anI < alignMe.length-1; anI++) { alignMeStr = alignMeStr + alignMe[anI] + ","; } if (alignMe.length != 0) { alignMeStr = alignMeStr + alignMe[alignMe.length-1]; } var alignChoices = newArray("No", "Yes"); var alignChoices2 = newArray("No", "Yes"); Dialog.create("Set origin and images to align"); Dialog.addNumber("Number of origin image", theOrigin); Dialog.addString("Comma separated values of images to align", alignMeStr, 24); Dialog.addChoice("Overwrite non Landmark points in non Origin images above?", alignChoices, alignmentOption); Dialog.addChoice("Place empty markers in previous sessions?", alignChoices2, applyMarkersToPrevious); Dialog.show(); theOrigin = Dialog.getNumber(); alignMe = split(Dialog.getString(), ","); alignmentOption = Dialog.getChoice(); applyMarkersToPrevious = Dialog.getChoice(); } macro "Extend Z Action Tool - C059T3e16Z " { if (Zext == 0){ Zext = 1; numberper=getNumber("Value visible +- marked Z plane : ", 1); ojExtendVisibilityDepth(numberper, numberper); } else { Zext = 0; ojExtendVisibilityDepth(0, 0); } } macro "Move markers to one channel Action Tool - C059T3e16M " { channel=getNumber("Move all markers to channel: ", 1); imnum=1; totalimages=ojNImages(); first=ojFirstObject(imnum); next=ojFirstObject(imnum+1); idlast=-1; //the below fills out the column headers if (nResults>=0) run("Clear Results"); // Check whether the results table is empty, if not clear it. i = nResults; // variable for counting, initialising with 0 setResult("Marker", 0, 0); setResult("Imageid", 0,0 ); setResult("X", 0, 0); setResult("Y", 0, 0); setResult("Z", 0, 0); setResult("SpineWithPSD",0,0 ); setResult("InhibitoryShaft",0,0 ); setResult("SpineWithInhibitorySynapse",0,0 ); setResult("NudeSpine",0,0 ); setResult("Nothing",0,0 ); setResult("Landmark",0,0); for (n=1; n<=ojNObjects(); n++) { if (n==next){ imnum++; ojShowImage(imnum); wait(20); next=ojFirstObject(imnum+1); } setResult("Marker", n-1, n); setResult("Imageid", n-1, imnum ); ojShowObject(n); X=ojXPos(1); Y=ojYPos(1); Z=ojZPos(1); //subtract remainder to equal ch1 //ex slice 1=ch1 2 ch2 3 ch3 4 ch1 chose ch1 to set so 4-(4-1)%3=4 5-(5-1)%3=4 =6-(6-1)%3=4 //channel -1 sets to 4 if ch1 5 if ch2 and 6 if ch3 Z=Z-(Z-1)%3+(channel-1); setResult("X", n-1, X); setResult("Y", n-1, Y); setResult("Z", n-1, Z); setResult(ojSelectedItemName(), n-1,1 ); } updateResults(); ojDeleteAllObjects(); idlast=0; for (n=0; n