How to measure Length Area and Perimeter automatically using ImageJ

แชร์
ฝัง
  • เผยแพร่เมื่อ 5 ก.ค. 2023
  • Macro code to measure Length Area and Perimeter using ImageJ. Please copy and paste the entire code below
    macro "Measure Object Area, perimeter, height, width, Angle, Length" {
    run("8-bit");
    run("Auto Threshold", "method=Default");
    // Set measurement parameters
    setOption("BlackBackground", false);
    setOption("Area", true);
    setOption("Perimeter", true);
    // Run measurements
    run("Set Measurements...", "area perimeter fit bounding display add redirect=None decimal=2");
    run("Analyze Particles...", "size=2-Infinity display clear add");
    run("Close");
    saveAs("Results.csv");
    }
    Video link to crop image using ImageJ • Crop multiple images a...

ความคิดเห็น • 6

  • @user-ju9sz9uu7c
    @user-ju9sz9uu7c 3 หลายเดือนก่อน +1

    My software tells me « unrecognized command : « Auto Threshold » » when I try to run the macro, could you help me find the solution please ? Which version of the software do you use and is it related with the fact that I am using windows instead of iOS ?

    • @nrttaye4033
      @nrttaye4033  3 หลายเดือนก่อน

      Hello, could you please try with this macro? I removed few lines, so the images have to be manually set into 8 bit, then do threshold to select the object , and then run this macro. in addition please set the size accordingly in the macro at " run("Analyze Particles...", "size=2-Infinity display clear add");" Let me know if that worked.
      // Set measurement parameters
      setOption("BlackBackground", false);
      setOption("Area", true);
      setOption("Perimeter", true);
      // Run measurements
      run("Set Measurements...", "area perimeter fit bounding display add redirect=None decimal=2");
      run("Analyze Particles...", "size=2-Infinity display clear add");
      run("Close");
      saveAs("Results.csv");
      }
      if the above code still doesn't work, here is an alternative. th-cam.com/video/CP2A-Jt279c/w-d-xo.html although this macro is intended for filament length analysis, i could use this for width and height measurement of straight objects. You may compare this macro with manual measurement or with the above macro if that works to verify before using in your experiments.

  • @Gw_Eye
    @Gw_Eye 6 หลายเดือนก่อน

    Help me please, I want to apply this macro to a batch of images, but in the results table only 1 area appears at the end (it appears and is deleted), of all the images I had, thank you very much for the video.

    • @nrttaye4033
      @nrttaye4033  6 หลายเดือนก่อน

      Hello, I tried running the macro again. Could you share a sample image so that I can try running on the image and get back to you.

    • @Gw_Eye
      @Gw_Eye 6 หลายเดือนก่อน

      @@nrttaye4033 thank you very much, here I send you the images

    • @nrttaye4033
      @nrttaye4033  3 หลายเดือนก่อน

      Hello, could you please try with this macro? I removed few lines, so the images has to be manually set into 8 bit, then do threshold to select the object , and then run this macro. in addition please set the size accordingly at " run("Analyze Particles...", "size=2-Infinity display clear add");" Let me know if that worked.
      // Set measurement parameters
      setOption("BlackBackground", false);
      setOption("Area", true);
      setOption("Perimeter", true);
      // Run measurements
      run("Set Measurements...", "area perimeter fit bounding display add redirect=None decimal=2");
      run("Analyze Particles...", "size=2-Infinity display clear add");
      run("Close");
      saveAs("Results.csv");
      }