LoadImages: unpack requires a string argument of length 2

I am having an issue with LoadImages when I try to direct it to process all files within subfolders of the parent directory. I have two channels of data, each with a z-stack of images (c1-DAPI, c2-signal) that I am trying to max intensity project before analysis. Each image acquisition’s data is stored in a subfolder of the parent directory. The pipeline works perfectly if LoadImages is directed to a single data folder. However, when I direct it to the parent, it seems to execute everything till the end and then gives the error listed below. I’ve attached the pipeline as well. Thanks for your help!

LoadImages error: unpack requires a string argument of length 2

Traceback (most recent call last):
File “/Applications/CellProfiler2.0.app/Contents/Resources/lib/python2.7/cellprofiler/pipeline.py”, line 309, in run
File “/Applications/CellProfiler2.0.app/Contents/Resources/lib/python2.7/cellprofiler/modules/loadimages.py”, line 2077, in run
File “/Applications/CellProfiler2.0.app/Contents/Resources/lib/python2.7/cellprofiler/modules/loadimages.py”, line 2766, in provide_image
File “/Applications/CellProfiler2.0.app/Contents/Resources/lib/python2.7/cellprofiler/modules/loadimages.py”, line 2802, in load_using_PIL
File “/Applications/CellProfiler2.0.app/Contents/Resources/lib/python2.7/contrib/tifffile.py”, line 143, in init
File “/Applications/CellProfiler2.0.app/Contents/Resources/lib/python2.7/contrib/tifffile.py”, line 170, in _fromfile
File “/Applications/CellProfiler2.0.app/Contents/Resources/lib/python2.7/contrib/tifffile.py”, line 332, in init
File “/Applications/CellProfiler2.0.app/Contents/Resources/lib/python2.7/contrib/tifffile.py”, line 353, in _fromfile
error: unpack requires a string argument of length 2
maxprojection.cp (4.5 KB)


Two quick thoughts:
(1) Your LoadImages has “File type to be loaded” set to “Images”. Have you tried any of the other “movie” settings? They are intended for movies or stacks, and may help to unpack the somewhat complicated “stacks upon stacks” of potentially multiple z-stacks within different hierarchical subfolder (stacks).
(2) I suggest that you either
(a) create 2 separate pipelines – one for doing the MAX projection and saving them as images, and one to act upon those saved max projections.
Or (b) Do the max projection in a different tool, like Fiji (Fiji is just ImageJ), which is very fast to calculate. If you have many z-stacks, then of course you would have to script/macro them, and then it might be easier to use CP. But I find that for small Max Projections, Fiji is very efficient.
(3) To do this in CP, you might have to use subfolder metadata extraction, which can get complicated (see all the reasons in (2) above!). It is possible certainly, but for simplicity this is another reason to use Fiji for this single task.

Otherwise without knowledge of your:

  • CP version
  • the filetype/extension
  • the subfolder structure
    it is hard for me to parse the error.

Hope this helps!