haralick 3D

66 views
Skip to first unread message

ritasimoes

unread,
Apr 12, 2011, 11:36:01 AM4/12/11
to pythonvision
Hi all,

I am computing the Haralick features of 3D images. The "haralick"
function returns a 4x13 array, but for 3D data shouldn't this be
13x13? It seems that only the first four directions are being computed
(as in the 2D case) - line 86 in texture.py. Is this a bug or am I
missing something?

Thanks in advance!

Rita

Luis Pedro Coelho

unread,
Apr 12, 2011, 12:06:11 PM4/12/11
to python...@googlegroups.com
Hi Rita,

You're right, of course.

I will fix it in the next release.

Thank you,
Luis

--
Luis Pedro Coelho | Carnegie Mellon University | http://luispedro.org


Sun

unread,
Apr 29, 2012, 9:44:20 PM4/29/12
to python...@googlegroups.com
Hi Luis,

I'm trying to read 3D png image and it reads as 2D image and gives 4x13 Haralick feature vectors.
Could you let me know if this issue has been fixed, or some pointers in that direction?

Thanks,
Sundar

Luis Pedro Coelho

unread,
Apr 30, 2012, 5:13:41 PM4/30/12
to python...@googlegroups.com
On Sunday, April 29, 2012 06:44:20 PM Sun wrote:
> I'm trying to read 3D png image and it reads as 2D image and gives 4x13
> Haralick feature vectors.

Are you sure this is being correctly read? I wasn't even aware that you could
have 3D PNGs.

HTH
--
Luis Pedro Coelho | Institute for Molecular Medicine | http://luispedro.org
signature.asc

Sundaresan R

unread,
Apr 30, 2012, 9:09:22 PM4/30/12
to python...@googlegroups.com
Hi Luis,

Thats where it fails. I tried reading 3D png and tiff using the following code and it reads as 2D image. 
I installed mahotas 0.7.3  and freeimage.

********************************
import numpy as np
from scipy import ndimage
import pylab
import mahotas
from mahotas import freeimage
from mahotas import imread,imsave

img = mahotas.imread('myuchar.tiff')
print img.ndim
print img
*********************************

It gives the following:

2
[[0 0 0 ..., 0 0 0]
 [0 0 0 ..., 0 0 0]
 [0 0 0 ..., 0 0 0]
 ..., 
 [0 0 0 ..., 0 0 0]
 [0 0 0 ..., 0 0 0]
 [0 0 0 ..., 0 0 0]]

I'm unsure why it fails while reading the 3D image. Does the imread package also needs to be installed separately?  
(there was a dependency issue for libwebp-dev in ubuntu 10.10, python 2.6).

Thanks,
Sundar

Sun

unread,
May 17, 2012, 5:18:53 PM5/17/12
to pythonvision
Hi all,

Could anyone tell me how could I read a 3D image in python?

Thanks
Sundar
>  signature.asc
> < 1KViewDownload

Luis Pedro Coelho

unread,
May 18, 2012, 6:05:11 AM5/18/12
to python...@googlegroups.com
On Thursday, May 17, 2012 02:18:53 PM Sun wrote:
> Could anyone tell me how could I read a 3D image in python?

The same way you read a 2D image.

What is the format this image is in?

If you have tried imread (http://pypi.python.org/pypi/imread/0.2.1) and it
does not open it correctly, send the image file (per personal email) and I will
look into it.

Good luck
--
Luis Pedro Coelho | Institute for Molecular Medicine | http://luispedro.org

LxMLS 2012: Lisbon Machine Learning School
http://lxmls.it.pt

Sundaresan R

unread,
May 22, 2012, 2:51:45 PM5/22/12
to python...@googlegroups.com
It works after I convert the image into a numpy array before computing the features.

Thanks Luis.

Sundar
Reply all
Reply to author
Forward
0 new messages