Coder Social home page Coder Social logo

pyfeats's People

Contributors

giakoumoglou avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

pyfeats's Issues

How to cite pyfeats package

Hey there!
first of all I want to say thank you about the great package for image feature extraction. keep it up!
I want to cite your package in our paper. can you guide us?
thanks

Inconsistent GLSZM features

Hi,

I am trying to perform texture analysis for an image and everything is working perfectly, however, I seem to be experiencing an inconsistency when computing the GLSZM features. Specifically, when I compute the features locally (on my personal computer), I get the correct results (as seen from the results on the left of the screenshot attached below) whereas when I try to build a Docker container and try to run it, I get a different set of GLSZM features for the same image (as shown to the right of the screenshot attached). I have ensured that I am using the same package versions locally and in the requirements.txt when building the docker container. Upon further inspection, it seems that it is only the following sub features that are causing the issue: (2) GLSZM_LargeZoneEmphasis, (10) Large Zone Lo wGray Level Emphasis, and (11) Large Zone High Gray Level Emphasis.

Unfortunately, I am unable to share the images that I am using, but the issue arises for the same 3 sub-features.

If you could assist with the issue mentioned above, it would be highly appreciated.
image

FOS Mean calculation

When calculating the mean (in FOS) ...
https://github.com/giakou4/pyfeats/blob/dc0e2d1b3623aeb7f26c9777dafb491ecd961b9c/pyfeats/textural/fos.py#L47

I noticed divergence between a simple np.mean and your version.

f  = f.astype(np.uint8)
mask = mask.astype(np.uint8)
level_min = 0
level_max = 255
Ng = (level_max - level_min) + 1
bins = Ng

# 3) Calculate Histogram H inside ROI
f_ravel = f.ravel() 
mask_ravel = mask.ravel() 
roi = f_ravel[mask_ravel.astype(bool)] 
H = np.histogram(roi, bins=bins, range=[level_min, level_max], density=True)[0]

# 4) Calculate Features
features = np.zeros(16,np.double)  
i = np.arange(0,bins)
features[0] = np.dot(i,H)

features[0] here is the FOS_Mean.
If you calculate a simple np.mean(roi) you get a different result than saved in features[0].
If you edit Ng = (level_max - level_min) + 1 to Ng = (level_max - level_min) (drop the +1), then the results match.

I am not quite sure I understand the +1 here.
For example, in my data:

np.mean(roi) -> 73.9154898873683
features[0] with Ng = (level_max - level_min) + 1 -> 74.20535455359327 
features[0] with Ng = (level_max - level_min) ->  73.9154898873683

gclm.py not working

Hi @giakou4,
Thankyou for your very useful functions.
in gclm.py i get this errors:
mahotas cant import.
and:
AttributeError: module 'mahotas' has no attribute 'features'.

GLRLM_LongRunLowGrayLevelEmphasis possible formula error

Hi,

I just wanted to check if the formula is ok because I think this should be:

temp = _apply_over_degree(np.multiply, rlmatrix, (J*J))
features[9] = ((np.apply_over_axes(np.sum, _apply_over_degree(np.divide, temp, (I*I)), axes=(0, 1))[0, 0])/S).mean()

instead of:

 temp = _apply_over_degree(np.multiply, rlmatrix, (J*J))
features[9] = ((np.apply_over_axes(np.sum, _apply_over_degree(np.divide, temp, (J*J)), axes=(0, 1))[0, 0])/S).mean()

Thanks

Connectivity issue on GLSZM

Thanks very much for your functions. When I call the glszm() to caculate the gray level dependent matrix of a testing array, found that the result is not the same as it in pyradiomic's doc. So I went to check the source code, figured out the paradox occurs because of the connectivety option:

for i in range(Ng-1):
        temp[f!=levels[i]] = 0
        temp[f==levels[i]] = 1
        connected_components = measure.label(temp, connectivity=1)
        connected_components = connected_components * mask
        nZone = len(np.unique(connected_components))
        for j in range(nZone):
            col = np.count_nonzero(connected_components==j)
            GLSZM[i,col] += 1

It seems like in your code, the connected voxels only include the pixesl in direction of 0°, 90°, 180°, 270°, rather than the full range. I don't know wheather this is reasonable or just a carelss mistake. Maybe it' s better for the "connectivity" to be a optional parameters?

GLRLM parameters

Hi, it's me again. This time the confusion occurs on the function glrlm_features(). I've noticed that there exist a "mask" parameter to select the specific area in the image to compute the GLRLM. But when I compare the results of setting it to all zeros and of setting it to all ones, I surprisingly found they are exactly the same. I furtherly dived into the code to compute the primitive matrix, the parameter seems not be called in neither part. So maybe this is an omitted option? The experimental code is as listed below:

import pyfeats as pf
from pyfeats.textural.glrlm import glrlm_0
test_arr=np.array([[4,1,4,3,3],[2,2,2,0,2],[1,0,0,0,2],[3,1,1,1,2],[2,4,2,2,1]])
glrlm_feature,glrlm_lab=pf.glrlm_features(test_arr,None)
glrlm_feature1,glrlm_lab=pf.glrlm_features(test_arr,np.ones(test_img.shape))
glrlm_f0=glrlm_0(test_arr,np.ones(test_arr.shape),5,max(test_arr.shape),False)
glrlm_f01=glrlm_0(test_arr,np.zeros(test_arr.shape),5,max(test_arr.shape),False)
glrlm_feature1==glrlm_feature
glrlm_f0==glrlm_f01

GLCM

Hey!
How to define distances and angles, arguments in GLCM?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.