AIM-Harvard / pyradiomics

Open-source python package for the extraction of Radiomics features from 2D and 3D images and binary masks. Support: https://discourse.slicer.org/c/community/radiomics
http://pyradiomics.readthedocs.io/
BSD 3-Clause "New" or "Revised" License
1.16k stars 500 forks source link

[FEAT EXTRACTION] #654

Closed lauravaldes98 closed 3 years ago

lauravaldes98 commented 4 years ago

Hello, I´m working with DICOM ultrasound images, and I need to calculate texture features from this images. Before that, I apply some filters based on wavelets, so the final image is a numpy.ndarray type. I want to know if is possible use the FeatureExtractor in this numpy.ndarray and if is necessry to use a mask. Thanks!

jvanlunenburg commented 4 years ago

you need a mask. please read the IBSI document on what radiomics are.

in terms of input format I think the image needs to be an SITK object or a supported file format.

JoostJM commented 4 years ago

@lauravaldes98, how do you apply wavelets? If you are using pywavelets, you can also use it's implementation in PyRadiomics, via the waverley filter. Single DICOM images are readable by SimpleITK, though you need to convert to e.g. nrrd if you have a stack of DICOMs forming a 3D volume.

lauravaldes98 commented 3 years ago

Hello, I Finally could apply the feature extraction using the FeatureExtractor, now i´m trying to prove some wavelets filters, but i'm having some troubles. This is the part of the code where I calculate the wavelets coeficients in the image and the mask

_extractor = featureextractor.RadiomicsFeatureExtractor(**settings) imagetype_dic = {'Original': None, 'Wavelet':{'wavelet':['db1']}, 'LoG': None, 'Square': None, 'SquareRoot': None, 'Logarithm': None, 'Exponential': None, 'Gradient': None, 'LBP3D': None} for imagetype in imagetype_dic: extractor.enableImageTypeByName(imagetype, customArgs=imagetype_dic[imagetype]) resultsdic = extractor.execute(image, mask)

and I'm having this error: 850 for i in range(0, start_level): # if start_level = 0 (default) this for loop never gets executed pywt_extensions_pywt.pyx in pywt._extensions._pywt.Wavelet.cinit() AttributeError: 'list' object has no attribute 'lower'

I try to change start_level and level atributes in the Wavelet but it doesn't work. Thank you so much for your help

JoostJM commented 3 years ago

It has nothing to do with start_level. It's in your custom settings, as you can only define 1 wavelet type, not a list of types.

extractor = featureextractor.RadiomicsFeatureExtractor(**settings)
imagetype_dic = {'Original': None,
'Wavelet':{'wavelet':['db1']},  # This is your error, it should read 'Wavelet':{'wavelet':'db1'}
'LoG': None,
'Square': None,
'SquareRoot': None,
'Logarithm': None,
'Exponential': None,
'Gradient': None,
'LBP3D': None}
for imagetype in imagetype_dic:
extractor.enableImageTypeByName(imagetype, customArgs=imagetype_dic[imagetype])
results_dic = extractor.execute(image, mask)