Using Modules Inside Other Programs

Hello,

I wondered if there was any way to simply use a CellProfiler module within another piece of code. That is, I’d like to call the IdentifyPrimaryObjects module within a piece of code I’ve already written (which would then preferably be interfaced with through the CellProfiler GUI). Any help is appreciated.

Chris

Hi Chris,

This can be done, particularly if you are writing your code in Python. You can visit our page for developers, and see instructions on how to retrieve/install our Python source code. You can then call the desired module from within your code.

If, on the other hand, you are not interested in using the source code, you can call CellProfiler itself and run an identification pipeline with inputs/outputs of your choosing but without the user interface (“headless” mode, as we call it). The same webpage above has more details, under the “Running CellProfiler from the command line” link.

Regards,
-Mark

Thank you for this help, Mark.

In trying to install the Python source code (on a computer running Windows 7), I receive the following error:

gcc: /MANIFEST: No such file or directory
error: command ‘gcc’ failed with exit status 1

My own attempts at solving this have thus far been unsuccessful and I wondered if anyone might know where to begin solving this problem.

Any help is appreciated.

Chris

Hi Chris,
What is the command line you are using that generates this error?
-Mark

Mark,

In the Microsoft Windows Server 2008 x64 DEBUG Build Environment (and after setting DISTUTILS_USE_SDK and MSSdk to 1 (using set DISTUTILS_USE_SDK=1 and set MSSdk=1)), I type the command: python CellProfiler.py --build-and-exit.

I also forgot to set those two system environment variables to 1 and got the same error.

I’ll include the entirety of the readout below:

C:\Users\zarbock\Documents\GitHub\CellProfiler>python CellProfiler.py --build-an
d-exit
WARNING:root:Distributed support disabled: please install nuageux
running build_ext
building ‘_cpmorphology’ extension
C:\MinGW32-xy\bin\gcc.exe -mno-cygwin -mdll -O -Wall -Isrc -IC:\Python27\lib\sit
e-packages\numpy\core\include -IC:\Python27\include -IC:\Python27\PC -c src/cpmo
rphology.c -o build\temp.win32-2.7\Release\src\cpmorphology.o
src/cpmorphology.c:27:13: warning: ‘to_stdout’ defined but not used
writing build\temp.win32-2.7\Release\src_cpmorphology.def
C:\MinGW32-xy\bin\gcc.exe -mno-cygwin -shared -s build\temp.win32-2.7\Release\sr
c\cpmorphology.o build\temp.win32-2.7\Release\src_cpmorphology.def -LC:\Python2
7\libs -LC:\Python27\PCbuild -lpython27 -lmsvcr90 -o C:\Users\zarbock\Documents
GitHub\CellProfiler\cellprofiler\cpmath_cpmorphology.pyd /MANIFEST
gcc: /MANIFEST: No such file or directory
error: command ‘gcc’ failed with exit status 1
WARNING: Java and JVM is not installed - Images will be loaded using PIL ([Error
2] The system cannot find the file specified)
WARNING: Java and JVM is not installed - Images will be loaded using PIL ([Error
2] The system cannot find the file specified)
running build_ext
building ‘_get_proper_case_filename’ extension
C:\MinGW32-xy\bin\gcc.exe -mno-cygwin -mdll -O -Wall -IC:\Python27\include -IC:
Python27\PC -c get_proper_case_filename.c -o build\temp.win32-2.7\Release\get_pr
oper_case_filename.o
writing build\temp.win32-2.7\Release_get_proper_case_filename.def
C:\MinGW32-xy\bin\gcc.exe -mno-cygwin -shared -s build\temp.win32-2.7\Release\ge
t_proper_case_filename.o build\temp.win32-2.7\Release_get_proper_case_filename.
def -LC:\Python27\libs -LC:\Python27\PCbuild -lshlwapi -lshell32 -lole32 -lpytho
n27 -lmsvcr90 -o C:\Users\zarbock\Documents\GitHub\CellProfiler\cellprofiler\uti
lities_get_proper_case_filename.pyd /MANIFEST
gcc: /MANIFEST: No such file or directory
error: command ‘gcc’ failed with exit status 1

Hope this helps to pin down the problem. Thank you for your help.

Chris

Hi Chris,

The instructions from the CellProfiler wiki are intended to compile the code using the Microsoft Windows SDK. However, from your output, it seems that it is compiling with MingGW instead.

I’m assuming that you have MingGW previously installed on your system and on your system path? If so, I would suggest resetting the path to the preferred compiler cl.exe, probably under C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\bin in the folder appropriate to your OS.

Regards,
-Mark