//Kalen edits //12/1/14 added option for Nothing Markers in previous images //12/2/14 changed ("SpineWithInhibitorySynapse" category names //12/5/14 added error checking to the alignment option; //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 = ""; var numAlignErrorBool=false; var numAlignErrorString = ""; 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(); } // confirm that the assumption of the origin having the most possible landmarks is true numOrigin=ojLastObject(theOrigin)-ojFirstObject(theOrigin)+1; for (anI = 0; anI < alignMe.length; anI++) { // turn alignMe into a string that doesn't end in a comma if (anI==alignMe.length){ alignMeStr = alignMeStr + alignMe[anI]; }else{ alignMeStr = alignMeStr + alignMe[anI] + ","; } //error check for origin length numAlign=ojLastObject(alignMe[anI])-ojFirstObject(alignMe[anI])+1; if(numAlign>numOrigin){ numAlignErrorString=numAlignErrorString+ alignMe[anI] + ","; numAlignErrorBool=true; } } if (numAlignErrorBool){ showMessageWithCancel("Potential Error","The following list of images have more objects than the origin you specified.\n They will be deleted if you press ok. Pressing Cancel will not alter your project. \n\n Error Images = "+numAlignErrorString); } for (i=0;i=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