macro 'Rotating LineScan' { defaultRotationRange=10; defaultRotationStep=1; defaultMeasureRange=2; defaultChannelPeak=1; defaultDisplayPeakOverlay=1; trackingModeAsDefault=1; title=getTitle(); Stack.getPosition(channel, slice, frame); Stack.getDimensions(width, height, channels, slices, frames); if (defaultChannelPeak>channels) defaultChannelPeak=channels; if (selectionType()!=5) exit("trace a straight line before starting the macro"); channelsList=newArray(channels); for (i=0; i1) Dialog.addChoice("Find cortex on channel:", channelsList, channelsList[defaultChannelPeak-1]); Dialog.addCheckbox("Display positions as overlays (removes current overlays)", defaultDisplayPeakOverlay); Dialog.addCheckbox("Recenter and reorient the linescan at every frame", trackingModeAsDefault); Dialog.show(); rotationRange=Dialog.getNumber(); rotationRange=-rotationRange; rotationStep=Dialog.getNumber(); sumNpixels=Dialog.getNumber(); if (channels>1) channelPeak=parseInt(Dialog.getChoice()); else channelPeak=1; peakOverlay=Dialog.getCheckbox(); trackingMode=Dialog.getCheckbox(); if (selectionType()!=5) exit("line selection required"); getLine(x1, y1, x2, y2, lineWidth); setLineWidth(lineWidth); x3=x2-(x2-x1)/2; y3=y2-(y2-y1)/2; hypotenuse=sqrt(pow(x2-x3, 2)+pow(y2-y3, 2)); if (x1>x2 && y1y2) initialAngle=acos((-abs(x3-x2))/hypotenuse); else initialAngle=acos((abs(x3-x2))/hypotenuse); if (y1>y2) initialAngle=initialAngle+PI; results=""; x4=newArray(frames); y4=newArray(frames); x5=newArray(frames); y5=newArray(frames); signal=""; if (peakOverlay==1) Overlay.remove; for (t=1; t<=frames; t++) { Stack.setChannel(channelPeak); wait(50); Stack.setFrame(t); MaxPeak=newArray((-rotationRange*2*1/rotationStep)+2); MaxPeakPosition=newArray((-rotationRange*2*1/rotationStep)+2); j=0; for (k=rotationRange*PI/180; k<=-rotationRange*PI/180; k+=rotationStep*PI/180) { scanningAngle=initialAngle+k+PI; X1=x3+cos(scanningAngle)*hypotenuse; Y1=y3+sin(scanningAngle)*hypotenuse; X2=x3+cos(scanningAngle+PI)*hypotenuse; Y2=y3+sin(scanningAngle+PI)*hypotenuse; makeLine(X1,Y1,X2,Y2,lineWidth); LineScan0=getProfile(); LineScan=newArray(lengthOf(LineScan0)); for (i=1; i