2

Here's a snippet of my code:

#code sample
for i in range(1, number_of_segments + 1):
    I1 = (dcm_pixel_array["array" + str(3 + (i - 1))]) * 2
    I8 = (dcm_pixel_array["array" + str(3 + (7*int((number_of_segments+2)/8)) + (i-1) + 2)]) * 2
    for j in range(I1.ndim):
        for k in range(I1.ndim):
            if (3.03 - (17.85 + 14.87)) / (math.log((I8[j].values[k]) / (I1[j].values[k]))) < 0:
                T2_map = np.zeros(shape = (j, k, i))
            elif (3.03-(17.85+14.87))/(math.log((I8[j].values[k]) / (I1[j].values[k]))) > 100:
                T2_map = np.full((i,j,k), 100)
# end of sample

I am getting the error on the line with the first if statement. It says: "AttributeError: 'numpy.ndarray' object has no attribute 'values'". Any recommendations as to what I should do to correct the error?

Clarifications: "dcm_pixel_array" is a dictionary of arrays (binary masks) that have been read from dicom files. The number of segments is 286. I am trying to access the information in the jth row of the kth column of the I8 and I1 arrays.

Thank you!

Amit Joshi
  • 15,448
  • 21
  • 77
  • 141
NorthWind4721
  • 61
  • 1
  • 5

1 Answers1

2

Since the given dataset is already an array, values won't work. Call the array using I8[j][k]

segfault404
  • 281
  • 1
  • 11