Slicer3:VisualBlog Extension

From Slicer Wiki
Jump to: navigation, search
Home < Slicer3:VisualBlog Extension

Image from pieper on Tuesday, August 08, 2006 at 4:26PM

A number of things have come together to allow the new prototype editor module:

  • the label map layers are enabled
  • lookup table support in the layer logic
  • a new set of 2D UI widgets
  • generalized painting infrastructure, which is based on requests and feedback from NA-MIC Core 3 users and other users of Slicer2
    • paint brush has a 'threshold' option in which the label map only gets painted if the background intensity is in a specified range
    • paint brush optionally won't overpaint existing voxels
    • 'eye dropper' mode allows you to start painting with the label value where you first clicked (so you don't need to go to the UI to change the label color as often).
    • all painting operations can happen on arbitrarily transformed volumes. This allows the painting plane to be aligned with the major axis of a structure like the hippocampus
    • background layers are interpolated to current screen resolution (not limited to nearest neighbor sampling as in slicer2's draw mode)
    • painting is performed using a circular brush with a diameter selected by the user. this makes it easier to follow the contours of curved biological structures.
    • the cursor is turned off on mouse down and reappears on mouse up so you can see the exact pixels you are drawing (a circle around the cursor location indicates the mouse location)

A few limitations make this still a 'prototype' including:

  • there's no convenient way to save your label maps volumes (except as dicom)
  • the color map is currently random
  • only label numbers 0-255 will show as distinct colors
  • no hot keys for frequently used operations
  • brush radius is in screen space units rather than RAS (means that the brush is effectively getting bigger and smaller as you zoom in and out)
  • the paint algorithm is implemented inefficiently and can be slow when painting large numbers of pixels
  • much of the code is written in tcl - new vtk classes are needed to implement the functionality more efficiently.

Image from pieper on Thursday, July 13, 2006 at 4:49PM

Type Control-T to bring up interactor, then

source Base/GUI/Testing/TestSliceModels.tcl
SliceModelsAdd

This test does things the right way in that it creates model nodes for the slices and the updates of the planes is triggered by observers on the Slice Logic. But it does things the wrong way in that it creates the texture in an ad hoc way for now since we don't yet have a clean way to specify textures in the model display nodes. Also, the Viewer renders on every changes to the slice view, so as you pan/zoom/scroll the slices the redraws are jerky. Next step is to figure out how best to get this functionality integrated into the C++. Probably there should be a vtkSlicerSliceModelsLogic class that's managed by the vtkSlicerSliceGUI.


Image from blezek on Tuesday, April, 10, 2007 at 8:00AM

Bringing up the Python console


Now, do something interesting with it!

>>> # import MatPlotLib via pylab functions so we can refer to them directly
>>> from pylab import *
>>> imshow ( data[128,:,:] )
>>> # Instruct pylab to show our plots... hit return to continue entering commands.
>>> show()
Voila!