Skip to content

Conversation

@Lestropie
Copy link
Member

OK, still got some things to fix up in this, but it's at the point where I'd like people to have a play with it and give some feedback before it's distributed to the masses.

The wiki page will hopefully make things more clear; coming in to it with a clean slate will likely be initially confusing, but it's intentionally designed to be very flexible, and designing it around an easier entry for new users I don't think is possible without losing that flexibility, which will be of particular use when NBS2 is released. I should also add some more tool tips...

https://github.com/MRtrix3/mrtrix3/wiki/Connectome-tool-tutorial

Mesh class now supports both 3-vertex and 4-vertex polygons.
Note however that GL_QUADS is depreciated as it turns out, so this functionality will likely never be used...
This function takes as input a mask image, and produces a triangular mesh representing the surface of the mask.
A pair of triangles is generated at every voxel face where a voxel with value 1 touches a voxel with value 0.
Binary receives as input a mask image, and outputs a mesh in .vtk format.
Currently just adds itself to the list of tools, and has a couple of non-working buttons.
Can now read and write from binary and ASCII data in both VTK and STL formats.
This class deals with formation of a GL buffer and neatens the coding interface by hiding the GLuint identifier from the programmer; but it works on index buffers, i.e. data where vertex indices are stored.
This new code structure will allow access to the LUT import functionality within the mrview connectome toolbar.
Allows for lookup tables of different formats to be imported, and shows the file name of the currently-opened LUT.
Have laid the foundations for allowing a high level of flexibility in choosing how nodes of the connectome are plotted.
Most of these don't actually work yet, I'm just getting the framework in place for selecting them and updating settings accordingly.
I also added the possibility of controlling the transparency of each node, not just its visibility.
As previously, none of these actually do anything yet; just laying the foundations for what is possible...
Producing a single list of those tasks still to be completed in order for the connectome tool to be functional, in preparation for pushing to origin...
This will allow access to a spherical mesh with level of detail control for other uses.
- Plotting nodes as spheres now includes lighting.
- Node visualisation section of the toolbar now uses a grid layout.
This will become a breeding ground for connectome-based operations.
Inclusions for now:
- Class Mat2Vec, which provides conversion between matrices and vectors (where the vector does not contain symmetric entries).
- Simple function verify_matrix() to ensure that a matrix imported from file is square, of the correct size, and symmetrical.
Doesn't plot anything yet, but has a large amount of code in place to set and store visualisation properties.
- Disable all node visualisations.
- Only show edges for which both nodes are currently visible.
- Prevent user from trying to show edges based on visible nodes, and nodes based on visible edges.
Whenever a vector / matrix file is used to determine visualisation properties of nodes / edges, the corresponding combobox will now display the name of the imported file currently affecting that property.
@Lestropie
Copy link
Member Author

Thanks Jimmy:

  • (1). Fixed. Just one of those things I intended to do but forgot.
  • (2). I'll need to borrow a Mac at some stage to hunt this one down.
  • (3). Fixed. (Note to self: Never write convenience functions at 5AM)
  • (4). Not a bad idea. Might try to make this its own dockable widget, that by default docks underneath the connectome tool. That way the default will not look too different to current, but the node list can be moved independently, e.g. docked on the opposite side or left floating so the list is longer. I also want to 'compress' the list vertically (i.e. have each row occupy less pixels vertically), but haven't yet figured out how to.
  • (4.1). (Showing node names in the main window) This is definitely on the to-do list. But I don't want to have this functionality delay the release; people can always add their own annotations for the sake of figures. I also want to discuss ideas regarding how this could be done with people first.
  • (5). Agreed; this is not specific to the connectome tool though. Particularly in OrthoView, I'd like to be able to control which direction each projection is generated from. Created new issue MRview: Flippable projection direction #286.

@jdtournier
Copy link
Member

Just to give a few hints with some of the above:

  • setting the font size could be done using an approach similar to what is done in src/gui/mrview/tool/base.cpp, line 44. Note that this is already supposed to set the font size for tools to 2 points less than the default - I'd be wary of reducing the font size further. That said, there's every chance this approach doesn't work as advertised - I seem to get different results depending on which version of Qt I'm using, although I haven't looked into it.
  • displaying text on the display should be trivial. Take a look at src/gui/opengl/font.h, and its actual use for annotations in for example Projection::draw_orientation_labels (), in src/gui/projection.cpp, line 107.
  • I guess this is the rationale behind MRview: Flippable projection direction #286...? As discussed on that issue, I don't think we want to introduce any ambiguity in the display's viewing convention. I appreciate most users of the connectome tool will probably want or expect neurological convention, but they're at least not about to make any clinical decisions on that basis... That said, there may be something we can do about this - I'll expand in MRview: Flippable projection direction #286.

@Lestropie
Copy link
Member Author

  1. I don't think it's the font size so much as the addition of the pixmaps that's causing the thick rows. I'm sure it won't be too hard to fix though.
  2. A 2D text display isn't too hard. But you have to choose an appropriate location to display it, manage shortened node names in the list (including manual editing since most lookup tables don't provide them), provide control for which labels are displayed and which are not, etc.. There's also a few other possibilities (e.g. colouring the labels to match the nodes, drawing labels in 3D space rather than directly on the 2D projection plane) that I'd like to discuss with people. So I'd rather leave this out for now and add it later; its absence won't make the tool unusable.
  3. Yep. Kind of blurted it out without thinking about it a great deal, I'll need to think about it harder at some stage when my brain is working.

Another thing we need to consider, only slightly related to this, is the lighting. At the moment the connectome tool assumes the light position is defined in real space, and therefore does not rotate with the camera. If I change it to become consistent with other tools (i.e. light position is defined in projection space), OrthoView may look weird as the light position would be different in the three views...?

@jdtournier
Copy link
Member

Cool, just thought I'd add my 2 cents...

Interesting issue with the lighting in orthoview... Does it actually look that weird if the lighting is anchored to the camera...?

@Lestropie
Copy link
Member Author

Interesting issue with the lighting in orthoview... Does it actually look that weird if the lighting is anchored to the camera...?

Don't know, haven't tried it. I think initially I got confused by the lighting implementation in the shaders, and by process of re-doing it the light ended up in a fixed position. I also find that when the light position is fixed in real space and you rotate the camera, you get a better contrast between the diffuse and specular components. But it should be consistent between tools, and that was my main concern with going to an anchored light.

@jdtournier
Copy link
Member

So the issue with a fixed light position is that in some views the light will end up behind the object - it might make for some dramatic screenshots, but not necessarily optimal for viewing...

To get around that, we could change the lighting shaders to assume two lights with opposite positions - this probably wouldn't be too much extra work for the shader, I think the only thing that'd need recomputing would be the specular component. And the UI to control the light position would remain as brain-dead simple as it is now. Might be worth a shot?

You could add more lights, but at some point it'll start to look like ambient lighting, so you can't push that too far. And you'd need controls for all of them too...

@Lestropie
Copy link
Member Author

Yeah, that problem is currently highlighted as the viewer initializes to an axial slice but the default light position is superior. I think I'll just revert the lighting in this tool to the standard behaviour; it was mostly me trying to wrap my head around the shader code.

Eventually with central lighting settings I'd like to have the option of multiple light sources; shouldn't be too hard UI-wise or shader-wise. I think I'd prefer that to forcing dual lights with opposite positions. Should look OK as long as the diffuse components aren't too high and the specular exponent is large enough.

@jdtournier
Copy link
Member

Multiple lights might be good, but you might find it rapidly gets very messy... You'd have to update all the relevant shaders to match, and there may be an impact on rendering performance (although probably nothing to worry about a great deal).

But then, maybe we could move to spherical harmonic lighting - it even involves a bit of spherical convolution! I think that would be most appropriate for MRtrix...

Lestropie added 4 commits July 9, 2015 23:04
- Only compute shader variables relevant to lighting if necessary.
- Add lighting for edges when displayed as lines or streamlines.
- Fix 2D view of edge geometry due to uniform value being sent to wrong shader.
@Lestropie
Copy link
Member Author

OK @chunhungyeh, node list is now a separate dockable widget and the rows are much more narrow to fit more in. Break it if you can!

@chunhungyeh
Copy link
Member

@Lestropie : I had another fun time playing with the connectome tool today. And nope, I couldn't break it (should I feel sorry about it? 😄 ). Here are some thoughts from my experiment today:

  • The dockable node table looks great. It is very handy and may actually have several extensions. I have thought about highlighting the node when it is selected from the node list (e.g. higher intensity/brightness for the selected node), and apparently you've already implemented such mechanism! And even you have allowed multiple selections, that's great! Just a minor issue: when playing with it, I found no way switching off this 'highlighting' function. I finally realised I simply do an 'unselect' by pressing Ctrl+mouse button. I think this would be documented somewhere for the new users?
  • Another feature comes into my mind: I think it would be excellent to automatically highlight the relevant nodes and edges when a node is picked up from the node list. They could be highlighted by the brightness (e.g. slightly lower intensity than the selected one but higher than the rest of the nodes) on the main viewing window and also be reflected on the node table, for example, using different highlight colours. (Currently, it is blue for the select node, so maybe red (for instance) for the associated ones.) This would be great because it means that one may quickly know the importance of the selected node as well as the potential network system in which that node has participated. I think such functionality would make the connectome tool not only for visualisation purpose but also, importantly, for 'exploring brain network through visualisation.'
  • I also verify that the previous issues (file selection / transparency control) have been fixed on my laptop. 👍

@Lestropie
Copy link
Member Author

I found no way switching off this 'highlighting' function. I finally realised I simply do an 'unselect' by pressing Ctrl+mouse button. I think this would be documented somewhere for the new users?

Yep: QT provides a small list of selection 'behaviours' for such lists; the one that's most appropriate in this case requires a ctrl-click to deselect, which also means if you've currently got multiple nodes selected, you need to reduce the selection to one node before you can ctrl-click to achieve zero node selection. I think that rather than documenting, I'll add a "De-select all" button.

I think it would be excellent to automatically highlight the relevant nodes and edges when a node is picked up from the node list. They could be highlighted by the brightness (e.g. slightly lower intensity than the selected one but higher than the rest of the nodes) on the main viewing window and also be reflected on the node table, for example, using different highlight colours. (Currently, it is blue for the select node, so maybe red (for instance) for the associated ones.) This would be great because it means that one may quickly know the importance of the selected node as well as the potential network system in which that node has participated.

I think I get where you're trying to go with this. You're suggesting that once a node is selected from the list, the nodes to which it is connected should also be highlighted in some alternative fashion.

This idea stems from a presumed foundation of a binary connectome; not only do we promote and encourage the use of weighted connectomes, we don't have a 'central' connectome from which data are drawn (individual data files are loaded for different visual properties).

Currently, if a single node is selected, all edges emanating from that node will be highlighted. If a matrix file is used to threshold the visibility of edges, then only a subset of those edges will be visible. It would therefore theoretically be possible to identify those nodes connected via such edges, and apply some other form of highlighting to them. However this would only work if some mechanism is used to limit edge visibility; otherwise all other nodes would be highlighted by such a mechanism (as all possible edges exist until you have data that says otherwise). It would also add an extra row 'block' to the selection highlight settings UI. But at least the logic is sound enough, and expands to the case of multiple nodes being selected... Might have a go at this.

... 'exploring brain network through visualisation.'

Personally I prefer 'assessing brain network through data-driven analysis'... but that's just me :-P

When performing manual selection of nodes, the connectome tool now distinguishes between nodes / edges that are 'associated' with the selected nodes (ie. an edge that is connected to one selected node, or a node that has a visible edge connection to a selected node), as opposed to nodes / edges that are in no way involved with the selection. Full settings for controlling how these elements appear visually are also provided.
Use frames to separate the various node selection visibility settings.
- Moved the button for accessing the node selection settings to the top of the frame, and changed it to display an icon instead of text.
- Added a 'clear selection' button.
Provides slightly better visuals for the use case where nodes are transparent but edges are not.
@chunhungyeh
Copy link
Member

@Lestropie : I just played with your new commits that have enhanced the node table functionality, and I think that's cool and interesting...pretty sure that it will be a very useful feature. And yes, I do agree with you about the data-driven approach, but I also enjoy those 'visual effects' as they are quite amusing. 😏

Just adding some tool tips and removing some comments.
@Lestropie Lestropie merged commit 29890d8 into master Jul 17, 2015
@Lestropie Lestropie deleted the connectome_tool branch July 17, 2015 18:20
@jdtournier
Copy link
Member

👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants