I have to write a program in c# able to parse DICOM and display axial, coronal and sagittal cuts.
Seems like it\'s a lot of work, but I have to do it so !
Big fi
This is a python implementation to find plane of an IMA file. Refer: http://dicomiseasy.blogspot.com/2013/06/getting-oriented-using-image-plane.html
import pydicom # for gettind information out of the IMA files
import numpy as np
"""
This function takes IOP of an image and returns its plane (Sagittal, Coronal, Transverse)
"""
def file_plane(IOP):
IOP_round = [round(x) for x in IOP]
plane = np.cross(IOP_round[0:3], IOP_round[3:6])
plane = [abs(x) for x in plane]
if plane[0] == 1:
return "Sagittal"
elif plane[1] == 1:
return "Coronal"
elif plane[2] == 1:
return "Transverse"
a=pydicom.read_file("path\to\your\DICOM\file.IMA")
IOP = a.ImageOrientationPatient
plane = file_plane(IOP)