I am looking to find a way to read a DICOM file and display the multi frame DICOM file as a video in an UI, I tried reading the multi frame DICOM file using pydicom and I was able to get each frame and appended it into a list and I created a gif out of that multi frame DICOM file and used the tkinter to display the gif in the UI. As you can see I was storing the multi frame as gif locally and display it. I want to know is there any other way without storing the frame as gif, read the frame and display it directly in an UI. Below is the code which I used
from tkinter import *
lisImage = []
if __name__=="__main__":
import argparse
parser = argparse.ArgumentParser(description=__doc__)
parser.add_argument("dicom_image", help="Path to the DICOM image to load")
args = parser.parse_args()
import imageio
index=0;
frameCnt = 243
root = Tk()
frames = [PhotoImage(file='movie.gif', format='gif -index %i' % (i)) for i in range(frameCnt)]
def update(ind):
frame = frames[ind]
ind += 1
if ind == frameCnt:
ind = 0
label.configure(image=frame)
root.after(100, update, ind)
label = Label(root)
label.pack()
root.after(0, update, 0)
root.mainloop()