Alp’s IMage Segmentation Tool (AIMS)

(code and text updated 03.dec.2018)


Finally, an image segmentation tool.

This tool is capable to read your existing Detectnet annotations and convert them to segmented annotations. Of course, it cannot detect object boundaries and wrap the selection line around automatically, but it provides some help to you to do this job. Please keep in mind this is the initial version and not throughly tested. Please work with backup copies of your data.

Download: AIMS_03dec2018_Windows


Assuming you have completed “Fiji” and “actionbar plugin” setup (see Alp’s Labeling Tool (ALT) for setup details for these two).

As usual with my other plugins, after downloading the archive file from above link, you will see a plugins folder in it. Drag and drop the plugins folder onto your “Fiji” main folder. AIMS installed.

An additional step necessary for using this plugin. In the archive file above, you will see a couple of other files. They are;

  • pascal-voc-classes.txt
  • 2007_000032.lut

These two should be copied into the folder of images which you are going to apply segmentation, before you start. The text file is exact copy of the classes file, used in semantic segmentation example of DIGITS. The .lut file is actually a palette file, copied from Pascal VOC 2012 dataset, more specifically, from segmentationclass image named “2007_000032.png”.

Please visit following link to watch install procedure of Fiji, actionbar plugin and this plugin;



The provided “….classes.txt” file is the file for class names. Feel free to change the content to your needs. Keep in mind, the plugin will read it until first empty line, and rest of lines will be ignored.

If you start with a new image, you can use Fiji’s various polygon tools to create object boundaries, tools includes rectangle, circle, polygon and freehand drawing around your objects. A new selection must be added to list by clicking to “Add New Sel.” button. Otherwise you can lost your finely drawn selection.

After creating a polygonal selection, you can move its vertices (dots) to arrange its shape. My advise is, start with basic adjustments, and if you need more dots for precision, click to x2 vertices or x4 vertices buttons. These buttons provide dots related to width or height of selection therefore sometimes you may encounter lower number of dots. In such case, just make a request for “x8 vertices”. I will arrange it.

If you start with bounding box rectangles from a Detectnet dataset, my advise will be using x1 vertices button first, for each of the selection boxes. Then roughly shape it, click x2, fine tune, and click x4 for further adjustments if needed. Please dont forget to click “update” for fixing your changes.

After setting up everything, you are ready to create the segmented image. Visit AIMS menu bar and choose “Save Labels&Image” button. You will be asked to provide a folder for saving the output image. The rest will be handled by plugin. Just patiently wait until process finishes. The segmented image will stay on screen for examining results. If you want to change something, just close the segmented image, and continue editing with the original image.

There will be no white borders on segmented areas if you choose to save with “Save Labels&Image Borderless” button. But due to some limitations, the final border will be “one” pixel larger then your original borders. While it will not be an issue for majority of cases, may become problematic where borders are close to each other, less than 3-4 pixels.

Current version fails and exits, if it encounters a class name during saving, which is not available in …classes.txt file.

Please watch the following video for usage tips;


I hope you enjoy using it,





AIMS_02dec2018_Windows (Removed due to a color artefact issue)


21 thoughts on “Alp’s IMage Segmentation Tool (AIMS)

    1. Hi Alex,
      If you did not install anything yet, just install Fiji, first. It works on Java. Then install actionbar plugin. And finally install this one. All install steps are available in youtube videos, please see the blog text. And I am talking for Windows operating sytem. Did not test it with Linux.


  1. reply to:

    I made a test to see if the number of objects is the source of the problem or not and for this, I converted and image containing 139 labels, classes file and image’s label text file were modified to contain a single class. Everything went flawlessly and segmentation image were created without any errors.
    You actually have few things to try, like;
    -Deleting half of labels and saving it seperately in ALT tool, to see if a specific label is causing problems, you can track it down by removing half of labels, each time.
    -In test, my labels were not touching to each other, and were not overlapping. Not sure if this may or may not cause a problem. Just a point to consider.
    – My test labels were all minimum 30×30 pixels in size (generally more..).
    -If all fails, you can create another fiji folder and install things fresh to see if something is wrong with current install.
    -You can do a fresh install to another computer to check if problem is with the current computer. (You can try to copy/paste the current fiji folder to another computer too, for a quick test).

    These are all I can think of, for the moment.



    1. Hello Alper, Thanks a lot for your kind help. I reinstalled it again on different system, it works great. I don’t know the cause yet,
      but, I will post it here if I could figure it out.

      Thanks again

      Liked by 1 person

  2. Thanks for your sharing. It really help me a lot.
    But when I finish doing segmentation. It comes out “Macro Error”.
    labelno = indexOfArrary (labelid, labeltype ;
    Line number is on clipboard.
    How could I fix it?


    1. Can you describe the labeling conditions a bit? How many classes you have? I didn’t touch this tool lately, I am seeing the error you mentioned time to time in other tools too, but it’s somehow not permanent. But I will try to reproduce your error, if you provide me some info.


  3. Hi Alper, thanks for sharing this great tool. However, I get a problem. The grayscale value of the output image are all 255 between different label name. I would like to get different value ( same as label num, like 1,2,3) between different label name in one image. Can I do it with this tool?


    1. Hi Kinth, I am afraid I cannot understand what you mean, can you describe it a bit more please? With your steps, if possible. Are you converting output 8-bit color segmentation image to greyscale or?


      1. Thanks again! Using this tool, we will get the 8-bit color segmentation image. That’s right. But, the pixel value of this 8-bit output image has something special. The pixel value of background is 0, it is 255 in the all labeled area. So it Cause the pixel value of different labeled area is all 255. However, i want to make it different between different labeled area. How could i do? I am looking forward to your reply.


    2. Ok I assume you are indicating the “pixel intensity” value which is zero for black in a greyscale image, and 255 for white. I have converted a 8-bit color output image to 8bit grayscale image to get pixel values. This is tested for two classes. Both classes’ pixel values were different and not 255. It’s best if you can provide a link to a sample output image because I cannot see such an “all-255” situation with my outputs. In the end, colors (and their intensities) are defined by the .lut file you are using in your images folder. You can edit this file in Fiji to have different intensities.


      1. Thanks for your kind and patient reply. My problem is solved with your help. “all-255” situation appears at the edge of the labeled area, it is my negligence, i am sorry. On the other hand, i want to product a Semantic segmentation like MITSceneParsing dataset, so i have to make the pixel intensity of the edge (as i said) become 0(same as background) using matlab. Anyway, your reply is helpful for me, thanks a lot, good day.


      1. I have tried the new version of this tool. “all-255” situation appears at the edge of the labeled area, which remains unresolved completely. There is a small amount pixel intensity valued 255 at the edge of the labeled area. Did you found it?


    3. Hi, I just saw it, thanks for alerting, its not a border but some sort of antialiasing artefact, seems like (I am seeing a few differently colored pixels around segmentations). I temporarily disabled the new version and will try to solve it as soon as possible.


      1. Okay, this is a efficient and effective tool on building data set of Semantic segmentation. I’m looking forward to the new version. Thank you.

        Liked by 1 person

    4. Ok, I investigated the problem and found a solution to it, the only thing is, segmentation borders will be 1 pixel larger then originally selected area. Other than that, couldn’t see and problems but I will be greateful if you can check the latest version, too.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s