Issue with Process-->Batch-->Macro: Output files with correct names but wrong data!

batch-processing
macro
Tags: #<Tag:0x00007fb88330a780> #<Tag:0x00007fb88330a3c0>

#1

Hello,

  • The Input Folder consists of 50 TIFF color pictures.
  • The Output Folder does get the set of 50 images correctly named and in the right order after macro conversion to binary, Shape-Filtered, and Measured for Integrated density (IntDen).
  • Values of IntDen are orderly displayed by ImageJ output.
  • However, when the resulting binary images in the Output Folder are individually Measured for IntDen the values indicate a weird rearrangement happened whereby some file IDs (names) do not match the original ID.
  • I have noticed that for up to six images in the batch analysis everything works fine.
  • When I process 8 images the last 2 images in the list rob the ID of the first 2 images
  • I have illustrated this case in the attached sheet image
  • This becomes a real problem when a large number of images are batch processed

Please, let me know your thoughts. Thanks!!

Hector


#2

Maybe if you post the code that you are running, we might be able to help.


#3

I cannot reproduce this issue.
I tried with the following macro on Mac OSX:

tmp = getDirectory("temp");
newImage("Untitled", "8-bit ramp", 8, 100, 100);
run("Reslice [/]...", "output=1.000 start=Left avoid");
run("Image Sequence... ", "format=TIFF save=" + tmp);
run("Set Measurements...", "mean integrated display redirect=None decimal=4");
run("Macro... ", "input=" + tmp + " output=TIFF file=[] text1=run(\"Measure\");");

What macro code did you use in the Process > Batch > Macro… command?


#4

Hi Gabriel and ImageJan!

This is the macro I am running:

run("RGB Stack");
run("Subtract Background...", "rolling=20 light slice");
setThreshold(110,185)
setOption("BlackBackground", false);
run("Convert to Mask", "method=Default background=Light");
run("Invert", "slice");
run("Shape Filter", "area=0-Infinity area_convex_hull=0-Infinity perimeter=0-Infinity perimeter_convex_hull=0-Infinity feret_diameter=15-Infinity min._feret_diameter=0-Infinity long_side_min._bounding_rect.=0-Infinity short_side_min._bounding_rect.=0-Infinity aspect_ratio=1-Infinity area_to_perimeter_ratio=1.0-Infinity circularity=30-Infinity elongation=0-1 convexity=0-1 solidity=0-1 num._of_holes=0-Infinity thinnes_ratio=0-1 contour_temperatur=0-1 fractal_box_dimension=0-2 option->box-sizes=2,3,4,6,8,12,16,32,64 draw_holes slice");
run("Divide...", "value=255 slice");
run("Set Measurements...", "integrated redirect=None decimal=0");
run("Measure");
close()

Hopefully you’ll find the bug!
Thanks! Hector


#5

Hi Gabriel and Jan!

I wondered if you had time to check my macro. Most likely a fine tuning of the macro’s “language” will fix the issue. But I can not figure it out on my own. Your help is needed and very much appreciated. Best! :unamused: Hector


#6

I’ve solved the problem. Or, more precisely, the problem solved itself!! So far, it seems that the bug was in my computer not in ImageJ or the macro I use. Now it works nicely. Sorry for bugging you and thanks for your attention and help. Case closed. Hector


#7

Hi Hector (@luceroha) ! I’m actually having the exact same problem with my batch macro processing. All of the measurements are appearing out of order, and I’d really rather not do all 500 images separately. How exactly did you make it work? Was it on a Mac or PC, and would that make a difference?