Esempio n. 1
0
    def file_export_id(self, include_otolith=False):
        folder = tk.filedialog.askdirectory(title="Select export location")

        if folder:
            sulcus = self.otolith.get_sulcus() * 255

            if include_otolith:
                sulcus = self.otolith.slices + sulcus

            general.arr_to_folder(sulcus,
                                  "%s/%s_sulcus" % (folder, self.otolith.name),
                                  verbose=True)
Esempio n. 2
0
def run(input_folder, output_folder, visualize=False):
    imgdata = vtk_functions.folder_to_imgdata(input_folder)

    np_data, omega = prepare_slices(imgdata, visualize)

    if is_upside_down(np_data[:, :, int(np_data.shape[2] / 2)]):
        np_data = np.rot90(np_data, k=2, axes=(0, 1))
        print("Finished flipping...")

    basename = os.path.basename(input_folder)

    if omega < 1:
        general.arr_to_folder(np_data, "%s/%s_prepared_%s" % (output_folder,
                                                              basename, omega))
    else:
        general.arr_to_folder(np_data, "%s/%s_prepared" % (output_folder,
                                                           basename))
Esempio n. 3
0
sys.path.insert(1, '../functions')

import vtk_functions
import general
import os

if __name__ == "__main__":
    args = sys.argv[1:]
    input_folder = str(args[0])
    output_folder = args[1]

    max_z = 2000
    imgdata = vtk_functions.folder_to_imgdata(input_folder, verbose=True)

    print("Loaded files...")

    dims = imgdata.GetDimensions()

    omega = 1

    if dims[2] > max_z:
        omega = general.trunc(max_z / dims[2], 1)
        print("Omega: %s" % omega)

    resized_imgdata = vtk_functions.resize_imgdata(imgdata, omega)

    arr = vtk_functions.imgdata_to_arr(resized_imgdata)

    basename = os.path.basename(input_folder)
    general.arr_to_folder(arr, "%s/%s_%s" % (output_folder, basename, omega))
Esempio n. 4
0
import sys
sys.path.insert(1, '../functions')

import vtk_functions
import general
import numpy as np

if __name__ == "__main__":
    args = sys.argv[1:]
    input_folder = str(args[0])
    output_folder = args[1]

    np_data = general.folder_to_arr(input_folder, file_format="tif",
                                    verbose=False)

    np_data = np.rot90(np_data, k=2, axes=(1, 2))
    general.arr_to_folder(np_data, output_folder)