radxtools / collageradiomics

Python Implementation of the CoLlAGe radiomics descriptor. CoLlAGe captures subtle anisotropic differences in disease pathologies by measuring entropy of co-occurrences of voxel-level gradient orientations on imaging computed within a local neighborhood.
BSD 3-Clause "New" or "Revised" License
15 stars 11 forks source link

Error during implementation #95

Closed pavi1303 closed 3 years ago

pavi1303 commented 3 years ago

Hi, I am running this in the Pycharm IDE. I created a collage object and then initialized an empty haralick image to then extract features from both angles using the calculate_haralick_textures function. But I'm not getting an ''Object has no attribute error" when initialising an empty variable. Then I had to proceed to get the statistics measure like mean, variance, skewness and kurtosis from these features. My image and mask files were in .mat (MATLAB) format and thus I imported them using the scipy.io library. Here is my code snippet,

import collageradiomics as crd import numpy as np

Creating a collage object

collage = crd.Collage(vol_full, TI_mask) collage.is_3D = True

Creating a haralick image variable

haralick_image = np.empty(collage.dominant_angles.shape + (13,))

Calculating features from both orientations

for angle in range(2): haralick_image[:, :, :, angle, :] = collage.calculate_haralick_textures(collage.dominant_angles[:, :, :, angle])

It is showing me this error, AttributeError: 'Collage' object has no attribute 'dominant_angles'

Where am I going wrong here? Any help would be highly appreciated.

nathanhillyer commented 3 years ago

@pavi1303 That method isn't intended to be used publicly. We will push out an update that prefixes the method with an underscore for clarity.

What are you trying to accomplish? If you just want to calculate the haralick textures, I'd suggest using the mahotas library: https://github.com/luispedro/mahotas

satishev commented 3 years ago

He’s trying to calculate COLLAGE feature for his image/ROI. @pavi1303 never checked — are you able to run the Jupyter notebook? The syntax should be in there (sample code to extract features from an image).

nathanhillyer commented 3 years ago

Here is a link to that notebook: https://github.com/radxtools/collageradiomics/blob/master/jupyter/examples/example.ipynb

In order to calculate the COLLAGE feature for the image, you can do this:

collage = crd.Collage(vol_full, TI_mask)
collage.execute()

We'll be able to detect whether or not it is 3D internally, so no need to set that.

pavi1303 commented 3 years ago

I did check the sample jupyter notebook but did not implement it as a jupyter notebook, I did it in PyCharm. I'll check that out. Thanks.

nathanhillyer commented 3 years ago

You're welcome. If you experience any further difficulties, please reopen this ticket. We're happy to help.