Iterating through a list of image each requiring calibration

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Iterating through a list of image each requiring calibration

felipeds
Hello,

I'm attempting to do the following with the code at the bottom with no success.

1. prompt user for a directory list
2. for image 1 make rectangles for each OD calibration point on step guide and record as results 1-10
3. apply calibration function
4. delete calibration points from results list
5. make ovals on multiwell plates for each well and record to results list
6. start over for image 2 then 3 and so on...

During the first image's run I see the correct results. The problem is all subsequent runs modifies the values of the first run then the second and so on. I think the problem is with IJ.deleteRows(0, 10); but deleting it doesn't seem to solve the problem of getting very large values in groups of 11. I've also posted output from 3 images by running the code below and what I'm suppossed to be getting by running just the analysis portion 3 times.

Code:

input = getDirectory("Choose Source Directory");

setBatchMode(true);
list = getFileList(input);
for (i = 0; i < list.length; i++)
        action(input, list[i]);
setBatchMode(false);

function action(input, filename) {
open(input + filename);

run("8-bit");
run("Flip Horizontally");

makeRectangle(966, 3288, 48, 138);
run("Measure");
makeRectangle(1074, 3298, 48, 138);
run("Measure");
makeRectangle(1200, 3300, 48, 138);
run("Measure");
makeRectangle(1332, 3298, 48, 138);
run("Measure");
makeRectangle(1460, 3294, 48, 138);
run("Measure");
makeRectangle(1590, 3284, 48, 138);
run("Measure");
makeRectangle(1718, 3284, 48, 138);
run("Measure");
makeRectangle(1854, 3288, 48, 138);
run("Measure");
makeRectangle(1978, 3282, 48, 138);
run("Measure");
makeRectangle(2108, 3294, 48, 138);
run("Measure");
makeRectangle(2236, 3302, 48, 138);
run("Measure");
run("Calibrate...", "function=[y = a+b*ln(x-c)] unit=OD text1=[208.53 150.24 110.57 79.12

54.77 38.82 30.76 27.62 25.02 24.07 23.44 ] text2=[0.05 0.2 0.35 0.49 0.64 0.79 0.93 1.08 1.22

1.37 1.51]");
IJ.deleteRows(0, 10);

makeOval(3877, 384, 269, 440);
run("Measure");
makeOval(3877, 1000, 269, 440);
run("Measure");
makeOval(3877, 1608, 269, 440);
run("Measure");
makeOval(3877, 2224, 269, 440);
run("Measure");
makeOval(3269, 376, 269, 440);
run("Measure");
makeOval(3277, 1000, 269, 440);
run("Measure");
makeOval(3277, 1608, 269, 440);
run("Measure");
makeOval(3269, 2216, 269, 440);
run("Measure");
makeOval(2669, 384, 269, 440);
run("Measure");
makeOval(2669, 992, 269, 440);
run("Measure");
makeOval(2677, 1608, 269, 440);
run("Measure");
makeOval(2661, 2224, 269, 440);
run("Measure");
makeOval(1485, 368, 269, 440);
run("Measure");
makeOval(1477, 992, 269, 440);
run("Measure");
makeOval(1477, 1600, 269, 440);
run("Measure");
makeOval(1493, 2208, 269, 440);
run("Measure");
makeOval(877, 384, 269, 440);
run("Measure");
makeOval(877, 992, 269, 440);
run("Measure");
makeOval(877, 1600, 269, 440);
run("Measure");
makeOval(885, 2208, 269, 440);
run("Measure");
makeOval(285, 376, 269, 440);
run("Measure");
makeOval(277, 992, 269, 440);
run("Measure");
makeOval(277, 1600, 269, 440);
run("Measure");
makeOval(293, 2216, 269, 440);
run("Measure");
makeOval(1485, 3984, 269, 440);
run("Measure");
makeOval(1477, 4592, 269, 440);
run("Measure");
makeOval(1485, 5208, 269, 440);
run("Measure");
makeOval(1493, 5816, 269, 440);
run("Measure");
makeOval(885, 3984, 269, 440);
run("Measure");
makeOval(885, 4592, 269, 440);
run("Measure");
makeOval(885, 5208, 269, 440);
run("Measure");
makeOval(885, 5816, 269, 440);
run("Measure");
makeOval(293, 3984, 269, 440);
run("Measure");
makeOval(285, 4592, 269, 440);
run("Measure");
makeOval(285, 5208, 269, 440);
run("Measure");
makeOval(285, 5816, 269, 440);
run("Measure");
makeOval(3885, 3976, 269, 440);
run("Measure");
makeOval(3885, 4592, 269, 440);
run("Measure");
makeOval(3885, 5208, 269, 440);
run("Measure");
makeOval(3885, 5816, 269, 440);
run("Measure");
makeOval(3277, 3976, 269, 440);
run("Measure");
makeOval(3277, 4592, 269, 440);
run("Measure");
makeOval(3269, 5208, 269, 440);
run("Measure");
makeOval(3269, 5816, 269, 440);
run("Measure");
makeOval(2669, 3968, 269, 440);
run("Measure");
makeOval(2677, 4592, 269, 440);
run("Measure");
makeOval(2677, 5200, 269, 440);
run("Measure");
makeOval(2669, 5816, 269, 440);
run("Measure");

close();
}

Results from Code:

219.192
156.537
114.495
83.053
57.984
43.206
34.54
31.212
28.564
27.828
26.555
0.288
0.287
0.289
0.274
0.274
0.279
0.276
0.267
0.273
0.276
0.275
0.263
0.275
0.279
0.277
0.267
0.275
0.278
0.28
0.268
0.286
0.292
0.29
0.275
0.273
0.276
0.276
0.262
0.273
0.273
0.274
0.26
0.282
0.285
0.282
0.268
0.304
0.307
0.305
0.287
0.287
0.291
0.29
0.272
0.282
0.286
0.284
0.268
219.013
156.591
114.671
83.07
58.152
43.41
34.848
31.57
28.862
28.155
26.776
0.287
0.288
0.29
0.275
0.275
0.279
0.276
0.267
0.273
0.276
0.275
0.263
0.275
0.279
0.277
0.267
0.275
0.277
0.279
0.267
0.285
0.291
0.289
0.274
0.273
0.276
0.276
0.262
0.273
0.273
0.274
0.259
0.281
0.284
0.282
0.267
0.304
0.307
0.305
0.287
0.286
0.29
0.288
0.272
0.281
0.285
0.284
0.268
219.027
156.543
114.624
83.1
58.149
43.408
34.763
31.505
28.84
28.12
26.871
0.287
0.288
0.289
0.275
0.274
0.278
0.276
0.267
0.273
0.275
0.276
0.263
0.275
0.279
0.276
0.266
0.275
0.277
0.279
0.267
0.285
0.291
0.289
0.275
0.273
0.275
0.276
0.261
0.273
0.273
0.274
0.259
0.281
0.285
0.282
0.267
0.304
0.307
0.305
0.287
0.287
0.291
0.29
0.272
0.282
0.286
0.284
0.268


I should be getting:

0.288
0.287
0.289
0.274
0.274
0.279
0.276
0.267
0.273
0.276
0.275
0.263
0.275
0.279
0.277
0.267
0.275
0.278
0.28
0.268
0.286
0.292
0.29
0.275
0.273
0.276
0.276
0.262
0.273
0.273
0.274
0.26
0.282
0.285
0.282
0.268
0.304
0.307
0.305
0.287
0.287
0.291
0.29
0.272
0.282
0.286
0.284
0.268
0.287
0.288
0.29
0.275
0.275
0.279
0.276
0.267
0.273
0.276
0.275
0.263
0.275
0.279
0.277
0.267
0.275
0.277
0.279
0.267
0.285
0.291
0.289
0.274
0.273
0.276
0.276
0.262
0.273
0.273
0.274
0.259
0.281
0.284
0.282
0.267
0.304
0.307
0.305
0.287
0.286
0.29
0.288
0.272
0.281
0.285
0.284
0.268
0.287
0.288
0.289
0.275
0.274
0.278
0.276
0.267
0.273
0.275
0.276
0.263
0.275
0.279
0.276
0.266
0.275
0.277
0.279
0.267
0.285
0.291
0.289
0.275
0.273
0.275
0.276
0.261
0.273
0.273
0.274
0.259
0.281
0.285
0.282
0.267
0.304
0.307
0.305
0.287
0.287
0.291
0.29
0.272
0.282
0.286
0.284
0.268