// Register_Coverslip_Zeiss macro by Christophe Leterrier // Calculates new positions based on the original and new positions of two reference points // Used for repetitive imaging of neurons // Works with Axiovision stage positions files: generates a new file from an "original positions" file and a "new positions" file containing only the two new positions of the reference points // Computed transformation is XY rotation + translation, plus a mean Z offset // 18/11/2011 First commented version macro Register_Coverlip_Zeiss { //Gets two Zeiss position export files : one with the original positions, another with the new position of reference points (2 points) OriPath=File.openDialog("Original Positions file?"); RefPath=File.openDialog("New Reference Positions file?"); OriDirPath=File.getParent(OriPath); OriFileName=File.getName(OriPath); NewDirPath=File.getParent(RefPath); NewFileName=File.getName(RefPath); // Gets the file name, and positions set name OriFile=File.openAsString(OriPath); OriLine=split(OriFile, "\n"); OriLine3=split(OriLine[2], "\""); OriName=OriLine3[0]; print("\n"); print("*** Register Coverlip Zeiss Log ***"); print("Original Positions Path: "+OriPath); print("Original Positions Name: "+OriName); // Gets the number of positions to initialize the original positions arrays OriLength=OriLine.length; OriPosNumber=OriLength-8; // Defines the name, X and Y original positions arrays OriPosName=newArray(OriPosNumber); OriX=newArray(OriPosNumber); OriY=newArray(OriPosNumber); OriZ=newArray(OriPosNumber); // Loops on all positions to feed the original positions array for (i=7; i