Skip to content

Latest commit

 

History

History
99 lines (73 loc) · 1.83 KB

File metadata and controls

99 lines (73 loc) · 1.83 KB

Extra practical - Solution

Bug 1

Error

  • 'Circularity' column not found

Solution

  • Look at the ResultsTable column names
  • Rename 'Circularity' by 'Circ.'
rt.getValue("Circularity")

becomes

rt.getValue("Circ.")

Bug 2

Error

  • ArrayIndexOutOfBoundException
  • Trying to access an invalid array index

Solution

  • The loop goes from 0 to nROIs included = nROIs +1 iterations
  • Replace the <= by < in the for loop
for(int i = 0; i <= rois.length; i++)

becomes

for(int i = 0; i < rois.length; i++)

Bug 3

Error

  • No error message but both output images are the same

Solution

Hint: Use the debugger and add a breakpoint to see the value of the variables

  • Have a look to ImageProcessor ip & ip2 objects
imp2.setProcessor(ip);
imp3.setProcessor(ip);

becomes

imp2.setProcessor(ip2);
imp3.setProcessor(ip);

This kind of semantic errors could be avoided by naming variables with meaningful names !

imp2.setProcessor(ip2);
imp3.setProcessor(ip);

should becomes

circularityImp.setProcessor(ip2);
areaImp.setProcessor(ip);

Even better, when duplicate images, give them a meaningful title, by adding

circularityImp.setTitle("Circularity results")
areaImp.setTitle("Area results")