Beispiel #1
0
def stltrdog(stlpath, resolution):

    mesh, bounding_box = read_and_reshape_stl(stlpath, resolution)

    voxels, bounding_box = voxelize(mesh, bounding_box)
    resdog = voxels.transpose((2, 1, 0))
    return resdog
    pass
Beispiel #2
0
    def voxelize(self):

        resolution = int(self.resolution)
        mesh, self.bounding_box = read_and_reshape_stl(self.model_fileName,
                                                       resolution)

        process_number = int(multiprocessing.cpu_count()) * 2
        self.voxels = voxelize(mesh, self.bounding_box, process_number)
Beispiel #3
0
    def voxelize(self):

        resolution = int(self.spinBox.value())
        mesh, self.bounding_box = read_and_reshape_stl(self.model_fileName,
                                                       resolution)

        process_number = int(self.spinBox_2.value())
        self.voxels = voxelize(mesh, self.bounding_box, process_number)

        self.pushButton_8.clicked.connect(self.generate_final_model)
        self.horizontalSlider.sliderReleased.connect(self.update_graph)
        self.label_6.setText('{}'.format(self.bounding_box[0]))
        self.label_7.setText('{}'.format(self.bounding_box[1]))
        self.label_8.setText('{}'.format(self.bounding_box[2]))
        self.horizontalSlider.setRange(0, self.bounding_box[2] - 1)
        self.horizontalSlider.setValue(int(np.floor(self.bounding_box[2] / 2)))
        self.update_graph()

        self.i0 = np.array([])
        self.i1 = np.array([])
        self.i2 = np.array([])
        self.o1 = np.array([])
        self.o2 = np.array([])
 def run(self):
     mesh, bounding_box = read_and_reshape_stl(self.input_filename, self.resolution)
     self.voxels, bounding_box = voxelize(mesh, bounding_box)
     self.voxelize_finished.emit('finished')
Beispiel #5
0
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Mon Feb 11 08:55:42 2019

@author: bene
"""
import numpy as np
import matplotlib.pyplot as plt
from mesh_vox import read_and_reshape_stl, voxelize

# path to the stl file
input_path = '/Users/bene/Dropbox/Dokumente/Promotion/PROJECTS/BOSTON/MUSCAT/PYTHON/muScat/Data/NEURON/neuron.stl'
# number of voxels used to represent the largest dimension of the 3D model
resolution = 32

# read and rescale
mesh, bounding_box = read_and_reshape_stl(input_path, resolution)
# create voxel array
voxels, bounding_box = voxelize(mesh, bounding_box)

print(voxels)
np.save(
    '/Users/bene/Dropbox/Dokumente/Promotion/PROJECTS/BOSTON/MUSCAT/PYTHON/muScat/Data/NEURON/myneuron_32_32_70.npy',
    voxels[0:70, 35:32 + 35, 35:32 + 35])