def value(self, value):

        a = vv.gca()
        view = a.GetView()
        a.Clear()
        vv.volshow3(value, renderStyle='mip')
        if not self._first:
            a = vv.gca()
            a.SetView(view)

        self._first=False
    def refresh(self):
        if len(self._value)>1:
            a = vv.gca()
            view = a.GetView()
            a.Clear()
            vv.volshow3(self._value, renderStyle='mip', cm=self._colorMap )
            if not self._first:
                a = vv.gca()
                a.SetView(view)

            self._first=False
Esempio n. 3
0
    def refresh(self):
        if len(self._value)>1:
            vv.figure(self._fig.nr)
        
            a = vv.gca()
            view = a.GetView()
            a.Clear()
            vv.volshow3(self._value, renderStyle='mip', cm=self._colorMap, clim=self._colors_limits )
            if not self._first:
                a = vv.gca()
                a.SetView(view)

            self._first=False
Esempio n. 4
0
    def refresh(self):
        if len(self._value) > 1:
            vv.figure(self._fig.nr)

            a = vv.gca()
            view = a.GetView()
            a.Clear()
            vv.volshow3(self._value, renderStyle='mip', cm=self._colorMap)
            if not self._first:
                a = vv.gca()
                a.SetView(view)

            self._first = False
Esempio n. 5
0
def volshow(*args, **kwargs):
    """ volshow(vol, clim=None, cm=CM_GRAY, axesAdjust=True, axes=None)
    
    Display a 3D image (a volume). 
    
    This is a convenience function that calls either volshow3() or 
    volshow2(). If the current system supports it (OpenGL version >= 2.0), 
    displays a 3D  rendering (volshow3). Otherwise shows three slices 
    that can be moved interactively (volshow2). 
    
    Parameters
    ----------
    vol : numpy array
        The 3D image to visualize. Can be grayscale, RGB, or RGBA.
        If the volume is an anisotropic array (vv.Aaray), the appropriate
        scale and translate transformations are applied.
    clim : 2-element tuple
        The color limits to scale the intensities of the image. If not given,
        the im.min() and im.max() are used (neglecting nan and inf).
    cm : Colormap
        Set the colormap to apply in case the volume is grayscale.
    axesAdjust : bool
        If axesAdjust==True, this function will call axes.SetLimits(), and set
        the camera type to 3D. If daspectAuto has not been set yet, it is
        set to False.
    axes : Axes instance
        Display the image in this axes, or the current axes if not given.
    
    Any other keyword arguments are passed to either volshow2() or volshow3().
    
    """

    # Make sure that a figure exists
    vv.gcf()

    # Test and run
    if vv.settings.volshowPreference == 3 and vv.misc.getOpenGlCapable(2.0):
        return vv.volshow3(*args, **kwargs)
    else:
        return vv.volshow2(*args, **kwargs)
Esempio n. 6
0
def volshow(*args, **kwargs):
    """ volshow(vol, clim=None, cm=CM_GRAY, axesAdjust=True, axes=None)
    
    Display a 3D image (a volume). 
    
    This is a convenience function that calls either volshow3() or 
    volshow2(). If the current system supports it (OpenGL version >= 2.0), 
    displays a 3D  rendering (volshow3). Otherwise shows three slices 
    that can be moved interactively (volshow2). 
    
    Parameters
    ----------
    vol : numpy array
        The 3D image to visualize. Can be grayscale, RGB, or RGBA.
        If the volume is an anisotropic array (vv.Aaray), the appropriate
        scale and translate transformations are applied.
    clim : 2-element tuple
        The color limits to scale the intensities of the image. If not given,
        the im.min() and im.max() are used (neglecting nan and inf).
    cm : Colormap
        Set the colormap to apply in case the volume is grayscale.
    axesAdjust : bool
        If axesAdjust==True, this function will call axes.SetLimits(), and set
        the camera type to 3D. If daspectAuto has not been set yet, it is
        set to False.
    axes : Axes instance
        Display the image in this axes, or the current axes if not given.
    
    Any other keyword arguments are passed to either volshow2() or volshow3().
    
    """
    
    # Make sure that a figure exists
    vv.gcf()
    
    # Test and run
    if vv.settings.volshowPreference==3 and vv.misc.getOpenGlCapable(2.0):
        return vv.volshow3(*args, **kwargs)
    else:
        return vv.volshow2(*args, **kwargs)
Esempio n. 7
0
t_end = 3600
epsilon = 1E-10
diff = epsilon  * 2
zeros = np.zeros(Ci.shape)
while(t <= t_end and diff >= epsilon):
    #solve for the gradients in each direction
    l_xyz = ndimage.convolve(Ci, l, mode = "constant",
                           cval = c_out)
#    l_y = ndimage.convolve(Ci, ly, mode = "constant",
#                           cval = c_out)
#    l_z = ndimage.convolve(Ci, lz, mode = "constant",
#                           cval = c_out)
    #first diffusion
    C = Ci + (l_xyz)*D*dt
    #MUST BE normalized by unit VOLUME
    temp_sink = (-sink*dt) / grid_vol
    temp_source = source*dt / grid_vol
    C += temp_sink + temp_source
    #get the summed difference
    diff = np.sum(np.abs(Ci - C))
    #make sure its positive
    C = C * (C > 0.0)
    #update the old
    Ci = C
    #update the time step
    t += dt

vv.use('qt4')    
vv.volshow3(C)
app = vv.use()
app.Run()
Esempio n. 8
0
    # create texture
    t = vv.Texture3D(axes, vol, renderStyle)

    # set clim
    if isinstance(clim, list):
        clim = tuple(clim)
    if isinstance(clim, tuple):
        t.SetClim(clim)

    # set colormap
    if cm is not None:
        t.colormap = cm

    # adjust axes
    if axesAdjust:
        if axes.daspectAuto is None:
            axes.daspectAuto = False
        axes.cameraType = '3d'
        axes.SetLimits()

    # done
    axes.Draw()
    return t


if __name__ == "__main__":
    vol = vv.aVolume()
    t = vv.volshow3(vol)
    t.renderStyle = 'iso'  # Isosurface rendering instead of MIP
    t.isoThreshold = 0.1
Esempio n. 9
0
    # create texture
    t = vv.Texture3D(axes, vol, renderStyle)
    
    # set clim
    if isinstance(clim,list):
        clim = tuple(clim)
    if isinstance(clim, tuple):
        t.SetClim(clim)
    
    # set colormap
    if cm is not None:
        t.colormap = cm
    
    # adjust axes
    if axesAdjust:
        if axes.daspectAuto is None:
            axes.daspectAuto = False
        axes.cameraType = '3d'
        axes.SetLimits()
    
    # done
    axes.Draw()
    return t


if __name__ == "__main__":
    vol = vv.aVolume()
    t = vv.volshow3(vol)
    t.renderStyle = 'iso' # Isosurface rendering instead of MIP
    t.isoThreshold = 0.1