Extract annotation from image filename


#1

Hi,

I would like to write a module that extracts universal plate descriptor, well, row, col, field info from Cellomic’s image file names. It then ultimately binds this annotation to the measurements. This module doesn’t need variables, but it seems like variables are necessary in a module? Furthermore, it seems like 2 variables are necessary, as when there is only one, the drop down box does not appear. Adding a second without changing the code in the first causes the first to work properly.

I extract the annotation from the file name and use:

handles.Measurements.Image.CellomicsAnnotationFeatures = { ‘upd’ ‘well’ ‘row’ ‘col’ ‘field’ };
handles.Measurements.Image.CellomicsAnnotation = { upd well row col field };

examining the cell arrays, everything looks good i.e. I seem to have successfully imitated ObjectCount, ObjectCountFeatures.

When I try to export though, “Index exceed matrix dimensions” error is generated.

Where did I go wrong?

I would prefer to have replicated the annotation and add it directly to handles.Measurements.Nuclei

I tried CPaddmeasurements:

handles = CPaddmeasurements(handles,‘Nuclei’,‘Annotation’,‘upd’, repmat( upd , numnuclei ,1));

to create the stuctures

handles.Measurements.Nuclei.AnnotationFeatures
handles.Measurements.Nuclei.Annotation

Examining the variables - all looks fine. I have replicated the annotation to match the number of rows of nuclei identified in this cycle. Export proceeds without error, but the output is garbled. I assume I can’t have strings in the data array? Can you recommend a strategy for binding text columns to the measurements output?

I am a MATLAB novice using CellProfiler v1.0.3443, Matlab 7.2.0232, on Windows 2000 Professional.

Thanks

Peter


#2

Hi Peter,

First off, this sounds like a very useful module! Second, nice catch on the single variable. You can have a module without variables, but you must have one “textVAR”. This is being used in the “Restart” module. The following code will work to initialize a module:


function handles = NewModule(handles)

% Help goes here.

% this line just gives some useful variables which you will probably need
[CurrentModule, CurrentModuleNum, ModuleName] = CPwhichmodule(handles);

%textVAR01 = Describe what module does!

When you tried to make the first variable a popupmenu and had no other variables, the code failed for an obscure reason which I have fixed and will be fixed in the next release of CellProfiler. If you want details, I’ll gladly share.

You are correct that you cannot have strings in the object data. We store strings in the Image structure. This is done for various reasons, but you had the right idea. You need to switch “Features” to “Description” and you should be alright. That is how we store data from the LoadText module. If the number of strings stored is the same as the number of image sets, then the data will be exported with the “image” measurements. There is a small disclaimer, I have never used more than one column under one “Description”, and so I’m not sure if it works. It is a good idea though and I will start checking it out. For now, you might be stuck doing something like this:

handles.Measurements.Image.WellDescription={‘Wells’};
handles.Measurements.Image.Well=WellData;
handles.Measurements.Image.FieldDescription={‘Fields’};
handles.Measurements.Image.Field=FieldData;
etc.

Feel free to ask more questions if you have any trouble, and we should be releasing a new version every month so some of the changes will probably be available soon. Thanks for posting your problems and requests, the software is relatively new and so user input allows us to make the software better for the community instead of tuned for usage in our own lab.

Regards,
Mike