DiameterJ will not run segmentation or analysis plugin

I have been having trouble using diameterJ to run its segmentation routine or using the analysis portion on a segmented image I prepared using the manual segementation options. I keep getting the error message " Undefined variable in line 156 var path0 = +name [0], line number is on clipboard."

I have removed the program and redownloaded fiji and diameterJ at the imageJ website(https://imagej.net/DiameterJ). I have extracted the fiji file in the C drive, desktop, and in the documents folder. I have attempted the analysis on .png and .TIFF files and I getthe same error message.

Is there a fix for this error or what am I doing wrong as parts of the diameterJ files work?


Hi there, unfortunately I don’t have a solution for you, but I do have the exact same problem. So, bump I guess?

With newer versions of ImageJ/FIJI the ability of DiameterJ to analyze a single image is broken. I have moved on from the project so I have to do updates in my free time these days and over the last year I’ve been too busy to make any updates. Apologies. However, I do believe if you select yes to analyzing multiple images and have at least two images in a directory that you’d like to analyze the above error won’t occur. As a work around if you have two images, just copy and paste the same image in the directory twice. I’m sorry for the inconvenience, as soon as I get the time I’ll update the code. Right now its written in the macro language of ImageJ. This summer I intend to update to native JAVA and that should help build more robustness into tool. Again apologies for the work around and let me know if the above doesn’t solve the problem.

Additionally, I heavily recommend using FIJI/ImageJ2 for compatibility with DiameterJ.

(EDIT: I previously incorrectly stated that ImageJ1 was no longer under development which Herbie pointed out is actually wrong, Thanks Herbie! I didn’t know.)

ImageJ is no longer in active development.

This is definitely not true or we have different ideas of what active development means.

Please see the recent additions (concerning e.g. plotting) and not only the bug-fixes.



I tried this work around but I still get an error “Undefined variable in line 159 var path0= + name [ 0 ]…” I tried using both fiji and imageJ running both normally and as administrator. in fiji the error pops up before the analysis window for both DiameterJ 1-018 and DiameterJ segmentation. I was able to run the DiameterJ segmentation plugin in imageJ but when I ran DiameterJ 1-018 nothing popped up.

Hmmm, okay its actually a change in how FIJI records variables. I’ll update to DiameterJ 1.019 over the weekend. But for now if, you don’t want to wait, if you drag and drop the “DiameterJ_1-018.ijm” file into FIJI and then scroll down to lines 161 - 186 and delete the word “var” wherever it occurs it fixes the issue on my local version. Sorry, and let me know if that works.


1 Like

^OK, I tried that and it does work, BUT - you need to also do this in the Diameter_J1_018_Segmentation file. Then close and restart the program.

However, the segmentation is having trouble converging. Dumb question but: should I have first converted the images to B&W only?

deleting all the “var” from the diameterJ 1-018 file did work. WOOO! Thank you I have been trying to get this thing to work for SO long!

going through diameterJ segment.ijm and removing “var” allowed the dialoge box to appear but it didn’t analyze the images and simply made the three folders with no processed images. Manual segmentation still works though.

If you go by just deleting the “var” in that are reported by the error messages line 159 then 1521 the segmentation program will run and then report that the segmentation routine was successful but will not create any new images

I did the workaround you suggested in the other forum question (Error in working with DiameterJ) and deleted the words “var” in lines 161-186 in the DiameterJ_1-018.ijm. I also deleted all the “var” in the DiameterJ_Segment.ijm file.

These solutions fixed the issues and I’m now able to segment and batch process my images. Thank you so much for your help. Please let me know when DiameterJ 1.019 is released.


This my issue as well. It just runs but nothing is in my folder just say successul with no images @DiameterJ_admin Please assist with this part. First solution worked no more error but now nothing gets segmented

Hi @wnwhite make sure that all your images are 8bit and in tif format and make sure that the folder you save in for segmentation contains all the other images you are working on if working on more than 1 image and all must be resaved as 8bit. Those 2 elemets helped me clear this all out.

Hope this helps

Thank you for the advice but I have already been doing this with no success.

Hi, I can get DiameterJ to run and process my images, but the summaries folder is empty. Any suggestions on a fix?

I think imageJ did this to me, try using fiji instead. Did you delete all the “var” in “DiameterJ_1-018.ijm” in line 161 - 186. You can do this by opening in notepad and then use ctrl F to find “var”. sometimes it takes awhile (1 - 2 min) for folders to be populated, make sure you have the log window opening and it should say which image it is analyzing.

Hello all, I have been trying to use DiameterJ on ImageJ and FIJI. I was able to fix many issues by following the advice in this forum and deleting “var” in the files. The segmentation step works perfectly for me now, but the analysis step does not. Most of the folders end up empty or with only one of the files. The only error message I get for ImageJ is “Unrecognized command: ‘Analyze Skeleton (2D/3D)’ in line 269.” For FIJI, I don’t get an error. For both, the log never goes beyond analyzing the first image. Let me know if anyone has had a similar experience or knows how to fix it. Thanks!

Here is a quick guide to get DiameterJ working on the newest Fiji version:

  1. Download and extract DiameterJ into the plugins folder of Fiji

  2. Open both files in Fiji.app/plugins/DiameterJ/ with notepad and search and replace “var” with nothing/no character

  3. In Fiji go to Plugins->DiameterJ->DiameterJ Segment, fill in the info (Analyze more than one image must be Yes) and press OK, Choose the folder where the images are located.

  4. Run Plugins->DiameterJ->DiameterJ 1-018 to use DiameterJ. If the plugin hangs at Analyze Skeleton (2D/3D) you need to downgrade the ImageJ version. In Fiji go to Help->Update ImageJ and choose Update To: v1.51 and press OK. This version seems to work with DiameterJ. I don’t think you need to delete the “var” lines with this version but it seems to work ok with them deleted.

Hope this helps



I tried deleting all instances of “var,” but I am getting the error message: “Undefined variable in line 156. var path0= + name[0]” when I try to go to Plugins->DiameterJ->DiameterJ Segment, and the window to fill in the info does not appear.

Any ideas? Thanks!

Thanks, casimur! This fixed my issues with the Analysis plugin. Only note is I still did have to delete the “var” in the DiameterJ file in Fiji running ImageJ version 1.51.