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!

1
  • Use I8[j,k] to acces the jth row and kth column. Commented Jul 31, 2020 at 2:36

1 Answer 1

2

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

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.