Understanding DICOM image attributes to get axial/coronal/sagittal cuts

后端 未结 4 886
别跟我提以往
别跟我提以往 2021-02-10 12:24

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

4条回答
  •  爱一瞬间的悲伤
    2021-02-10 12:38

    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)
    

提交回复
热议问题