2

kindly guide me to resolve the issue

AttributeError: partially initialized module 'rasterio' has no attribute '_loading' (most likely due to a circular import)

This code is for GLCM (referred from internet)

from skimage.feature import greycomatrix, greycoprops
import numpy as np
from skimage import data
import rasterio

#path = "D:\Fig-2-6-2D-slices-some-of-series-of-MRI-brain-image.png"

with rasterio.open("‪D:\Fig-2-6-2D-slices-some-of-series-of-MRI-brain-image.png", 'r') as src:
    import_file = src.read()
    img = import_file[0,:,:] #i need only the two dimentions (height, width)
    rescale_intensity(img)
    print(img.shape)
    

#calculate the GLCM specifying the distance, direction(4 directions) and number of grey levels
GLCM = greycomatrix(img, [1], [0, np.pi/4, np.pi/2, 3*np.pi/4],levels=8, symmetric=False, normed=True)
#list(GLCM[:,:,0,2])


#Calculate texture statistics
contrast = greycoprops(GLCM, 'contrast')

dissimilarity = greycoprops(GLCM, 'dissimilarity')

homogeneity = greycoprops(GLCM, 'homogeneity')

energy = greycoprops(GLCM, 'energy')

correlation = greycoprops(GLCM, 'correlation')

ASM = greycoprops(GLCM, 'ASM')
James Z
  • 12,209
  • 10
  • 24
  • 44
sairam
  • 29
  • 2

0 Answers0