home *** CD-ROM | disk | FTP | other *** search
Text File | 1991-03-25 | 2.3 KB | 107 lines | [TEXT/MSWD] |
- macro 'Convert Line Plot to Points [C]';
- {
- Requires a binary image conatining a black plot on a white
- background. Select the plot before running this macro. It may be
- necessary to increase Max Measurements in Options.
- }
- var
- left,top,width,height,i:integer;
- begin
- GetRoi(left,top,width,height);
- if width=0 then begin
- PutMessage('Please select the line plot.');
- exit;
- end;
- Duplicate('Particles');
- i:=0;
- SetForegroundColor(0);
- SetLineWidth(1);
- repeat
- MoveTo(i,0);
- LineTo(i,height);
- i:=i+2;
- until i>width;
- RotateRight(true);
- MeasureArea(false);
- MeasureDensity(false);
- MeasureXY(true);
- LabelParticles(false);
- SetParticleSize(1,999999);
- InvertY(false);
- AnalyzeParticles;
- end;
-
-
- macro 'Plot Points [P]';
- {
- Plots the data points contained in the X and Y results columns. Note
- that X and Y are reversed because Analyze Particles scans from top
- to bottom, not left to right.
- }
- var
- xmin,xmax,ymin,ymax,i,xscale,yscale:real;
- width,height,margin,pwidth,pheight:integer;
- begin
- margin:=40;
- width:=500;
- height:=300;
- xmin:=999999;
- xmax:=-999999;
- ymin:=999999;
- ymax:=-999999;
- for i:=1 to rCount do begin
- if rX[i]<xmin then xmin:=rX[i];
- if rX[i]>xmax then xmax:=rX[i];
- if rY[i]<ymin then ymin:=rY[i];
- if rY[i]>ymax then ymax:=rY[i];
- end;
- SetNewSize(width,height);
- MakeNewWindow('Plot');
- pwidth:=width-2*margin;
- pheight:=height-2*margin;
- xscale:=pheight/(xmax-xmin);
- yscale:=pwidth/(ymax-ymin);
- SetForeground(255);
- SetBackground(0);
- MoveTo(margin,margin);
- for i:=1 to rCount do begin
- LineTo(margin+(rY[i]-ymin)*yscale,margin+(rX[i]-xmin)*xscale);
- end;
- MakeRoi(margin,margin,pwidth+1,pheight+2);
- MoveTo(margin,margin);
- LineTo(margin+pwidth,margin);
- MoveTo(margin,margin);
- LineTo(margin,margin+pheight);
- FlipVertical;
- KillRoi;
- SetFont('Geneva');
- SetFontSize(9);
- SetText('Centered');
- MoveTo(margin+4,margin+pheight+12);
- writeln(ymin:1:2);
- MoveTo(margin+pwidth,margin+pheight+12);
- writeln(ymax:1:2);
- SetText('Right Justified');
- MoveTo(margin-2,margin+pheight-5);
- writeln(xmin:1:2);
- MoveTo(margin-2,margin);
- writeln(xmax:1:2);
- end;
-
-
- macro 'Clear Outside [O]'
- {Outline the line plot with the wand tool and then use this macro to}
- {erase everything else.}
- begin
- Copy;
- SelectAll;
- Clear;
- RestoreRoi;
- Paste;
- KillRoi;
- end;
-
-
-
-
-