Discussion:
Mahotas memory error
Jeannie Fitzgerald
2014-09-29 11:19:51 UTC
Permalink
Hi,

Obtaining haralick features for a .png image I receive the following error:

Traceback (most recent call last):
File "nSOGP.py", line 742, in <module>
main(sys.argv[1:])
File "nSOGP.py", line 721, in main
features = mahotas.features.haralick(img)
File
"/usr/local/lib/python2.7/dist-packages/mahotas/features/texture.py", line
88, in haralick
cmat = np.empty((fm1, fm1), np.int32)
MemoryError

This does not happen with a. the same image converted to .jpg or b. if I
save the image with imread.imsave as uint8. (printing the img values after
std imread - they are NOT floats.)
I have haralick features obtained from Matlab and am trying to duplicate
these with Mahotas - so far the resulting values are quite different.

thanks

jeannie
--
You received this message because you are subscribed to the Google Groups "pythonvision" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pythonvision+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
For more options, visit https://groups.google.com/d/optout.
Luis Pedro Coelho
2014-09-29 12:09:46 UTC
Permalink
Hi Jeannie,

Can you please post an image + small examples where this error happens?

Matlab may be doing other normalizations, it's my guess.


Thank you,
--
Luis Pedro Coelho | EMBL | http://luispedro.org
My blog: http://metarabbit.wordpress.com
Post by Jeannie Fitzgerald
Hi,
File "nSOGP.py", line 742, in <module>
main(sys.argv[1:])
File "nSOGP.py", line 721, in main
features = mahotas.features.haralick(img)
File
"/usr/local/lib/python2.7/dist-packages/mahotas/features/texture.py", line
88, in haralick
cmat = np.empty((fm1, fm1), np.int32)
MemoryError
This does not happen with a. the same image converted to .jpg or b. if I
save the image with imread.imsave as uint8. (printing the img values after
std imread - they are NOT floats.)
I have haralick features obtained from Matlab and am trying to duplicate
these with Mahotas - so far the resulting values are quite different.
thanks
jeannie
--
You received this message because you are subscribed to the Google Groups
"pythonvision" group.
To unsubscribe from this group and stop receiving emails from it, send an
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "pythonvision" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pythonvision+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
For more options, visit https://groups.google.com/d/optout.
Jeannie Fitzgerald
2014-09-29 13:02:39 UTC
Permalink
Hi,

Unfortunately, the image is too large - is there an other way I can submit
it, rather than by attachment?

Simple code:

img = mahotas.imread('exampleImage.png')
features = mahotas.features.haralick(img)

Jeannie
Post by Luis Pedro Coelho
Hi Jeannie,
Can you please post an image + small examples where this error happens?
Matlab may be doing other normalizations, it's my guess.
Thank you,
--
Luis Pedro Coelho | EMBL | http://luispedro.org
My blog: http://metarabbit.wordpress.com
Post by Jeannie Fitzgerald
Hi,
File "nSOGP.py", line 742, in <module>
main(sys.argv[1:])
File "nSOGP.py", line 721, in main
features = mahotas.features.haralick(img)
File
"/usr/local/lib/python2.7/dist-packages/mahotas/features/texture.py", line
88, in haralick
cmat = np.empty((fm1, fm1), np.int32)
MemoryError
This does not happen with a. the same image converted to .jpg or b. if I
save the image with imread.imsave as uint8. (printing the img values after
std imread - they are NOT floats.)
I have haralick features obtained from Matlab and am trying to duplicate
these with Mahotas - so far the resulting values are quite different.
thanks
jeannie
--
You received this message because you are subscribed to the Google
Groups
Post by Jeannie Fitzgerald
"pythonvision" group.
To unsubscribe from this group and stop receiving emails from it, send
an
Post by Jeannie Fitzgerald
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "pythonvision" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pythonvision+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
For more options, visit https://groups.google.com/d/optout.
Luis Pedro Coelho
2014-09-29 13:36:07 UTC
Permalink
Just put it anywhere that's public and send the link.

(Or share it with me through Dropbox or similar)
--
Luis Pedro Coelho | EMBL | http://luispedro.org
My blog: http://metarabbit.wordpress.com
Post by Jeannie Fitzgerald
Hi,
Unfortunately, the image is too large - is there an other way I can submit
it, rather than by attachment?
img = mahotas.imread('exampleImage.png')
features = mahotas.features.haralick(img)
Jeannie
Post by Luis Pedro Coelho
Hi Jeannie,
Can you please post an image + small examples where this error happens?
Matlab may be doing other normalizations, it's my guess.
Thank you,
--
Luis Pedro Coelho | EMBL | http://luispedro.org
My blog: http://metarabbit.wordpress.com
Post by Jeannie Fitzgerald
Hi,
File "nSOGP.py", line 742, in <module>
main(sys.argv[1:])
File "nSOGP.py", line 721, in main
features = mahotas.features.haralick(img)
File
"/usr/local/lib/python2.7/dist-packages/mahotas/features/texture.py", line
88, in haralick
cmat = np.empty((fm1, fm1), np.int32)
MemoryError
This does not happen with a. the same image converted to .jpg or b. if I
save the image with imread.imsave as uint8. (printing the img values after
std imread - they are NOT floats.)
I have haralick features obtained from Matlab and am trying to duplicate
these with Mahotas - so far the resulting values are quite different.
thanks
jeannie
--
You received this message because you are subscribed to the Google
Groups
Post by Jeannie Fitzgerald
"pythonvision" group.
To unsubscribe from this group and stop receiving emails from it, send
an
Post by Jeannie Fitzgerald
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups
"pythonvision" group.
To unsubscribe from this group and stop receiving emails from it, send an
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "pythonvision" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pythonvision+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
For more options, visit https://groups.google.com/d/optout.
Jeannie Fitzgerald
2014-09-29 13:51:19 UTC
Permalink
Loading Image...
Post by Luis Pedro Coelho
Just put it anywhere that's public and send the link.
(Or share it with me through Dropbox or similar)
--
Luis Pedro Coelho | EMBL | http://luispedro.org
My blog: http://metarabbit.wordpress.com
Post by Jeannie Fitzgerald
Hi,
Unfortunately, the image is too large - is there an other way I can submit
it, rather than by attachment?
img = mahotas.imread('exampleImage.png')
features = mahotas.features.haralick(img)
Jeannie
Post by Luis Pedro Coelho
Hi Jeannie,
Can you please post an image + small examples where this error
happens?
Post by Jeannie Fitzgerald
Post by Luis Pedro Coelho
Matlab may be doing other normalizations, it's my guess.
Thank you,
--
Luis Pedro Coelho | EMBL | http://luispedro.org
My blog: http://metarabbit.wordpress.com
Post by Jeannie Fitzgerald
Hi,
File "nSOGP.py", line 742, in <module>
main(sys.argv[1:])
File "nSOGP.py", line 721, in main
features = mahotas.features.haralick(img)
File
"/usr/local/lib/python2.7/dist-packages/mahotas/features/texture.py",
Post by Jeannie Fitzgerald
Post by Luis Pedro Coelho
Post by Jeannie Fitzgerald
line
88, in haralick
cmat = np.empty((fm1, fm1), np.int32)
MemoryError
This does not happen with a. the same image converted to .jpg or b.
if I
Post by Jeannie Fitzgerald
Post by Luis Pedro Coelho
Post by Jeannie Fitzgerald
save the image with imread.imsave as uint8. (printing the img values after
std imread - they are NOT floats.)
I have haralick features obtained from Matlab and am trying to
duplicate
Post by Jeannie Fitzgerald
Post by Luis Pedro Coelho
Post by Jeannie Fitzgerald
these with Mahotas - so far the resulting values are quite
different.
Post by Jeannie Fitzgerald
Post by Luis Pedro Coelho
Post by Jeannie Fitzgerald
thanks
jeannie
--
You received this message because you are subscribed to the Google
Groups
Post by Jeannie Fitzgerald
"pythonvision" group.
To unsubscribe from this group and stop receiving emails from it,
send
Post by Jeannie Fitzgerald
Post by Luis Pedro Coelho
an
Post by Jeannie Fitzgerald
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google
Groups
Post by Jeannie Fitzgerald
"pythonvision" group.
To unsubscribe from this group and stop receiving emails from it, send
an
Post by Jeannie Fitzgerald
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "pythonvision" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pythonvision+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
For more options, visit https://groups.google.com/d/optout.
Luis Pedro Coelho
2014-09-29 15:42:28 UTC
Permalink
The problem is that this image has 54555 greylevels.
The co-occurence matrix thus requires 22GiB.

Have you considered downsampling the image?

mh.features.haralick(im // 10)

uses less memory

HTH
--
Luis Pedro Coelho | EMBL | http://luispedro.org
My blog: http://metarabbit.wordpress.com
Post by Jeannie Fitzgerald
https://www.dropbox.com/s/dg5jjo5xra1xvbd/exampleImage.png?dl=0
Post by Luis Pedro Coelho
Just put it anywhere that's public and send the link.
(Or share it with me through Dropbox or similar)
--
Luis Pedro Coelho | EMBL | http://luispedro.org
My blog: http://metarabbit.wordpress.com
Post by Jeannie Fitzgerald
Hi,
Unfortunately, the image is too large - is there an other way I can submit
it, rather than by attachment?
img = mahotas.imread('exampleImage.png')
features = mahotas.features.haralick(img)
Jeannie
Post by Luis Pedro Coelho
Hi Jeannie,
Can you please post an image + small examples where this error
happens?
Post by Jeannie Fitzgerald
Post by Luis Pedro Coelho
Matlab may be doing other normalizations, it's my guess.
Thank you,
--
Luis Pedro Coelho | EMBL | http://luispedro.org
My blog: http://metarabbit.wordpress.com
Post by Jeannie Fitzgerald
Hi,
File "nSOGP.py", line 742, in <module>
main(sys.argv[1:])
File "nSOGP.py", line 721, in main
features = mahotas.features.haralick(img)
File
"/usr/local/lib/python2.7/dist-packages/mahotas/features/texture.py",
Post by Jeannie Fitzgerald
Post by Luis Pedro Coelho
Post by Jeannie Fitzgerald
line
88, in haralick
cmat = np.empty((fm1, fm1), np.int32)
MemoryError
This does not happen with a. the same image converted to .jpg or b.
if I
Post by Jeannie Fitzgerald
Post by Luis Pedro Coelho
Post by Jeannie Fitzgerald
save the image with imread.imsave as uint8. (printing the img values after
std imread - they are NOT floats.)
I have haralick features obtained from Matlab and am trying to
duplicate
Post by Jeannie Fitzgerald
Post by Luis Pedro Coelho
Post by Jeannie Fitzgerald
these with Mahotas - so far the resulting values are quite
different.
Post by Jeannie Fitzgerald
Post by Luis Pedro Coelho
Post by Jeannie Fitzgerald
thanks
jeannie
--
You received this message because you are subscribed to the Google
Groups
Post by Jeannie Fitzgerald
"pythonvision" group.
To unsubscribe from this group and stop receiving emails from it,
send
Post by Jeannie Fitzgerald
Post by Luis Pedro Coelho
an
Post by Jeannie Fitzgerald
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google
Groups
Post by Jeannie Fitzgerald
"pythonvision" group.
To unsubscribe from this group and stop receiving emails from it, send
an
Post by Jeannie Fitzgerald
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups
"pythonvision" group.
To unsubscribe from this group and stop receiving emails from it, send an
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "pythonvision" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pythonvision+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
For more options, visit https://groups.google.com/d/optout.
Jeannie Fitzgerald
2014-09-29 16:07:34 UTC
Permalink
Hi,

Of course I should have thought of that. If I wanted to downsample to say
256 gray levels - how would I do that in mahotas?

thanks,

Jeannie
Post by Luis Pedro Coelho
The problem is that this image has 54555 greylevels.
The co-occurence matrix thus requires 22GiB.
Have you considered downsampling the image?
mh.features.haralick(im // 10)
uses less memory
HTH
--
Luis Pedro Coelho | EMBL | http://luispedro.org
My blog: http://metarabbit.wordpress.com
Post by Jeannie Fitzgerald
https://www.dropbox.com/s/dg5jjo5xra1xvbd/exampleImage.png?dl=0
thanks,
jeannie
Post by Luis Pedro Coelho
Post by Jeannie Fitzgerald
Post by Luis Pedro Coelho
Just put it anywhere that's public and send the link.
(Or share it with me through Dropbox or similar)
--
Luis Pedro Coelho | EMBL | http://luispedro.org
My blog: http://metarabbit.wordpress.com
Post by Jeannie Fitzgerald
Hi,
Unfortunately, the image is too large - is there an other way I can submit
it, rather than by attachment?
img = mahotas.imread('exampleImage.png')
features = mahotas.features.haralick(img)
Jeannie
On Monday, September 29, 2014 1:09:51 PM UTC+1, Luis Pedro Coelho
Post by Luis Pedro Coelho
Hi Jeannie,
Can you please post an image + small examples where this error
happens?
Post by Jeannie Fitzgerald
Post by Luis Pedro Coelho
Matlab may be doing other normalizations, it's my guess.
Thank you,
--
Luis Pedro Coelho | EMBL | http://luispedro.org
My blog: http://metarabbit.wordpress.com
Post by Jeannie Fitzgerald
Hi,
Obtaining haralick features for a .png image I receive the
following
Post by Jeannie Fitzgerald
Post by Luis Pedro Coelho
Post by Jeannie Fitzgerald
Post by Luis Pedro Coelho
Post by Jeannie Fitzgerald
File "nSOGP.py", line 742, in <module>
main(sys.argv[1:])
File "nSOGP.py", line 721, in main
features = mahotas.features.haralick(img)
File
"/usr/local/lib/python2.7/dist-packages/mahotas/features/texture.py",
Post by Jeannie Fitzgerald
Post by Luis Pedro Coelho
Post by Jeannie Fitzgerald
line
88, in haralick
cmat = np.empty((fm1, fm1), np.int32)
MemoryError
This does not happen with a. the same image converted to .jpg or
b.
Post by Jeannie Fitzgerald
Post by Luis Pedro Coelho
if I
Post by Jeannie Fitzgerald
Post by Luis Pedro Coelho
Post by Jeannie Fitzgerald
save the image with imread.imsave as uint8. (printing the img
values
Post by Jeannie Fitzgerald
Post by Luis Pedro Coelho
Post by Jeannie Fitzgerald
Post by Luis Pedro Coelho
Post by Jeannie Fitzgerald
after
std imread - they are NOT floats.)
I have haralick features obtained from Matlab and am trying to
duplicate
Post by Jeannie Fitzgerald
Post by Luis Pedro Coelho
Post by Jeannie Fitzgerald
these with Mahotas - so far the resulting values are quite
different.
Post by Jeannie Fitzgerald
Post by Luis Pedro Coelho
Post by Jeannie Fitzgerald
thanks
jeannie
--
You received this message because you are subscribed to the
Google
Post by Jeannie Fitzgerald
Post by Luis Pedro Coelho
Post by Jeannie Fitzgerald
Post by Luis Pedro Coelho
Groups
Post by Jeannie Fitzgerald
"pythonvision" group.
To unsubscribe from this group and stop receiving emails from
it,
Post by Jeannie Fitzgerald
Post by Luis Pedro Coelho
send
Post by Jeannie Fitzgerald
Post by Luis Pedro Coelho
an
Post by Jeannie Fitzgerald
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google
Groups
Post by Jeannie Fitzgerald
"pythonvision" group.
To unsubscribe from this group and stop receiving emails from it,
send
Post by Jeannie Fitzgerald
Post by Luis Pedro Coelho
an
Post by Jeannie Fitzgerald
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google
Groups
Post by Jeannie Fitzgerald
"pythonvision" group.
To unsubscribe from this group and stop receiving emails from it, send
an
Post by Jeannie Fitzgerald
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "pythonvision" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pythonvision+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
For more options, visit https://groups.google.com/d/optout.
Luis Pedro Coelho
2014-09-29 17:52:10 UTC
Permalink
The simplest way is to use ``mahotas.stretch``:

import mahotas as mh
im = mh.imread('exampleImage.png')
mh.features.haralick(mh.stretch(im))

works on my side with your image
--
Luis Pedro Coelho | EMBL | http://luispedro.org
My blog: http://metarabbit.wordpress.com
Post by Jeannie Fitzgerald
Hi,
Of course I should have thought of that. If I wanted to downsample to say
256 gray levels - how would I do that in mahotas?
thanks,
Jeannie
Post by Luis Pedro Coelho
The problem is that this image has 54555 greylevels.
The co-occurence matrix thus requires 22GiB.
Have you considered downsampling the image?
mh.features.haralick(im // 10)
uses less memory
HTH
--
Luis Pedro Coelho | EMBL | http://luispedro.org
My blog: http://metarabbit.wordpress.com
Post by Jeannie Fitzgerald
https://www.dropbox.com/s/dg5jjo5xra1xvbd/exampleImage.png?dl=0
thanks,
jeannie
Post by Luis Pedro Coelho
Post by Jeannie Fitzgerald
Post by Luis Pedro Coelho
Just put it anywhere that's public and send the link.
(Or share it with me through Dropbox or similar)
--
Luis Pedro Coelho | EMBL | http://luispedro.org
My blog: http://metarabbit.wordpress.com
Post by Jeannie Fitzgerald
Hi,
Unfortunately, the image is too large - is there an other way I can submit
it, rather than by attachment?
img = mahotas.imread('exampleImage.png')
features = mahotas.features.haralick(img)
Jeannie
On Monday, September 29, 2014 1:09:51 PM UTC+1, Luis Pedro Coelho
Post by Luis Pedro Coelho
Hi Jeannie,
Can you please post an image + small examples where this error
happens?
Post by Jeannie Fitzgerald
Post by Luis Pedro Coelho
Matlab may be doing other normalizations, it's my guess.
Thank you,
--
Luis Pedro Coelho | EMBL | http://luispedro.org
My blog: http://metarabbit.wordpress.com
Post by Jeannie Fitzgerald
Hi,
Obtaining haralick features for a .png image I receive the
following
Post by Jeannie Fitzgerald
Post by Luis Pedro Coelho
Post by Jeannie Fitzgerald
Post by Luis Pedro Coelho
Post by Jeannie Fitzgerald
File "nSOGP.py", line 742, in <module>
main(sys.argv[1:])
File "nSOGP.py", line 721, in main
features = mahotas.features.haralick(img)
File
"/usr/local/lib/python2.7/dist-packages/mahotas/features/texture.py",
Post by Jeannie Fitzgerald
Post by Luis Pedro Coelho
Post by Jeannie Fitzgerald
line
88, in haralick
cmat = np.empty((fm1, fm1), np.int32)
MemoryError
This does not happen with a. the same image converted to .jpg or
b.
Post by Jeannie Fitzgerald
Post by Luis Pedro Coelho
if I
Post by Jeannie Fitzgerald
Post by Luis Pedro Coelho
Post by Jeannie Fitzgerald
save the image with imread.imsave as uint8. (printing the img
values
Post by Jeannie Fitzgerald
Post by Luis Pedro Coelho
Post by Jeannie Fitzgerald
Post by Luis Pedro Coelho
Post by Jeannie Fitzgerald
after
std imread - they are NOT floats.)
I have haralick features obtained from Matlab and am trying to
duplicate
Post by Jeannie Fitzgerald
Post by Luis Pedro Coelho
Post by Jeannie Fitzgerald
these with Mahotas - so far the resulting values are quite
different.
Post by Jeannie Fitzgerald
Post by Luis Pedro Coelho
Post by Jeannie Fitzgerald
thanks
jeannie
--
You received this message because you are subscribed to the
Google
Post by Jeannie Fitzgerald
Post by Luis Pedro Coelho
Post by Jeannie Fitzgerald
Post by Luis Pedro Coelho
Groups
Post by Jeannie Fitzgerald
"pythonvision" group.
To unsubscribe from this group and stop receiving emails from
it,
Post by Jeannie Fitzgerald
Post by Luis Pedro Coelho
send
Post by Jeannie Fitzgerald
Post by Luis Pedro Coelho
an
Post by Jeannie Fitzgerald
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google
Groups
Post by Jeannie Fitzgerald
"pythonvision" group.
To unsubscribe from this group and stop receiving emails from it,
send
Post by Jeannie Fitzgerald
Post by Luis Pedro Coelho
an
Post by Jeannie Fitzgerald
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google
Groups
Post by Jeannie Fitzgerald
"pythonvision" group.
To unsubscribe from this group and stop receiving emails from it, send
an
Post by Jeannie Fitzgerald
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups
"pythonvision" group.
To unsubscribe from this group and stop receiving emails from it, send an
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "pythonvision" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pythonvision+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
For more options, visit https://groups.google.com/d/optout.
Jeannie Fitzgerald
2014-09-29 19:23:30 UTC
Permalink
Hi Luis Pedro,

That eliminated the memory error - but I am not quite clear from the
documentation what exactly the stretch function does. Could you clarify
please?
ideally I would like to use 255 grey levels as i mentioned previously - I
am trying to duplicate Haralick results achieved using Matlab.

Thanks again,

Jeannie
Post by Luis Pedro Coelho
import mahotas as mh
im = mh.imread('exampleImage.png')
mh.features.haralick(mh.stretch(im))
works on my side with your image
--
Luis Pedro Coelho | EMBL | http://luispedro.org
My blog: http://metarabbit.wordpress.com
Post by Jeannie Fitzgerald
Hi,
Of course I should have thought of that. If I wanted to downsample to
say
Post by Jeannie Fitzgerald
256 gray levels - how would I do that in mahotas?
thanks,
Jeannie
Post by Luis Pedro Coelho
The problem is that this image has 54555 greylevels.
The co-occurence matrix thus requires 22GiB.
Have you considered downsampling the image?
mh.features.haralick(im // 10)
uses less memory
HTH
--
Luis Pedro Coelho | EMBL | http://luispedro.org
My blog: http://metarabbit.wordpress.com
Post by Jeannie Fitzgerald
https://www.dropbox.com/s/dg5jjo5xra1xvbd/exampleImage.png?dl=0
thanks,
jeannie
Post by Luis Pedro Coelho
Post by Jeannie Fitzgerald
On Monday, September 29, 2014 2:36:10 PM UTC+1, Luis Pedro Coelho
Post by Luis Pedro Coelho
Just put it anywhere that's public and send the link.
(Or share it with me through Dropbox or similar)
--
Luis Pedro Coelho | EMBL | http://luispedro.org
My blog: http://metarabbit.wordpress.com
Post by Jeannie Fitzgerald
Hi,
Unfortunately, the image is too large - is there an other way I
can
Post by Jeannie Fitzgerald
Post by Luis Pedro Coelho
Post by Jeannie Fitzgerald
Post by Luis Pedro Coelho
Post by Jeannie Fitzgerald
submit
it, rather than by attachment?
img = mahotas.imread('exampleImage.png')
features = mahotas.features.haralick(img)
Jeannie
On Monday, September 29, 2014 1:09:51 PM UTC+1, Luis Pedro
Coelho
Post by Jeannie Fitzgerald
Post by Luis Pedro Coelho
Post by Jeannie Fitzgerald
Post by Luis Pedro Coelho
Post by Jeannie Fitzgerald
Post by Luis Pedro Coelho
Hi Jeannie,
Can you please post an image + small examples where this error
happens?
Post by Jeannie Fitzgerald
Post by Luis Pedro Coelho
Matlab may be doing other normalizations, it's my guess.
Thank you,
--
Luis Pedro Coelho | EMBL | http://luispedro.org
My blog: http://metarabbit.wordpress.com
Post by Jeannie Fitzgerald
Hi,
Obtaining haralick features for a .png image I receive the
following
Post by Jeannie Fitzgerald
Post by Luis Pedro Coelho
Post by Jeannie Fitzgerald
Post by Luis Pedro Coelho
Post by Jeannie Fitzgerald
File "nSOGP.py", line 742, in <module>
main(sys.argv[1:])
File "nSOGP.py", line 721, in main
features = mahotas.features.haralick(img)
File
"/usr/local/lib/python2.7/dist-packages/mahotas/features/texture.py",
Post by Jeannie Fitzgerald
Post by Luis Pedro Coelho
Post by Jeannie Fitzgerald
Post by Luis Pedro Coelho
Post by Jeannie Fitzgerald
Post by Luis Pedro Coelho
Post by Jeannie Fitzgerald
line
88, in haralick
cmat = np.empty((fm1, fm1), np.int32)
MemoryError
This does not happen with a. the same image converted to
.jpg or
Post by Jeannie Fitzgerald
Post by Luis Pedro Coelho
b.
Post by Jeannie Fitzgerald
Post by Luis Pedro Coelho
if I
Post by Jeannie Fitzgerald
Post by Luis Pedro Coelho
Post by Jeannie Fitzgerald
save the image with imread.imsave as uint8. (printing the
img
Post by Jeannie Fitzgerald
Post by Luis Pedro Coelho
values
Post by Jeannie Fitzgerald
Post by Luis Pedro Coelho
Post by Jeannie Fitzgerald
Post by Luis Pedro Coelho
Post by Jeannie Fitzgerald
after
std imread - they are NOT floats.)
I have haralick features obtained from Matlab and am trying
to
Post by Jeannie Fitzgerald
Post by Luis Pedro Coelho
Post by Jeannie Fitzgerald
Post by Luis Pedro Coelho
duplicate
Post by Jeannie Fitzgerald
Post by Luis Pedro Coelho
Post by Jeannie Fitzgerald
these with Mahotas - so far the resulting values are quite
different.
Post by Jeannie Fitzgerald
Post by Luis Pedro Coelho
Post by Jeannie Fitzgerald
thanks
jeannie
--
You received this message because you are subscribed to the
Google
Post by Jeannie Fitzgerald
Post by Luis Pedro Coelho
Post by Jeannie Fitzgerald
Post by Luis Pedro Coelho
Groups
Post by Jeannie Fitzgerald
"pythonvision" group.
To unsubscribe from this group and stop receiving emails
from
Post by Jeannie Fitzgerald
Post by Luis Pedro Coelho
it,
Post by Jeannie Fitzgerald
Post by Luis Pedro Coelho
send
Post by Jeannie Fitzgerald
Post by Luis Pedro Coelho
an
Post by Jeannie Fitzgerald
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the
Google
Post by Jeannie Fitzgerald
Post by Luis Pedro Coelho
Post by Jeannie Fitzgerald
Post by Luis Pedro Coelho
Groups
Post by Jeannie Fitzgerald
"pythonvision" group.
To unsubscribe from this group and stop receiving emails from
it,
Post by Jeannie Fitzgerald
Post by Luis Pedro Coelho
send
Post by Jeannie Fitzgerald
Post by Luis Pedro Coelho
an
Post by Jeannie Fitzgerald
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google
Groups
Post by Jeannie Fitzgerald
"pythonvision" group.
To unsubscribe from this group and stop receiving emails from it,
send
Post by Jeannie Fitzgerald
Post by Luis Pedro Coelho
an
Post by Jeannie Fitzgerald
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google
Groups
Post by Jeannie Fitzgerald
"pythonvision" group.
To unsubscribe from this group and stop receiving emails from it, send
an
Post by Jeannie Fitzgerald
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "pythonvision" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pythonvision+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
For more options, visit https://groups.google.com/d/optout.
Jeannie Fitzgerald
2014-09-30 08:59:38 UTC
Permalink
Hi,

The parameters min and max of the stretch function do the downsampling?
The Matlab GLCMs that I have are 1 for each orientation and each
neighbourhood from 1-12. The Mahotas cooccurance matrices 1 for each
orientation for a neighbourhood of 1? Ideally, I would like to use mahotas
instead of Matlab for this work but I need to be able to duplicate the
results and make sure that I understand how the functionality is
implemented. Thank you for your support.

jeannie
Post by Jeannie Fitzgerald
Hi Luis Pedro,
That eliminated the memory error - but I am not quite clear from the
documentation what exactly the stretch function does. Could you clarify
please?
ideally I would like to use 255 grey levels as i mentioned previously - I
am trying to duplicate Haralick results achieved using Matlab.
Thanks again,
Jeannie
Post by Luis Pedro Coelho
import mahotas as mh
im = mh.imread('exampleImage.png')
mh.features.haralick(mh.stretch(im))
works on my side with your image
--
Luis Pedro Coelho | EMBL | http://luispedro.org
My blog: http://metarabbit.wordpress.com
Post by Jeannie Fitzgerald
Hi,
Of course I should have thought of that. If I wanted to downsample to
say
Post by Jeannie Fitzgerald
256 gray levels - how would I do that in mahotas?
thanks,
Jeannie
On Monday, September 29, 2014 4:42:31 PM UTC+1, Luis Pedro Coelho
Post by Luis Pedro Coelho
The problem is that this image has 54555 greylevels.
The co-occurence matrix thus requires 22GiB.
Have you considered downsampling the image?
mh.features.haralick(im // 10)
uses less memory
HTH
--
Luis Pedro Coelho | EMBL | http://luispedro.org
My blog: http://metarabbit.wordpress.com
Post by Jeannie Fitzgerald
https://www.dropbox.com/s/dg5jjo5xra1xvbd/exampleImage.png?dl=0
thanks,
jeannie
Post by Luis Pedro Coelho
Post by Jeannie Fitzgerald
On Monday, September 29, 2014 2:36:10 PM UTC+1, Luis Pedro Coelho
Post by Luis Pedro Coelho
Just put it anywhere that's public and send the link.
(Or share it with me through Dropbox or similar)
--
Luis Pedro Coelho | EMBL | http://luispedro.org
My blog: http://metarabbit.wordpress.com
Post by Jeannie Fitzgerald
Hi,
Unfortunately, the image is too large - is there an other way I
can
Post by Jeannie Fitzgerald
Post by Luis Pedro Coelho
Post by Jeannie Fitzgerald
Post by Luis Pedro Coelho
Post by Jeannie Fitzgerald
submit
it, rather than by attachment?
img = mahotas.imread('exampleImage.png')
features = mahotas.features.haralick(img)
Jeannie
On Monday, September 29, 2014 1:09:51 PM UTC+1, Luis Pedro
Coelho
Post by Jeannie Fitzgerald
Post by Luis Pedro Coelho
Post by Jeannie Fitzgerald
Post by Luis Pedro Coelho
Post by Jeannie Fitzgerald
Post by Luis Pedro Coelho
Hi Jeannie,
Can you please post an image + small examples where this
error
Post by Jeannie Fitzgerald
Post by Luis Pedro Coelho
Post by Jeannie Fitzgerald
Post by Luis Pedro Coelho
happens?
Post by Jeannie Fitzgerald
Post by Luis Pedro Coelho
Matlab may be doing other normalizations, it's my guess.
Thank you,
--
Luis Pedro Coelho | EMBL | http://luispedro.org
My blog: http://metarabbit.wordpress.com
Post by Jeannie Fitzgerald
Hi,
Obtaining haralick features for a .png image I receive the
following
Post by Jeannie Fitzgerald
Post by Luis Pedro Coelho
Post by Jeannie Fitzgerald
Post by Luis Pedro Coelho
Post by Jeannie Fitzgerald
File "nSOGP.py", line 742, in <module>
main(sys.argv[1:])
File "nSOGP.py", line 721, in main
features = mahotas.features.haralick(img)
File
"/usr/local/lib/python2.7/dist-packages/mahotas/features/texture.py",
Post by Jeannie Fitzgerald
Post by Luis Pedro Coelho
Post by Jeannie Fitzgerald
Post by Luis Pedro Coelho
Post by Jeannie Fitzgerald
Post by Luis Pedro Coelho
Post by Jeannie Fitzgerald
line
88, in haralick
cmat = np.empty((fm1, fm1), np.int32)
MemoryError
This does not happen with a. the same image converted to
.jpg or
Post by Jeannie Fitzgerald
Post by Luis Pedro Coelho
b.
Post by Jeannie Fitzgerald
Post by Luis Pedro Coelho
if I
Post by Jeannie Fitzgerald
Post by Luis Pedro Coelho
Post by Jeannie Fitzgerald
save the image with imread.imsave as uint8. (printing the
img
Post by Jeannie Fitzgerald
Post by Luis Pedro Coelho
values
Post by Jeannie Fitzgerald
Post by Luis Pedro Coelho
Post by Jeannie Fitzgerald
Post by Luis Pedro Coelho
Post by Jeannie Fitzgerald
after
std imread - they are NOT floats.)
I have haralick features obtained from Matlab and am trying
to
Post by Jeannie Fitzgerald
Post by Luis Pedro Coelho
Post by Jeannie Fitzgerald
Post by Luis Pedro Coelho
duplicate
Post by Jeannie Fitzgerald
Post by Luis Pedro Coelho
Post by Jeannie Fitzgerald
these with Mahotas - so far the resulting values are quite
different.
Post by Jeannie Fitzgerald
Post by Luis Pedro Coelho
Post by Jeannie Fitzgerald
thanks
jeannie
--
You received this message because you are subscribed to the
Google
Post by Jeannie Fitzgerald
Post by Luis Pedro Coelho
Post by Jeannie Fitzgerald
Post by Luis Pedro Coelho
Groups
Post by Jeannie Fitzgerald
"pythonvision" group.
To unsubscribe from this group and stop receiving emails
from
Post by Jeannie Fitzgerald
Post by Luis Pedro Coelho
it,
Post by Jeannie Fitzgerald
Post by Luis Pedro Coelho
send
Post by Jeannie Fitzgerald
Post by Luis Pedro Coelho
an
Post by Jeannie Fitzgerald
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the
Google
Post by Jeannie Fitzgerald
Post by Luis Pedro Coelho
Post by Jeannie Fitzgerald
Post by Luis Pedro Coelho
Groups
Post by Jeannie Fitzgerald
"pythonvision" group.
To unsubscribe from this group and stop receiving emails from
it,
Post by Jeannie Fitzgerald
Post by Luis Pedro Coelho
send
Post by Jeannie Fitzgerald
Post by Luis Pedro Coelho
an
Post by Jeannie Fitzgerald
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google
Groups
Post by Jeannie Fitzgerald
"pythonvision" group.
To unsubscribe from this group and stop receiving emails from it,
send
Post by Jeannie Fitzgerald
Post by Luis Pedro Coelho
an
Post by Jeannie Fitzgerald
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google
Groups
Post by Jeannie Fitzgerald
"pythonvision" group.
To unsubscribe from this group and stop receiving emails from it, send
an
Post by Jeannie Fitzgerald
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "pythonvision" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pythonvision+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
For more options, visit https://groups.google.com/d/optout.
Luis Pedro Coelho
2014-09-30 16:20:13 UTC
Permalink
The stretch function does simple linear contrast stretching. I updated
the docs to be more explicit:

http://mahotas.readthedocs.org/en/latest/api.html?highlight=stretch#mahotas.stretch

*

I'm not too sure what MATLAB does. In the past, I've computed Haralick
on downsampled versions of the image, but there is no way to directly
compute co-occurrence matrices on non-adjacent pixels.
--
Luis Pedro Coelho | EMBL | http://luispedro.org
My blog: http://metarabbit.wordpress.com
Post by Jeannie Fitzgerald
Hi,
The parameters min and max of the stretch function do the downsampling?
The Matlab GLCMs that I have are 1 for each orientation and each
neighbourhood from 1-12. The Mahotas cooccurance matrices 1 for each
orientation for a neighbourhood of 1? Ideally, I would like to use mahotas
instead of Matlab for this work but I need to be able to duplicate the
results and make sure that I understand how the functionality is
implemented. Thank you for your support.
jeannie
Post by Jeannie Fitzgerald
Hi Luis Pedro,
That eliminated the memory error - but I am not quite clear from the
documentation what exactly the stretch function does. Could you clarify
please?
ideally I would like to use 255 grey levels as i mentioned previously - I
am trying to duplicate Haralick results achieved using Matlab.
Thanks again,
Jeannie
Post by Luis Pedro Coelho
import mahotas as mh
im = mh.imread('exampleImage.png')
mh.features.haralick(mh.stretch(im))
works on my side with your image
--
Luis Pedro Coelho | EMBL | http://luispedro.org
My blog: http://metarabbit.wordpress.com
Post by Jeannie Fitzgerald
Hi,
Of course I should have thought of that. If I wanted to downsample to
say
Post by Jeannie Fitzgerald
256 gray levels - how would I do that in mahotas?
thanks,
Jeannie
On Monday, September 29, 2014 4:42:31 PM UTC+1, Luis Pedro Coelho
Post by Luis Pedro Coelho
The problem is that this image has 54555 greylevels.
The co-occurence matrix thus requires 22GiB.
Have you considered downsampling the image?
mh.features.haralick(im // 10)
uses less memory
HTH
--
Luis Pedro Coelho | EMBL | http://luispedro.org
My blog: http://metarabbit.wordpress.com
Post by Jeannie Fitzgerald
https://www.dropbox.com/s/dg5jjo5xra1xvbd/exampleImage.png?dl=0
thanks,
jeannie
Post by Luis Pedro Coelho
Post by Jeannie Fitzgerald
On Monday, September 29, 2014 2:36:10 PM UTC+1, Luis Pedro Coelho
Post by Luis Pedro Coelho
Just put it anywhere that's public and send the link.
(Or share it with me through Dropbox or similar)
--
Luis Pedro Coelho | EMBL | http://luispedro.org
My blog: http://metarabbit.wordpress.com
Post by Jeannie Fitzgerald
Hi,
Unfortunately, the image is too large - is there an other way I
can
Post by Jeannie Fitzgerald
Post by Luis Pedro Coelho
Post by Jeannie Fitzgerald
Post by Luis Pedro Coelho
Post by Jeannie Fitzgerald
submit
it, rather than by attachment?
img = mahotas.imread('exampleImage.png')
features = mahotas.features.haralick(img)
Jeannie
On Monday, September 29, 2014 1:09:51 PM UTC+1, Luis Pedro
Coelho
Post by Jeannie Fitzgerald
Post by Luis Pedro Coelho
Post by Jeannie Fitzgerald
Post by Luis Pedro Coelho
Post by Jeannie Fitzgerald
Post by Luis Pedro Coelho
Hi Jeannie,
Can you please post an image + small examples where this
error
Post by Jeannie Fitzgerald
Post by Luis Pedro Coelho
Post by Jeannie Fitzgerald
Post by Luis Pedro Coelho
happens?
Post by Jeannie Fitzgerald
Post by Luis Pedro Coelho
Matlab may be doing other normalizations, it's my guess.
Thank you,
--
Luis Pedro Coelho | EMBL | http://luispedro.org
My blog: http://metarabbit.wordpress.com
Post by Jeannie Fitzgerald
Hi,
Obtaining haralick features for a .png image I receive the
following
Post by Jeannie Fitzgerald
Post by Luis Pedro Coelho
Post by Jeannie Fitzgerald
Post by Luis Pedro Coelho
Post by Jeannie Fitzgerald
File "nSOGP.py", line 742, in <module>
main(sys.argv[1:])
File "nSOGP.py", line 721, in main
features = mahotas.features.haralick(img)
File
"/usr/local/lib/python2.7/dist-packages/mahotas/features/texture.py",
Post by Jeannie Fitzgerald
Post by Luis Pedro Coelho
Post by Jeannie Fitzgerald
Post by Luis Pedro Coelho
Post by Jeannie Fitzgerald
Post by Luis Pedro Coelho
Post by Jeannie Fitzgerald
line
88, in haralick
cmat = np.empty((fm1, fm1), np.int32)
MemoryError
This does not happen with a. the same image converted to
.jpg or
Post by Jeannie Fitzgerald
Post by Luis Pedro Coelho
b.
Post by Jeannie Fitzgerald
Post by Luis Pedro Coelho
if I
Post by Jeannie Fitzgerald
Post by Luis Pedro Coelho
Post by Jeannie Fitzgerald
save the image with imread.imsave as uint8. (printing the
img
Post by Jeannie Fitzgerald
Post by Luis Pedro Coelho
values
Post by Jeannie Fitzgerald
Post by Luis Pedro Coelho
Post by Jeannie Fitzgerald
Post by Luis Pedro Coelho
Post by Jeannie Fitzgerald
after
std imread - they are NOT floats.)
I have haralick features obtained from Matlab and am trying
to
Post by Jeannie Fitzgerald
Post by Luis Pedro Coelho
Post by Jeannie Fitzgerald
Post by Luis Pedro Coelho
duplicate
Post by Jeannie Fitzgerald
Post by Luis Pedro Coelho
Post by Jeannie Fitzgerald
these with Mahotas - so far the resulting values are quite
different.
Post by Jeannie Fitzgerald
Post by Luis Pedro Coelho
Post by Jeannie Fitzgerald
thanks
jeannie
--
You received this message because you are subscribed to the
Google
Post by Jeannie Fitzgerald
Post by Luis Pedro Coelho
Post by Jeannie Fitzgerald
Post by Luis Pedro Coelho
Groups
Post by Jeannie Fitzgerald
"pythonvision" group.
To unsubscribe from this group and stop receiving emails
from
Post by Jeannie Fitzgerald
Post by Luis Pedro Coelho
it,
Post by Jeannie Fitzgerald
Post by Luis Pedro Coelho
send
Post by Jeannie Fitzgerald
Post by Luis Pedro Coelho
an
Post by Jeannie Fitzgerald
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the
Google
Post by Jeannie Fitzgerald
Post by Luis Pedro Coelho
Post by Jeannie Fitzgerald
Post by Luis Pedro Coelho
Groups
Post by Jeannie Fitzgerald
"pythonvision" group.
To unsubscribe from this group and stop receiving emails from
it,
Post by Jeannie Fitzgerald
Post by Luis Pedro Coelho
send
Post by Jeannie Fitzgerald
Post by Luis Pedro Coelho
an
Post by Jeannie Fitzgerald
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google
Groups
Post by Jeannie Fitzgerald
"pythonvision" group.
To unsubscribe from this group and stop receiving emails from it,
send
Post by Jeannie Fitzgerald
Post by Luis Pedro Coelho
an
Post by Jeannie Fitzgerald
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google
Groups
Post by Jeannie Fitzgerald
"pythonvision" group.
To unsubscribe from this group and stop receiving emails from it, send
an
Post by Jeannie Fitzgerald
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups
"pythonvision" group.
To unsubscribe from this group and stop receiving emails from it, send an
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "pythonvision" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pythonvision+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
For more options, visit https://groups.google.com/d/optout.
Loading...