Step 1 (optional): prepare your VTK file. Make sure you have
CELL_DATAsegment(s). Do NOT create multiple
CELL_DATA nlines in one file - VTK format is linear.
Step 2: Start Mayavi2 GUI application and load the VTK file. There are two ways to do so.
I am always lazy. So I run command like the one below from UNIX/Linux Shell.
mayavi2 -d ../Data/brains/50201_surf/lh.sulc.fundi.from.pits.inflated.final.vtk -m Surface
You can also use GUI menu in Mayavi2. This will take two steps.
- Load the data: File-> Load data -> Open file ...
- Visualize: Suppose we want the surface of the data now. Visualize->Modules
Click the data file in the Engine Tree View. Select the proper data attribute in Mayavi object editor below. For example, I select CmpntID in Point scalars name.
Step 4 (optional): Turn on LUT legend.
Click the Color and legends below the VTK file in Engine Tree View. If the data attribute is scalar, select Scalar LUT tab and check Show legend. Then you will see a legend bar on the right of your scene.
Step 5: Select points. This part a little bit tricky because 1) you are selecting a 3-D object on a 2-D interface and 2) the GUI of Mayavi2 isn't very user-friendly for this purpose.
- Move you mouse over a random place (or over your the point you wanna pick data) on the scene.
- Press 'p' on your keyboard. A dialog box titled Edit properties will pop up.
- Make sure that you selected Pick type as point_picker. And choose a small enough Tolerance level. I don't know what it means but if it is smaller, it's easier to precisely pick up a point. The default tolerance is 0.025. I prefer 0.01.
- Now click on somewhere you really wanna pick on the scene, and then click 'p'. There will be a 3-D crosshair. It is very useful because it tells you where you really selected.
- On the Edit properties window, there are some value. In our case, we care about the scalar (fundusID). It reads 41.0 on the snapshot, and it matches the value on legend bar for points of this color. If there is a mismatch, rotate the object and redo.
- Repeat step 4 and 5 to find out scalar values you care at other places. Press 'p' every time after selecting somewhere. You should at least see coordinates changes when you select different places. The legend bar on the right can help you verify the scalar value you pick. You should read none for all fields if you move mouse out of the object.
1. If coordinates do not change when your click different places, check whether the cursor falls in the History box in Edit Properties dialog box.) In that case, you shall see a lot of p's in the History box (on the top or at the end mostly).
2. If you keep missing a point while the mouse seems to be over it, rotate the object. Selection a 3-D subject in 2-D visualization means you will always miss on one dimension/axis.
3. A help for the problem above is to press Alt+3 on the scene and put on a pair of 3-D anaglyph glasses. This will enable your real 3-D view.