Beispiel #1
0
def read_dicom(dicom_path):
    # Function that reads a dicom file and writes to a text file
    dataset = ReadData.read_dicom(dicom_path)
    ds = dataset.DeformableRegistrationSequence[1].DeformableRegistrationGridSequence[0].VectorGridData
    ds = np.array(ds).astype(np.float64)
    print(ds)
    with open("dvf.raw", "wb") as f:
        f.write(ds)
Beispiel #2
0
def read_dicom(dicom_path):
    # Function that reads a dicom file and writes to a text file
    dataset = ReadData.read_dicom(dicom_path)
    # vector_grid = dataset.DeformableRegistrationSequence[1].DeformableRegistrationGridSequence[0].VectorGridData
    # vector_grid = np.array(vector_grid).astype(np.float64)
    #
    # with open("dvf.raw", "wb") as f:
    #     f.write(vector_grid)
    ReadData.write_dicom(dataset, "image_test")
Beispiel #3
0
 def get_rigid_transforms(reg_path):
     dataset = ReadData.read_dicom(reg_path)
     # Pre-Deformation
     pre_def = dataset.DeformableRegistrationSequence[
         1].PreDeformationMatrixRegistrationSequence[
             0].FrameOfReferenceTransformationMatrix
     pre_def = np.array(pre_def).astype(np.float64)
     pre_def = np.reshape(pre_def, (4, 4))
     # Post-Deformation
     post_def = dataset.DeformableRegistrationSequence[
         1].PostDeformationMatrixRegistrationSequence[
             0].FrameOfReferenceTransformationMatrix
     post_def = np.array(post_def).astype(np.float64)
     post_def = np.reshape(post_def, (4, 4))
     return pre_def, post_def
Beispiel #4
0
def read_dicom(dicom_path):
    ds = ReadData.read_dicom(dicom_path)
    #petct_data =
    # dvf_data = ReadData.load_dvf_data(ds)
    ReadData.write_dicom(ds, "pct_dicom")