I'm trying to write a simple program to perform T1 mapping of a few MRI Images. My understanding is that all I need is to plot the pixel intensity values by inversion time then fit a curve. The output of fitting the curve is what gives me the T1 values.
This was my attempt:
# Loop through every pixel in image
for row in range(rows):
for col in range(cols):
x = []
y = []
# Add all the inversion time and pixel intesities to list
for image in dicom_images:
x.append(image.InversionTime)
y.append(image.pixel_array[row][col])
# Fit curve
t1 = np.polyfit(x, y, 2)
Assuming what I did above is right so far I am now stuck because I don't know how to take the three coefficients produced by np.polyfit and convert them into a single pixel value. I also don't know if there are additional steps I need to take.
I found some MATLAB examples online but they were really big and hard to follow. This is my first time doing T1 mapping so I'm trying to keep it simple.
Here are some plots of the data points:
plt.plot(x, y)
it (and show the image here) to at least show that it's decaying as expected? $\endgroup$