Patch for CellProfiler issue 1043 - Cellomics files with renamed filenames

Here's the patch for the problem I reported to ome-users (email cut and pasted below). I hope this isn't too massive a change - I changed the character-by-character parsing to use a regexp which captures the fields from the file name. I've tested it on both files in the BBBC018 and on a set of original Cellomics DIBs.

Also hoping I got the whitespace right, I'm eternally clumsy about that sort of thing. If you need me to merge the patch to the develop branch, I can do that.

--Lee

--- begin email ---
Hi all,
We packaged a Cellomics dataset as part of the Broad Bioimage Benchmark Collection, BBBC018. It's available for download here:
http://www.broadinstitute.org/bbbc/BBBC018/BBBC018_v1_images.zip

We renamed the files when we packaged it up - unfortunately. It's not the first time that something like this has happened, not under our control. When I unpack the zip and use showinf to read the image, I get the following stack trace:

c:\Temp\bioformats_5.0.0_rc2>showinf -no-upgrade c:\Temp\BBBC018_v1_images\00733-actin.DIB
Checking file format [Cellomics C01]
Initializing reader
CellomicsReader initializing c:\Temp\BBBC018_v1_images\00733-actin.DIB
Exception in thread "main" java.lang.StringIndexOutOfBoundsException: String index out of range: 1
        at java.lang.String.charAt(Unknown Source)
        at loci.formats.in.CellomicsReader.getWellName(CellomicsReader.java:371)
        at loci.formats.in.CellomicsReader.getChannel(CellomicsReader.java:395)
        at loci.formats.in.CellomicsReader.initFile(CellomicsReader.java:149)
        at loci.formats.FormatReader.setId(FormatReader.java:1360)
        at loci.formats.ImageReader.setId(ImageReader.java:781)
        at loci.formats.ReaderWrapper.setId(ReaderWrapper.java:576)
        at loci.formats.tools.ImageInfo.testRead(ImageInfo.java:993)
        at loci.formats.tools.ImageInfo.main(ImageInfo.java:1075)
c:\Temp\bioformats_5.0.0_rc2>

The problem here is that much of the code in the reader assumes that it will get a reasonable file name and doesn't catch the cases where the assumptions are violated. In this case, the code assumes that the well metadata appears after the last underbar: "images\00733-actin.DIB" (it should have a format like "A01f00o1.DIB").

I'm going to submit a pull request for a patch to this - I have both the directory of zip files and a representative directory of Cellomics files with their correct file names and I want to make sure what I do works in CellProfiler (https://github.com/CellProfiler/CellProfiler/issues/1043).

I do have one question as I'm implementing. This line:
https://github.com/openmicroscopy/bioformats/blob/develop/components/bio-formats/src/loci/formats/in/CellomicsReader.java#L195

prevents the reader from including all of a plate's files unless there is a full plate map. It seems a little cruel... just want to make sure it belongs there, I have one directory which is a full plate and another which is just short of full.