Ilastik wrapped C/C++ object of type AddFileButton has been deleted error

I’m using the multicut workflow in Ilastik. I need to export the multicut segmentation results for downstream processing. I have an Ilastik project with a single image stack and a whole bunch of training that was created with ilastik-1.4.0b1-Linux. When I try to batch process my other files with it, I get a " wrapped C/C++ object of type AddFileButton has been deleted " error. A 8.2kb file is created for the first file on my list, but it seems empty.

I have tried running this in both ilastik-1.4.0b1-Linux and ilastik-1.3.3-Linux and end up with the same error. I have also tried headless mode and got the same error.

Does anyone know of a way to make this work?
I would like to avoid starting a new multicut project file from scratch.
Thank you in advance

Hi @Buono,

hmmm @Mehrnaz_b had a similar problem described here: Ilastik -- batch processing

I think the solution there was the headless mode. Do you get the same error message there, too? This is usually related to some Qt stuff which is less likely to be caused in headless mode.

Hi @k-dominik,

hmmm @Mehrnaz_b had a similar problem described here:

I tried that without success (I believe the same error).
In the end I started from scratch with ilastik-1.4.0b1-Linux, generated a new project file. This one also refuses to batch process. So I tried the headless again and now the headless works. The difference is that I created a new multicut project file from scratch.

I had a similar issue before with multicut. I cannot reliably reproduce it, but if I am working on a project for a few days, at some point I seem to hit a forbidden click sequence and get an error. From there on that project file never works again. I narrowed down to something between the edge training and the multicut. But I can’t reliably reproduce it.

Since it seems to be working on headless, how do I process a whole folder of images for multicut using headless? Do I need to list all the file names as described here? Is there a way to point it to a folder for the raw data and another folder for the probabilities?

Thank you,


yeah the multicut will undergo some massaging in the future…

it is not possible to point to a folder. For these kinds of batch processing scenarios I’d recommend calling ilastik via python’s subprocess module (or any other kind of scripting that allows for something like that). Do you have any coding experience?

I will give it a go with the python’s subprocess module.
Will start with the the other thread you answered on this.
Unless you happen to have a previously written script that you can share…

Based on the other thread and doing a not elegant cut and paste on the python script that @emfro08 posted, I ended up with the following:

import os
import re, glob, os #navigation in diff repertory if script not in the same folder
from os import walk #Find folders and files
from os import listdir
from os.path import isfile, join
import subprocess

ilastik_location = '/opt/ilastik-1.4.0b1-Linux' #location of ilastik
ilastik_project = '/home/user/experiment/multicut_001.ilp' #location of project file

indir = '/home/user/experiment/raw/' #location of raw files
infiles = os.listdir(indir)

probdir = '/home/user/experiment/probabilities/' #location of probability files
probfiles = os.listdir(probdir)

multidir = '/home/user/experiment/multicut/' #where to save results

for infile in infiles:
    probfile = infile.replace('.tif','_3cNeural_Probabilities.h5') #to match probability file to raw file. In my naming scheme the only difference is the addition of _3cNeural_Probabilities.h5 instead of .tif at the end of file name.
#headless command. Exporting as multipage tiff to fit my downstream application
    command = './ --headless --project="%s" --raw_data="%s%s" --probabilities="%s%s" --export_source="multicut segmentation" --output_format="multipage tiff" --output_filename_format="%s/{nickname}_multicut.tiff"'% (ilastik_project,indir,infile,probdir,probfile,multidir)
    print("\n\n%s" % command), shell=True)

I did not touch the import portion and just modified the rest so that it would fit a multicut workflow. It does not look very good, but it did the job.

Hi @Buono,

my scripts are mainly for debugging certain features, so not necessarily matching real use cases. Great that you got it working! Maybe we should add something along those lines (a demonstration script) to our docs…

Hey @Buono,

your original issue with the C/C++ object of type AddFileButton… has been resolved in 1.4.0b12.

Cheers and thank you for the report :slight_smile:

Hello @k-dominik, thanks for the information ! :grin: