Altering a cpproj file headless?

I have just started using the batch process commands. my task is to essentially repeat an identical pipeline, but vary the input and output folders (and of course the actual images. Right now, I bring up the guy and specify the different locations and load up the images and then save it as a new project and then produce the batch code. is there a way to just produce the batch code variants (in separate directories) with the same basic pipeline by specifying input and output directories (maybe in headless mode) ?
thanks for this great application.

You can definitely call a .cppipe pipeline and specify the output folder in headless, but you do have to give it an actual file list rather than just an input directory as far as I know. You could presumably produce the file list programmatically though with command line scripting if you’re comfortable doing so. See more about the different commands CP will accept headless here.

Excellent - thanks I will give those options a try.
thanks again,

Hi, I need a little more help on this. so I went in to cell profiler and exported my pipeline. I created a file list as a text file for the images I would like to use and then also supplied the input and output directories. here is the command:cellprofiler --file-list images.txt -i /is2/projects/RAS-intl/static/rp3_ifx/cell_profiler/hras_kras/inputs/tiff/plate2/kras -o /is2/projects/RAS-intl/static/rp3_ifx/cell_profiler/hras_kras/try_pipe -c -r -p images.cppipe

I get the following error - is there a special format for the input list of images ?
Traceback (most recent call last):
File “/usr/local/lib/python2.7/dist-packages/cellprofiler/”, line 2135, in prepare_run
if ((not module.prepare_run(workspace)) or
File “/usr/local/lib/python2.7/dist-packages/cellprofiler/modules/”, line 266, in prepare_run
"([Ljava/lang/String;)[Z", file_array)
File “/usr/local/lib/python2.7/dist-packages/javabridge/”, line 885, in call
result = fn(*nice_args)
File “/usr/local/lib/python2.7/dist-packages/javabridge/”, line 852, in fn
raise JavaException(x)
JavaException: URI is not hierarchical

(by the way, when i do this, it will still pass the images through the metadata parser - right ?

thanks (again)

I’ve personally only ever worked with CSVs as input file lists and then feeding them into LoadData- you can go to File->Export->Image Set Listing to get an example of what those files loo. I know that you CAN use txt files but am hazy on what exactly needs to be in it- tagging my colleague @karhohs who has worked with more command-line variations than I have.

The other things I would recommend checking in the meantime would be 1) try removing dashes from your file and path names- I’m not sure they’ll be parsed correctly. 2) make sure your path names are absolute, not relative (I can’t tell from what you have here).

1 Like

@bcimini @Bob_Stephens

The file list will still go through the metadata module. It more or less takes the place of the images module seen within the gui Input modules.

The file list can be created from the CellProfiler gui by adding the file list option to the save project options in the Preferences.

Alternatively, you can create a file list from a Bash shell or similar linux environment. Note, CellProfiler must be running in the same environment that the filelist was created in.

$ IMAGEDIR=/Path/to/my/images $ find ${IMAGEDIR} -type f > filelist.txt

I’ve attached an example of what a file list should look like to this post. Source images.

windows.txt (756 Bytes)

1 Like

Hi Folks,
That did it. I only had the actual filenames - not with the full path. I had thought the default input directory would direct it to where to look, but no matter, it is just as easy to include the paths. Thanks for the help !