Esempio n. 1
0
    def __init__(self, dims=None, units=None, resolution=None,
                 n_object=None, n_slice=None):
        Object.__init__(self, name='box',
                        dims=np.array(dims, dtype=np.float64),
                        units=units, resolution=resolution,
                        n_object=n_object, n_slice=n_slice)

        if not isinstance(self.n_slice, dict):
            self.n_slice = {'z' : int(self.n_slice)}

        self.init_trait('volume', np.prod(self.dims))

        self._axis_map = {'x' : [1, 2, 0], 'y' : [2, 0, 1], 'z' : [0, 1, 2]}
Esempio n. 2
0
    def __init__(self, semiaxes):
        """
        Parameters:

            semiaxes : (float, float, float)
                The semiaxes a, b, c of the ellipsoid.
        """
        self.semiaxes = np.array(semiaxes, dtype=np.float64)
        self.mtx0 = np.diag(1.0 / (self.semiaxes**2))

        im = self.semiaxes.argmax()
        self.direction0 = np.eye(3, dtype=np.float64)[im]

        self.volume = 4.0 / 3.0 * np.pi * np.prod(self.semiaxes)
        self.surface = self.compute_approximate_surface()
        self.length = self.semiaxes[im]

        self.is_placed = False
        self.intersection_counters = {}
        self.intersector = EllipsoidIntersector()
Esempio n. 3
0
    def __init__(self, semiaxes):
        """
        Parameters:

            semiaxes : (float, float, float)
                The semiaxes a, b, c of the ellipsoid.
        """
        self.semiaxes = np.array(semiaxes, dtype=np.float64)
        self.mtx0 = np.diag(1.0 / (self.semiaxes**2))

        im = self.semiaxes.argmax()
        self.direction0 = np.eye(3, dtype=np.float64)[im]

        self.volume = 4.0 / 3.0 * np.pi * np.prod(self.semiaxes)
        self.surface = self.compute_approximate_surface()
        self.length = self.semiaxes[im]

        self.is_placed = False
        self.intersection_counters = {}
        self.intersector = EllipsoidIntersector()
Esempio n. 4
0
 def get_pixel_area(self, axis):
     """
     Get the area in pixels squared of a slice for the given axis.
     """
     return np.prod(self.get_pixel_sizes(axis))
Esempio n. 5
0
 def get_area(self, axis):
     """
     Get the area of a slice for the given axis.
     """
     return np.prod(self.get_sizes(axis))