How to run Pyradiomics

Hi. I am a student, I am practicing using pyrradiomics for feature extraction. I have installed pyradiomics in python 3.6 (64bit), but I don’t know how to run Pyradiomics, please help. Thank you


Review the documentation and if there’s a specific step that’s not working for you describe exactly what you did and what didn’t work as you expect.

https://pyradiomics.readthedocs.io/en/latest/index.html

I’m writing code and trying to extract it, but when it comes to choose 2D array, it crashes. And I’m trying to fix this.

choose 2D array

#The memory is referenced and changed, so call it again.
imageName, maskName = getTestCase(‘lung2’)
imageStack = sitk.ReadImage(imageName)
maskSatck = sitk.ReadImage(maskName)

#Extract pixels as adarray for parametric image calculations, etc.(Example for the 24th slice)
ndimage = sitk.GetArrayFromImage(imageStack)[24]
ndmask = sitk.GetArrayFromImage(maskStack)[24]

#Basically, the data that was originally a DICOM image has a dimension of 3, so it is expanded.
ndimage = np.expand_dims(ndimage, axis=0)
ndmask = np.expand_dims(ndmask, axis=0)

print(ndimage.shape)# (1, 512, 512)Even with force2D, the shape must be 3D.
print(ndmask.shape)# (1, 512, 512)

Can you help me about writing code in feature extraction using pyrradiomics. I tried to use the code but failed. Hope your help.

https://pyradiomics.readthedocs.io/en/latest/features.html

Best regards.

The error message says that you haven’t defined maskStack.

Can you show me how to extract features using pyradiomics in python? Please!!!

I’m afraid we seem to be going in a loop here. I think the documentation is pretty clear, but maybe there’s a specific step that’s not working for you or there’s some conceptual step that isn’t clear. Maybe looking at these suggestions will help you formulate a question someone here can help with.

https://pyradiomics.readthedocs.io/en/latest/usage.html

I am having some problems. Can you give me a solution please?

File “C:/Users/Admin/Desktop/vd2.py”, line 18, in
extractor = featureextractor.RadiomicsFeaturesExtractor(params)
AttributeError: module ‘radiomics.featureextractor’ has no attribute ‘RadiomicsFeaturesExtractor’

and if i drop ‘s’ → RadiomicsFeatureExtractor() can’t try pair ‘kwargs’?

RadiomicsFeaturesExtractor, inputImages etc. are not valid anymore, they are from an older version of PyRadiomics and are renamed etc.

Als to your “kwargs” problem, pleas read the error carefully: It says you are using an outdated syntax. print without parenthesis is not allowed since Python 3.

Sir Im trying segmentation on 2d images but im not able to get the output table of radiomic feature generator.can you please guide me

(post deleted by author)

(post deleted by author)

I have imported the DICOM file but the ‘mask’ as above is correct or not. If I’m wrong, how do I need to correct it? hope the helping
Best regards.
Sang.