Reputation: 123
If I have an image in the form of [556,556] PX and I would like to plot a certain range of them so say:
Image Size: [556,556]
Plot -> XPixels [224,300] YPixels [224,300]
This was my attempt and it does sort-of what I need it to do, I have the correct pixels selected but unfortunately this only labels the given range and doesn't actually plot the range. Understandably the next part of this would be to plot the new range given the image but how would I go about this?
openDicom = pdi.dcmread(filePath)
plt.imshow(openDicom.pixel_array, cmap=plt.cm.Spectral, origin = 'lower',interpolation = 'nearest')
plt.xticks([308,341])
plt.yticks([234,271])
Please see my "Amazing Drawing" for further reference. Thanks!
Upvotes: 0
Views: 1557
Reputation: 1571
Just pass the array sub area to imshow.
plt.imshow(image[y_start:y_end, x_start:x_end])
Upvotes: 1