Problem with new Identify module in Windows


#1

Hi,

I have an interesting issue with adding a new Identify module to CellProfiler. The module works perfectly in my Linux development environment but I cannot get the module to appear in the module list in Windows. I have some own modules included in the plugins directory defined in Preferences and all other modules are available in Windows version of CellProfiler.

I have not setup development environment in Windows so I’m not able to debug what is going on. However, this issue seems to be limited to Identify modules. For instance if I take IdentifyPrimaryObjects module, rename it, and copy the file to the plugins directory, the same issue appears and the copied version of the module is not included in module listing.

Is it possible to add new Identify modules to plugins directory in installed version of CP in Windows?


#2

I have been using Identify-derived (cpmi.Identify) module in Windows (CellProfiler stable version 2.2) for quite some time.

If it does not show up then it failed to load which is usually caused by some import issues so check console/terminal for more info. Also remember that installed version CP comes with it’s own prepacked Python environment which can suprise you :slight_smile:

As to making a copy of existing module, did you change class name and ‘module_name’ in the new file? If not then it just replaced the original definition.

Regards
Filip


#4

Thanks Filip for your answer. I solved the issue at least partly but maybe this could be considered as a bug as well, unless there is a better way to do it.

I was using CellProfiler 2.1.1 in Windows which has a bit different file structure than CellProfiler 2.2. Also, at least by default CP 2.1.1 does not print import error or other warnings to command prompt. Only possible explanation for this issue I could come up with was the import of Identify module. After your comment I installed CellProfiler 2.2 and tested the module there (it also prints errors to command prompt by default). In CP 2.2 it is possible to put the new module into the same directory as Identify module (cellprofiler/modules) where it works just fine. However, it seems that Identify modules cannot be saved anywhere else in the file system (set as plugins directory in preferences) since then Identify cannot be imported in that module.

Importing cellprofiler.modules.identify didn’t seemed to work. Is there any other way to import Identify module or should it be moved elsewhere from the modules directory in future releases of CellProfiler?


#5

I was about to mention about the problem with CellProfiler 2.1.1 but I did not want to bother you with old version problems :slight_smile:

I’ve tried to copy identifyprimaryobjects and putting it in the plugins folder but it fails as you say. However next to that file is another module using identify that loads. It loads identify using ‘from cellprofiler.modules import identify as cpmi’.

The rest of: from identify import …you have to replace with: from cellprofiler.modules.identify import … And it should start to load.

You can always download and check code of our plugin at http://www.cellstar-algorithm.org. It might help you if you get stuck or wonder how to add a button to existing modules :slight_smile: