Batch Processing Error

Hi,

I am trying to batch process my images in the segmenter using the provided template and tutorial. I have followed all the instructions, however, when I try to execute the process I keep getting an error (see attached image). I would please like some assistance resolving this issue.

Regards,

Leonard

Hi Leonard,

Can you try again on a filepath with no space? In general, it would be better to keep your folder names and file names with no space.

Thanks,
Jianxu

Hi Jianxu,

I changed the path names and now when I try to execute the comman it says structure not found.

Leonard

great! one problem solved! let’s look at this one.

Right now, my current implementation of the error message is not very mature, which needs to be improved in the next release.

The current message could be the results of two things. i will try to help figure it out.

(1) it looks like you have a new workflow called Actin. So, a file called workflow_Actin.py is expected in the folder ‘structure_wrapper’, and a function call Workflow_Actin is expected in the file. The exact string ‘Actin’ is used as the key to identify all these things, so double-checking the string could help to make the file and the function do exist with the correct name

(2) if the above step shows no error, it could be some error in your workflow_Actin.py maybe comment out all lines in the function and run that again and see if you still see the error. If the error is gone, it means some line has errors.

Let me know if i can help more.

thanks,
Jianxu

Hi Jianxu,

I was wondering if there was a fix to this question. I just tried to use the batch processing function and I’ve come across the same error.

Thanks,
Aidan

Hi Aidan,

I would love to help. Yes, we do have a more flexible way to run batch processing on customized wrapper now. Could you do a quick check on the following thing?

In your conda environement, can you do pip show aicssegmentation and see what is printed out?

For example, in my case, I have:

If you installed the package in editable mode (i.e. pip install -e .[all]), then you should also see a path, like this.

This is the first step. Let me know what is printed out. Then, I could you show you how to deal with this depending on your specific situation.

Thanks,
Jianxu

Hi Jianxu,

Thanks for getting back to me! This is what I got after running pip show aicssegmentation

Aidan

Nice! Give me about 20 min. Working on a few code snippets for you.

Jianxu

1 Like

Hi Aiden, Here is an example:

Suppose I made a new wrapper for structure foo. The script is simple:

import numpy as np

def Workflow_foo(struct_img, rescale_ratio, output_type, output_path, fn, output_func=None):
    a = np.ones(3)
    print("i am here")
    print(a)

Now, I save this script called seg_foo.py in the directory c:\projects\demo\wrapper\.

Then, if I run batch_processing --workflow_name foo --wrapper_dir c:\projects\demo\wrapper\ --struct_ch 0 --output_dir c:\projects\demo\ per_dir --input_dir c:\projects\demo\data --data_type .tiff

The wrapper I just created can be correctly loaded. See this

Basically, I just pass in the extra parameter --wrapper_dir to let the program know where I save the wrapper, no matter where.

Note: Suppose you structure is called actin. Then, you will need to name your wrapper script as seg_actin.py and inside seg_actin.py, the function name has to be Workflow_actin. Then, when pass in the --workflow_name, you need to use actin.

Let me know if you have more questions. Hopefully, the extra parameter --wrapper_dir can make the batch_processing much easier. In my case, I usually put all my customized wrapper in the centralized place, and always use that directory for --wrapper_dir to keep my code organized.

Best,
Jianxu

1 Like

Thanks so much, that did the trick! I can now run the code properly.

Cheers,
Aidan