home *** CD-ROM | disk | FTP | other *** search
/ Mac Expert 1995 Winter / Mac Expert - Winter 95.iso / Les fichiers / Utilitaires divers / Images / Image 1.37 ƒ / Macros / Measurement Macros < prev    next >
Encoding:
Text File  |  1991-03-08  |  3.4 KB  |  172 lines  |  [TEXT/MSWD]

  1. macro 'Measure All';
  2. {Measures all currently open images using the current selection. There is}
  3. {an implied "Select All" if the active image doesn't have a selection.}
  4. var
  5.   i,left,top,width,height:integer;
  6. begin
  7.   ResetCounters;
  8.   for i:=1 to nPics do begin
  9.     SelectPic(i);
  10.     RestoreROI;
  11.     Measure;
  12.   end;
  13. end;
  14.  
  15.  
  16. macro 'Measure All from Disk';
  17. {
  18. Reads from disk and measures a set of images too large to simultaneously
  19. fit in memory. The image names names must be in the form '01', '02', etc.
  20. Before starting, open and outline the first image('01').
  21. }
  22. var
  23.   i,width,height:integer;
  24. begin
  25.   GetPicSize(width,height);
  26.   if width=0 then begin
  27.     PutMessage('Before running this macro, open and outline the first image("01") in the series.');
  28.     exit;
  29.   end;
  30.   ResetCounters;
  31.   Measure;
  32.   close;
  33.   for i:=2 to 1000 do begin
  34.     open(i:2);
  35.     RestoreROI;
  36.     Measure;
  37.     close;
  38.   end;
  39. end;
  40.  
  41.  
  42. macro 'Paste Results [P]'
  43. {Use the Measure command, the ruler tool, or the pointing tool to}
  44. {make up to about 10 measurements, then use this macro to paste}
  45. {the results into the upper left corner of the window.}
  46. begin
  47.   SetFont('Monaco');
  48.   SetFontSize(9);
  49.   SetText('Plain');
  50.   SetOption; {Copy headings}
  51.   CopyResults;
  52.   MakeRoi(-10,0,200,200);
  53.   Paste;
  54.   KillRoi;
  55.   ResetCounters;
  56. end;
  57.  
  58.  
  59. macro 'Measure Redirected'
  60. begin
  61.   Redirect(true);
  62.   Measure;
  63.   Redirect(false);
  64.   MarkSelection;
  65.   RestoreRoi;
  66. end;
  67.  
  68.  
  69. macro 'Analyze Non-rectangular'
  70. {Lets you use Analyze Particles}
  71. {with nonrectangular selection.}
  72. begin
  73.   Copy;
  74.   SelectAll;
  75.   Clear;
  76.   RestoreRoi;
  77.   Paste;
  78.   KillRoi;
  79.   AnalyzeParticles;
  80. end;
  81.  
  82.  
  83. macro 'Reset Analysis Options';
  84. {Resets the Options dialog box in the Analyze menu to the default settings.}
  85. begin
  86.   MeasureArea(true);
  87.   MeasureDensity(true);
  88.   MeasureStandardDeviation(false);
  89.   MeasureXY(false);
  90.   MeasureMode(false);
  91.   MeasurePerimeter(false);
  92.   MeasureMajorAxis(false);
  93.   MeasureMinorAxis(false);
  94.   MeasureAngle(false);
  95.   MeasureIntegratedDensity(false);
  96.   Redirect(false);
  97.   LabelParticles(true);
  98.   OutlineParticles(false);
  99.   IgnoreParticlesTouchingEdge(false);
  100.   IncludeInteriorHoles(false);
  101.   WandAutoMeasure(false);
  102.   AdjustAreas(false);
  103.   SetParticleSize(1,999999);
  104.   SetPrecision(2);
  105. end;
  106.  
  107.  
  108. macro 'Set Threshold';
  109. var
  110.   lower,upper:integer;
  111. begin
  112.   lower:=GetNumber('Lower:',1);
  113.   upper:=GetNumber('Upper:',254);
  114.   SetDensitySlice(lower,upper);
  115. end;
  116.  
  117.  
  118. macro 'Measure Accumulated Perimeter[A]';
  119. {
  120. Measures perimeter and computes accumulated perimeter,
  121. storing it in the Major Axis column.
  122. }
  123. var
  124.   i:integer;
  125.   TotalPerimeter:real;
  126. begin
  127.   MeasurePerimter(true);
  128.   SetMajorLabel('Total');
  129.   Measure;
  130.   TotalPerimeter:=0;
  131.   for i:=1 to rCount do TotalPerimeter:=TotalPerimeter+rLength[i];
  132.   rMajor[rCount]:=TotalPerimeter;
  133.   UpdateResults;
  134. end;
  135.  
  136. macro 'Count Black and White Pixels [B]';
  137. {
  138. Counts the number of black and white pixels in the current
  139. selection and stores the counts in the Major and Minor Axis columns.
  140. }
  141. begin
  142.   SetMajorLabel('Black');
  143.   SetMinorLabel('White');
  144.   Measure;
  145.   rMajor[rCount]:=histogram[255];
  146.   rMinor[rCount]:=histogram[0];
  147.   UpdateResults;
  148. end;
  149.  
  150.  
  151. macro 'Compute Average and Total Area [T]';
  152. {
  153. Computes average and accumulated area and stores 
  154. the them in the Major and Minor Axis columns.
  155. }
  156. var
  157.   i:integer;
  158.   TotalArea:real;
  159. begin
  160.   SetMajorLabel('Average');
  161.   SetMinorLabel('Total');
  162.   Measure;
  163.   TotalArea:=0;
  164.   for i:=1 to rCount do TotalArea:=TotalArea+rArea[i];
  165.   rMajor[rCount]:=TotalArea/rCount;;
  166.   rMinor[rCount]:=TotalArea;
  167.   UpdateResults;
  168. end;
  169.  
  170.  
  171.  
  172.