Esempio n. 1
0
def mephysto(filepath, index):
    filepath_found = wildcard_file_resolution(filepath)

    (axis, reading, scan_curvetype,
     scan_depth) = load_single_item(filepath_found, int(index))

    second_column_header = ["Reading"]

    if scan_curvetype == "PDD":
        first_column_header = ["Depth Profile", "Depth (mm)"]
        second_column_header = [None] + second_column_header
    elif scan_curvetype == "INPLANE_PROFILE":
        first_column_header = ["Inplane Profile", "y (mm)"]
        second_column_header = (["Depth = {} mm".format(scan_depth)] +
                                second_column_header)
    elif scan_curvetype == "CROSSPLANE_PROFILE":
        first_column_header = ["Crossplane Profile", "x (mm)"]
        second_column_header = (["Depth = {} mm".format(scan_depth)] +
                                second_column_header)
    else:
        raise ValueError("Unexpected Profile Type")

    first_column = np.concatenate([first_column_header, axis])
    second_column = np.concatenate([second_column_header, reading])

    return np.vstack([first_column, second_column]).T
Esempio n. 2
0
def depth_dose(dicom_path, depth_adjust, averaging_distance=0):
    dicom_path_found = wildcard_file_resolution(dicom_path)

    ds = pydicom.read_file(dicom_path_found, force=True)

    depth, depth_dose_values = extract_depth_dose(ds, depth_adjust,
                                                  averaging_distance)

    return np.vstack([depth, depth_dose_values]).T
Esempio n. 3
0
def crossplane_profile(dicom_path,
                       depth_adjust,
                       depth_lookup,
                       averaging_distance=0):
    dicom_path_found = wildcard_file_resolution(dicom_path)

    ds = pydicom.read_file(dicom_path_found, force=True)

    _, _, crossplane, crossplane_dose = extract_profiles(
        ds, depth_adjust, depth_lookup, averaging_distance)

    return np.vstack([crossplane, crossplane_dose]).T
Esempio n. 4
0
def arbitrary_profile(dicom_path, depth_adjust, inplane, crossplane, depth):
    dicom_path_found = wildcard_file_resolution(dicom_path)

    inplane_ref = np.invert(np.isnan(inplane))
    crossplane_ref = np.invert(np.isnan(crossplane))
    depth_ref = np.invert(np.isnan(depth))

    reference = inplane_ref & crossplane_ref & depth_ref

    ds = pydicom.read_file(dicom_path_found, force=True)

    dose = arbitrary_profile_from_dicom_dose(ds, depth_adjust,
                                             inplane[reference],
                                             crossplane[reference],
                                             depth[reference])

    result = np.ones_like(inplane) * np.nan
    result[reference] = dose

    return np.vstack([result]).T