Developer Notes


#1

The idea behind this thread is to provide users with a running list of bugfixes and workarounds that we encounter during development. All of these fixes will be included in future releases, but if you are using the developer’s version of CellProfiler (you run CellProfiler from the Matlab command line), you can implement the fixes here yourself. Even if you are using the compiled CellProfiler, try checking here to see if someone has already found your bug and find out if a workaround exists!


#2

This is a bug which only occurs if you are using a second IDPrimAuto module which utilizes OtsuPerObject (for example, to find speckles in your nuclei) and the first IDPrimAuto failed to find any nuclei- maybe your image was blank, out of focus, or there really weren’t any nuclei. OtsuPerObject shouldn’t find any ‘per-objects’ either, but instead, it chokes.

To fix this, starting at line 1205, remove these two lines:

ThresholdsPerObjectsIncludingZero = OrigThreshold(LabelIndices); ThresholdsPerObjects = ThresholdsPerObjectsIncludingZero(2:end);

and replace them with the following:

if UniqueLabels == 0 % if there aren't any primary objects, OrigThreshold will % be set to 1 with len 1; this arbitrarily lets us save the % value, despite the fact that we didnt find any % 'per-objects' either. ThresholdsPerObjects = OrigThreshold(1); else ThresholdsPerObjectsIncludingZero = OrigThreshold(LabelIndices); ThresholdsPerObjects = ThresholdsPerObjectsIncludingZero(2:end); end
-Kate


#3

Usually if you have a ‘DisplayDataOnImage’ module in your pipeline, you’d like to see the data. But if you set your preferences to ‘don’t display any windows’ (or ‘Ask me which windows to display’, but you un-check them all), DisplayDataOnImage fails with this error:

There was a problem running the analysis module DisplayDataOnImage which is number 14. Error using ==> image
Invalid object handle.

Stack:
imagesc in /Applications/MATLAB74/toolbox/matlab/specgraph/imagesc.m (21)
CPimagesc in /Applications/CellProfiler/CPsubfunctions/CPimagesc.m (34)
DisplayDataOnImage in /Applications/CellProfiler/Modules/DisplayDataOnImage.m (178)
AnalyzeImagesButton_Callback in /Applications/CellProfiler/CellProfiler.m (4505)
gui_mainfcn in /Applications/CellProfiler/CellProfiler.m (6265)
CellProfiler in /Applications/CellProfiler/CellProfiler.m (55)

Unfortunately, the way DisplayDataOnImage works is to actually take a screen capture of the text displayed on the figure, which requires that the figure actually be there. When the user asks DisplayDataOnImage not to create a figure, it tries to make one but make it invisible; unfortunately, the subfunction which displays figures needs this figure handle, and it gets very confused. The only workaround we’ve found is to display these windows. So either ‘Display all windows’ or select only the ‘DisplayDataOnImage’ modules to display. If you must run on a computer cluster, this module will have to be taken out of the pipeline- since figures can’t be displayed (in general, unless you are running interactively).


#4

One of these has been around probably for quite some time, but only arises when a user tries to save a color movie. In that case, the ‘movie2avi’ call needs a colormap, but none was given in the old code, causing it to fail. To fix this, just change line 599 from:
movie2avi(Movie(1:SetBeingAnalyzed),FileAndPathName,‘colormap’,‘compression’,‘none’);
to:
movie2avi(Movie(1:SetBeingAnalyzed),FileAndPathName,‘colormap’,ChosenColormap,‘compression’,‘none’);

The other error was recently introduced in 7522, and occurs only when the user tries to save a projected image from LoadImageDirectory. You’ll get this error:

‘Image processing was canceled in the SaveImages module because in answer to the question "Which images’’ original filenames do you want to use as a base" you have entered improper text. You must choose N, text preceded with =, or an image name that was loaded directly from a LoadImages module. Matlab says that the error is:

Starting at line 276, replace this chunk of code (inside the try block):

FileName = handles.Measurements.Image.('FileName_', ImageFileName]); if iscell(FileName), FileName = FileName{SetBeingAnalyzed}; end [ignore,FileName] = fileparts(FileName); % Drop old extension catch % If the user has selected an image name that is not % straight from a load %% images module, the filenames will % not be found in the handles structure. err = lasterror(); err.message = 'Image processing was canceled in the ', ModuleName, ' module because in answer to the question "Which images'' original filenames do you want to use as a base" you have entered improper text. You must choose N, text preceded with =, or an image name that was loaded directly from a LoadImages module. Matlab says that the error is: ', err.message]; rethrow(err); end
with this chunk:

% If the filename is present in the FileList, pull it from % handles.Pipeline if isfield(handles.Pipeline,'FileList',ImageFileName]) if ~isImageGroups FileName = handles.Pipeline.('FileList',ImageFileName]){1,SetBeingAnalyzed}; else FileName = handles.Pipeline.GroupFileList{handles.Pipeline.CurrentImageGroupID}.('FileList',ImageFileName]){SetBeingAnalyzed}; end else % ...otherwise, get it from handles.Measurements.Image FileName = handles.Measurements.Image.('FileName_', ImageFileName]); end


#5

In CalculateMath, if you try to create a ratio with a zero in a denominator, 7522 was throwing an odd error:

There was a problem running the image analysis. Sorry, it is unclear what the problem is. It would be wise to close the entire CellProfiler program in case something strange has happened to the settings. The output file may be unreliable as well. Matlab says the error is: Undefined variable “NumerDenomMeasurements” or class “NumerDenomMeasurements”. in the CalculateMath module, which is module #19 in the pipeline.

Stack:
CalculateMath in /Applications/CellProfiler/Modules/CalculateMath.m (215)
AnalyzeImagesButton_Callback in /Applications/CellProfiler/CellProfiler.m (4505)
gui_mainfcn in /Applications/CellProfiler/CellProfiler.m (6265)
CellProfiler in /Applications/CellProfiler/CellProfiler.m (55)

The ‘correct’ behavior is for CP to record this measurement as NAN, and warn the user. To fix this, go to line 207 and replace this chunk of code:

elseif( strcmpi(Operation, 'Divide') ) Measurements{2}(Measurements{2}==0) = NaN; Measurements{2}(isnan(Measurements{2})) = CPnanmean(Measurements{2}); if ~all(isnan(Measurements{2})) FinalMeasurements = (MultiplyFactor1.*Measurements{1}) ./ (MultiplyFactor2.*Measurements{2}); else FinalMeasurements = NaN; CPwarndlg('A ratio of ' NumerDenomMeasurements{1} ' and ' NumerDenomMeasurements{2} ... ' within ' ModuleName ' on cycle ' str2double(SetBeingAnalyzed) ... ' resulted in all NaNs. You may want to check your settings.']) end
with this chunk of code:

elseif( strcmpi(Operation, 'Divide') ) Measurements{2}(Measurements{2}==0) = NaN; Measurements{2}(isnan(Measurements{2})) = CPnanmean(Measurements{2}); if ~all(isnan(Measurements{2})) FinalMeasurements = (MultiplyFactor1.*Measurements{1}) ./ (MultiplyFactor2.*Measurements{2}); else FinalMeasurements = NaN; CPwarndlg('A ratio of ' FeatureName{1} ' on ',ObjectName{1},' and ' FeatureName{2} ... ' on ',ObjectName{2},'within ' ModuleName ' on cycle ' num2str(SetBeingAnalyzed) ... ' resulted in all NaNs. You may want to check your settings.']) end


#6

hi,
I am using cellprofiler developers version 7522 in UBUNTU 9.10(32 bit). Is this version compatible with Matlab 7.90 (R2009B). When i run cellprofiler it gives a message that i have an older version of cellprofiler 7515 and should upgrade to 7520, although I have downloaded the latest version and in most of the example pipelines from cellprofiler.org i am getting errors in different modules though they are working in compiled cellprofiler version.


#7

Version 7522 was developed with MATLAB 2008A. We have noticed some compatibility issues with newer versions of MATLAB, but see below for a possible solution.

I’m not sure why you’re getting this message with the developer release from the website. But in any case, the warning is a precaution and can be ignored. Alternately, you can disable it by commenting out the following lines in CellProfiler.m (lines 599 - 603)

if str2double(CurrentSVNVersion) < str2double(WebsiteSVNVersion)
        CPmsgbox({'A new version of CellProfiler is available at www.cellprofiler.org',...
            sprintf('You are still running version %s. The new one is version %s',CurrentSVNVersion, WebsiteSVNVersion)},...
            sprintf('Upgrade to version %s of CellProfiler',WebsiteSVNVersion));
    end

Do your errors occur when loading a pipeline? If so, this post may address the problem.

Regards,
-Mark


#8

I am able to load the pipeline but during analysis the program gives error. In most of the cases it is giving me an error in identifying secondary object module and sometimes in load image module.
For example when i tried to run the pipeline of exampleflyimages i got the following error.
ERROR in Identify Secondary object Module
There was a problem running the image analysis. Sorry, it is unclear what the problem is. It would be wise to close the entire CellProfiler program in case something strange has happened to the settings. The output file may be unreliable as well. Matlab says the error is: Invalid MEX-file ‘/home/aftab/Documents/CP_DevelopersVersion7522/Modules/IdentifySecPropagateSubfunction.mexglx’: libstdc++.so.5: cannot open shared object file: No such file or directory. in the IdentifySecondary module, which is module #06 in the pipeline.

Stack:
IdentifySecondary in /home/aftab/Documents/CP_DevelopersVersion7522/Modules/IdentifySecondary.m (382)
AnalyzeImagesButton_Callback in /home/aftab/Documents/CP_DevelopersVersion7522/CellProfiler.m (4505)
gui_mainfcn in /home/aftab/Documents/CP_DevelopersVersion7522/CellProfiler.m (6265)
CellProfiler in /home/aftab/Documents/CP_DevelopersVersion7522/CellProfiler.m (55)


#9

In this case, I believe the problem is that the mex file for IdentifySecPropagateSubfunction is not compiled appropriately for your machine; see this forum post for additional details.

The solution is to recompile the subfunction by typing mex -setup at the MATLAB command line and then choosing the compiler on your system, and then mex IdentifySecPropagateSubfunction.cpp in CPsubfunctions directory.

Regards,
-Mark