Exemplo n.º 1
0
    def __init__(self, data_xyz, data_j, shape=[10,10,2.5], title='',
                 rad_scale=1):
        
        self.data_xyz = np.array(data_xyz)
        self.data_j = np.array(data_j)
        self.M = self.data_xyz.shape[0] 
        self.shape = shape # um

        self.xlabel = utilmpl.shape2xlabel(self.shape)
        self.title = title
        self.rad_scale = rad_scale
Exemplo n.º 2
0
    def __init__(self, data_xyz, data_ijk, shape=[10,10,4], vmin=0, vmax=None, xlabel='', title='', invert=True,
                 rad_scale=1.0, skip_n=1):
        self.data_xyz = data_xyz
        self.data_ijk = data_ijk

        self.shape = shape
        
        self.xlabel = utilmpl.shape2xlabel(self.shape)
        self.title = title

        # Setup renderer
        self.ren, self.renWin, self.iren = utilvtk.setup_render()

        self.rad_scale = rad_scale*np.min(self.shape)/50
Exemplo n.º 3
0
    def __init__(self, data, vox_dims=[.1,.1,.1], N=2**10, title='',
                 skip_n=1, rad_scale=1, threshold=0):
        self.data = data
        self.npx = np.array(self.data.shape[0:3])
        self.vox_dims = vox_dims # um
        self.N = N
        self.shape = np.array(data.shape[0:3])*np.array(vox_dims)

        self.xlabel = utilmpl.shape2xlabel(self.shape)
        self.title = title
        self.skip_n = skip_n
        self.rad_scale = rad_scale
        self.threshold = threshold

        # Calculate dimensions
        self.lmax, mm = utilsh.j2lm(self.data.shape[-1] - 1)
        self.J = utilsh.maxl2maxj(self.lmax)
Exemplo n.º 4
0
    def from_tiff(self, filename):
        log.info('Reading '+filename)
        with tifffile.TiffFile(filename) as tf:
            # Read data
            self.data = np.ascontiguousarray(np.moveaxis(tf.asarray(), [0, 1, 2, 3], [2, 3, 1, 0]))

            # Read vox_dims from metadata
            xx = tf.pages[0].tags['XResolution'].value
            self.vox_dims[0] = xx[1]/xx[0]
            yy = tf.pages[0].tags['YResolution'].value
            self.vox_dims[1] = yy[1]/yy[0]
            self.vox_dims[2] = tf.imagej_metadata['spacing']
            
        self.npx = np.array(self.data.shape[0:3])
        self.shape = np.array(self.npx)*np.array(self.vox_dims)
        self.xlabel = utilmpl.shape2xlabel(self.shape)
        self.lmax, mm = utilsh.j2lm(self.data.shape[-1] - 1)
        self.J = utilsh.maxl2maxj(self.lmax)
Exemplo n.º 5
0
    def __init__(self, data_xyz, data_J, shape=[10,10,4], N=2**12, title=''):
        self.data_xyz = np.array(data_xyz)
        self.data_J = np.array(data_J)
        self.M = self.data_xyz.shape[0] 
        self.N = N
        self.shape = shape # um

        self.xlabel = utilmpl.shape2xlabel(self.shape)
        self.title = title

        # Calculate dimensions
        self.lmax, mm = utilsh.j2lm(self.data_J.shape[-1] - 1)
        self.J = utilsh.maxl2maxj(self.lmax)

        # Fill the rest of the last l band with zeros
        if self.data_J.shape[-1] != self.J:
            temp = np.zeros(self.J)
            temp[:self.data_J.shape[-1]] = np.array(self.data_J)
            self.data_J = temp

        # Calc points for spherical plotting
        self.xyz = utilsh.fibonacci_sphere(N, xyz=True)
        self.B = utilsh.calcB(self.N, self.J)
Exemplo n.º 6
0
    def __init__(self,
                 data,
                 vox_dims=[1, 1, 1],
                 vmin=0,
                 vmax=None,
                 xlabel='',
                 title='',
                 invert=True):
        self.data = data

        self.shape = data.shape * np.array(vox_dims)
        self.vox_dims = np.array(vox_dims)
        self.invert = invert
        self.xlabel = utilmpl.shape2xlabel(self.shape)
        self.title = title
        self.vmin = vmin
        if vmax is None:
            self.vmax = np.max(data)
        else:
            self.vmax = vnmax

        # Setup renderer
        self.ren, self.renWin, self.iren = utilvtk.setup_render()