Can you extend the MeasureTexture module please?

Hello again,

In many of the papers I’ve seen, including the original paper by Haralick et al., texture is measured using different angles (i.e. horizontal, diagonal, vertical). It is also done symmetrically (so horizontal would be left to right and right to left). I’ve tried making sense of the Haralick.py code and don’t really know how to modify it to accomplish this task. Can the CP team extend the MeasureTexture module to compute averages of these different directions for each texture feature?

Thanks.

Hi Scott,

We’ve had one other person bring this up, and we’ve already filed this suggestion for future improvement. We don’t know when we’ll get to this (fixed bugs take precedence over adding new features, typically), but we’ll repost here when it’s done.

Regards,
-Mark

Hi Scott,

We’ve just included this functionality in MeasureTexture. You can wait until our next release to access these features, or if you’re daring, you can try it out with our latest public build from source code here. The trunk build is not as heavily vetted as our releases, so you should take that into account; please note the caveats mentioned on the page linked.

Regards,
-Mark

Thanks a million!

I assume that it’s not as easy as copy and pasting the new code into haralick.py? I might try building it… a fun saturday afternoon for me :smiley:

I think the code is reasonably straightforward: just extend the same operation into the other directions; the call to Haralick now requires an extra argument. Also, there are some UI updates to MeasureTexture to accommodate these new measurements.
-Mark

Well, I downloaded the latest trunkbuild of r11429

I got this error when I ran the program:

8/14/11 5:29:13 PM [0x0-0x414414].org.pythonmac.unspecified.CellProfiler2.0[9079] <_FuncPtr object at 0x7f1198> 8/14/11 5:29:13 PM [0x0-0x414414].org.pythonmac.unspecified.CellProfiler2.0[9079] Traceback (most recent call last): 8/14/11 5:29:13 PM [0x0-0x414414].org.pythonmac.unspecified.CellProfiler2.0[9079] File "/Applications/CP_Beta/CellProfiler2.0.app/Contents/Resources/__boot__.py", line 212, in <module> 8/14/11 5:29:13 PM [0x0-0x414414].org.pythonmac.unspecified.CellProfiler2.0[9079] _run('CellProfiler.py') 8/14/11 5:29:13 PM [0x0-0x414414].org.pythonmac.unspecified.CellProfiler2.0[9079] File "/Applications/CP_Beta/CellProfiler2.0.app/Contents/Resources/__boot__.py", line 184, in _run 8/14/11 5:29:13 PM [0x0-0x414414].org.pythonmac.unspecified.CellProfiler2.0[9079] execfile(path, globals(), globals()) 8/14/11 5:29:13 PM [0x0-0x414414].org.pythonmac.unspecified.CellProfiler2.0[9079] File "/Applications/CP_Beta/CellProfiler2.0.app/Contents/Resources/CellProfiler.py", line 301, in <module> 8/14/11 5:29:13 PM [0x0-0x414414].org.pythonmac.unspecified.CellProfiler2.0[9079] show_splashbox = (options.pipeline_filename is None)) 8/14/11 5:29:13 PM [0x0-0x414414].org.pythonmac.unspecified.CellProfiler2.0[9079] File "/Applications/CP_Beta/CellProfiler2.0.app/Contents/Resources/lib/python2.6/cellprofiler/cellprofilerapp.py", line 16, in __init__ 8/14/11 5:29:13 PM [0x0-0x414414].org.pythonmac.unspecified.CellProfiler2.0[9079] super(CellProfilerApp, self).__init__(*args, **kwargs) 8/14/11 5:29:13 PM [0x0-0x414414].org.pythonmac.unspecified.CellProfiler2.0[9079] File "wx/_core.pyc", line 7981, in __init__ 8/14/11 5:29:13 PM [0x0-0x414414].org.pythonmac.unspecified.CellProfiler2.0[9079] File "wx/_core.pyc", line 7555, in _BootstrapApp 8/14/11 5:29:13 PM [0x0-0x414414].org.pythonmac.unspecified.CellProfiler2.0[9079] File "/Applications/CP_Beta/CellProfiler2.0.app/Contents/Resources/lib/python2.6/cellprofiler/cellprofilerapp.py", line 23, in OnInit 8/14/11 5:29:13 PM [0x0-0x414414].org.pythonmac.unspecified.CellProfiler2.0[9079] import cellprofiler.utilities.get_revision 8/14/11 5:29:13 PM [0x0-0x414414].org.pythonmac.unspecified.CellProfiler2.0[9079] File "/Applications/CP_Beta/CellProfiler2.0.app/Contents/Resources/lib/python2.6/cellprofiler/utilities/get_revision.py", line 22, in <module> 8/14/11 5:29:13 PM [0x0-0x414414].org.pythonmac.unspecified.CellProfiler2.0[9079] import cellprofiler.modules as cpmodules 8/14/11 5:29:13 PM [0x0-0x414414].org.pythonmac.unspecified.CellProfiler2.0[9079] File "/Applications/CP_Beta/CellProfiler2.0.app/Contents/Resources/lib/python2.6/cellprofiler/modules/__init__.py", line 22, in <module> 8/14/11 5:29:13 PM [0x0-0x414414].org.pythonmac.unspecified.CellProfiler2.0[9079] import cellprofiler.cpmodule as cpm 8/14/11 5:29:13 PM [0x0-0x414414].org.pythonmac.unspecified.CellProfiler2.0[9079] File "/Applications/CP_Beta/CellProfiler2.0.app/Contents/Resources/lib/python2.6/cellprofiler/cpmodule.py", line 28, in <module> 8/14/11 5:29:13 PM [0x0-0x414414].org.pythonmac.unspecified.CellProfiler2.0[9079] import cellprofiler.measurements 8/14/11 5:29:13 PM [0x0-0x414414].org.pythonmac.unspecified.CellProfiler2.0[9079] File "/Applications/CP_Beta/CellProfiler2.0.app/Contents/Resources/lib/python2.6/cellprofiler/measurements.py", line 25, in <module> 8/14/11 5:29:13 PM [0x0-0x414414].org.pythonmac.unspecified.CellProfiler2.0[9079] from cellprofiler.utilities.hdf5_dict import HDF5Dict, get_top_level_group 8/14/11 5:29:13 PM [0x0-0x414414].org.pythonmac.unspecified.CellProfiler2.0[9079] File "/Applications/CP_Beta/CellProfiler2.0.app/Contents/Resources/lib/python2.6/cellprofiler/utilities/hdf5_dict.py", line 26, in <module> 8/14/11 5:29:13 PM [0x0-0x414414].org.pythonmac.unspecified.CellProfiler2.0[9079] import h5py 8/14/11 5:29:13 PM [0x0-0x414414].org.pythonmac.unspecified.CellProfiler2.0[9079] File "build/bdist.macosx-10.3-fat/egg/h5py/__init__.py", line 4, in <module> 8/14/11 5:29:13 PM [0x0-0x414414].org.pythonmac.unspecified.CellProfiler2.0[9079] File "h5py/_conv.pyc", line 18, in <module> 8/14/11 5:29:13 PM [0x0-0x414414].org.pythonmac.unspecified.CellProfiler2.0[9079] File "h5py/_conv.pyc", line 11, in __load 8/14/11 5:29:13 PM [0x0-0x414414].org.pythonmac.unspecified.CellProfiler2.0[9079] File "h5r.pxd", line 24, in init h5py._conv (h5py/_conv.c:4281) 8/14/11 5:29:13 PM [0x0-0x414414].org.pythonmac.unspecified.CellProfiler2.0[9079] File "h5py/h5r.pyc", line 18, in <module> 8/14/11 5:29:13 PM [0x0-0x414414].org.pythonmac.unspecified.CellProfiler2.0[9079] File "h5py/h5r.pyc", line 11, in __load 8/14/11 5:29:13 PM [0x0-0x414414].org.pythonmac.unspecified.CellProfiler2.0[9079] File "_objects.pxd", line 3, in init h5py.h5r (h5py/h5r.c:2654) 8/14/11 5:29:13 PM [0x0-0x414414].org.pythonmac.unspecified.CellProfiler2.0[9079] File "h5py/_objects.pyc", line 18, in <module> 8/14/11 5:29:13 PM [0x0-0x414414].org.pythonmac.unspecified.CellProfiler2.0[9079] File "h5py/_objects.pyc", line 11, in __load 8/14/11 5:29:13 PM [0x0-0x414414].org.pythonmac.unspecified.CellProfiler2.0[9079] File "_objects.pyx", line 2, in init h5py._objects (h5py/_objects.c:4164) 8/14/11 5:29:13 PM [0x0-0x414414].org.pythonmac.unspecified.CellProfiler2.0[9079] ImportError: No module named defs 8/14/11 5:29:13 PM CellProfiler2.0[9079] CellProfiler2.0 Error 8/14/11 5:29:17 PM com.apple.launchd.peruser.501[7446] ([0x0-0x414414].org.pythonmac.unspecified.CellProfiler2.0[9079]) Exited with exit code: 255

Didn’t want to post this in regular “Bug” forum because it’s a trunkbuild. Anyway, thought I would let you know.

Thanks for posting this! This seems pretty critical so we’ll post here when this issue is fixed.
-Mark